aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2017-10-06 07:16:36 -0400
committerPaul Gilbert2017-10-06 07:16:36 -0400
commit223867b2f5f2ccb3c5ade26cca5af15b65d3dbbc (patch)
tree4e805d7af20b50cb713414dca15d0efdfd75fc3b /engines/titanic/true_talk
parent6f8f27ecb28fca750e0ceaa09779d78164eaaaac (diff)
downloadscummvm-rg350-223867b2f5f2ccb3c5ade26cca5af15b65d3dbbc.tar.gz
scummvm-rg350-223867b2f5f2ccb3c5ade26cca5af15b65d3dbbc.tar.bz2
scummvm-rg350-223867b2f5f2ccb3c5ade26cca5af15b65d3dbbc.zip
TITANIC: DE: Fixes for article handling
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp5
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp17
-rw-r--r--engines/titanic/true_talk/tt_sentence.h4
3 files changed, 19 insertions, 7 deletions
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 3481587b8d..f230179f96 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -1741,9 +1741,10 @@ void TTparser::preprocessGerman(TTstring &line) {
"et ", "st ", "s ", "e ", "n ", "t "
};
- for (uint idx = 0; idx < _replacements4.size(); idx += 3) {
- if (!line.hasSuffix(_replacements4[idx + 2]))
+ for (uint idx = 0; idx < _replacements4.size(); ++idx) {
+ if (!line.hasSuffix(_replacements4[idx]))
continue;
+
const char *lineP = line.c_str();
const char *p = strstr(lineP, _replacements4[idx].c_str());
if (!p || p == lineP || *(p - 1) != ' ')
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 2c675ba9e5..1bb30d33d6 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -24,6 +24,7 @@
#include "titanic/true_talk/tt_concept.h"
#include "titanic/true_talk/script_handler.h"
#include "titanic/titanic.h"
+#include "titanic/translation.h"
namespace Titanic {
@@ -311,6 +312,12 @@ bool TTsentence::isConcept34(int slotIndex, const TTconceptNode *node) const {
bool TTsentence::localWord(const char *str) const {
CScriptHandler &scriptHandler = *g_vm->_exeResources._owner;
bool foundMatch = false;
+ static const char *const ARTICLES_EN[11] = {
+ "it", "that", "he", "she", "him", "her", "them", "they", "those", "1", "thing"
+ };
+ static const char *const ARTICLES_DE[9] = {
+ "es", "das", "er", "ihn", "ihm", "ihnen", "diese", "man", "ding"
+ };
if (scriptHandler._concept1P) {
TTstring s = scriptHandler._concept1P->getText();
@@ -332,15 +339,15 @@ bool TTsentence::localWord(const char *str) const {
continue;
const TTstring wordStr = nodeP->_wordP->_text;
- if (mode == VOCAB_MODE_EN && wordStr == str) {
+ if ((g_language == Common::DE_DEU || mode == VOCAB_MODE_EN) && wordStr == str) {
result = true;
} else if (nodeP->_wordP->findSynByName(str, &syn, mode)) {
result = true;
} else if (foundMatch) {
- result = wordStr == "it" || wordStr == "that" || wordStr == "he"
- || wordStr == "she" || wordStr == "him" || wordStr == "her"
- || wordStr == "them" || wordStr == "they" || wordStr == "those"
- || wordStr == "1" || wordStr == "thing";
+ result = false;
+ for (int idx = 0; idx < TRANSLATE(11, 9) && !result; ++idx) {
+ result = wordStr == TRANSLATE(ARTICLES_EN[idx], ARTICLES_DE[idx]);
+ }
}
}
diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h
index 01a0346be8..dfbf7ae52f 100644
--- a/engines/titanic/true_talk/tt_sentence.h
+++ b/engines/titanic/true_talk/tt_sentence.h
@@ -119,6 +119,10 @@ public:
bool isConcept34(int slotIndex, const TTconceptNode *node = nullptr) const;
+ /**
+ * Returns true if the sentence contains the specified word,
+ * allowing for common synonyms of the desired word
+ */
bool localWord(const char *str) const;
/**