aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2017-10-06 20:37:28 -0400
committerPaul Gilbert2017-10-06 20:37:28 -0400
commit9b51c1dbbd1a4cb894080e73cfde7d84517131ed (patch)
treebb846a1f3c040d22ad5a3264db6d91917231d2eb /engines/titanic/true_talk
parent223867b2f5f2ccb3c5ade26cca5af15b65d3dbbc (diff)
downloadscummvm-rg350-9b51c1dbbd1a4cb894080e73cfde7d84517131ed.tar.gz
scummvm-rg350-9b51c1dbbd1a4cb894080e73cfde7d84517131ed.tar.bz2
scummvm-rg350-9b51c1dbbd1a4cb894080e73cfde7d84517131ed.zip
TITANIC: DE: Fix recognising words with common suffixes
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/tt_vocab.cpp12
-rw-r--r--engines/titanic/true_talk/tt_vocab.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp
index 861d8f89a0..5ed163f364 100644
--- a/engines/titanic/true_talk/tt_vocab.cpp
+++ b/engines/titanic/true_talk/tt_vocab.cpp
@@ -182,10 +182,10 @@ TTword *TTvocab::getWord(TTstring &str, TTword **srcWord) const {
if (!word) {
TTstring tempStr(str);
if (tempStr.size() > 2) {
- word = getSuffixedWord(tempStr);
+ word = getSuffixedWord(tempStr, srcWord);
if (!word)
- word = getPrefixedWord(tempStr);
+ word = getPrefixedWord(tempStr, srcWord);
}
}
@@ -230,11 +230,11 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const {
return newWord;
}
-TTword *TTvocab::getSuffixedWord(TTstring &str) const {
+TTword *TTvocab::getSuffixedWord(TTstring &str, TTword **srcWord) const {
TTstring tempStr(str);
TTword *word = nullptr;
- if (g_vm->isGerman()) {
+ if (g_language == Common::DE_DEU) {
static const char *const SUFFIXES[11] = {
"est", "em", "en", "er", "es", "et", "st",
"s", "e", "n", "t"
@@ -243,7 +243,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
for (int idx = 0; idx < 11; ++idx) {
if (tempStr.hasSuffix(SUFFIXES[idx])) {
tempStr.deleteSuffix(strlen(SUFFIXES[idx]));
- word = getPrimeWord(tempStr);
+ word = getPrimeWord(tempStr, srcWord);
if (word)
break;
tempStr = str;
@@ -514,7 +514,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
return word;
}
-TTword *TTvocab::getPrefixedWord(TTstring &str) const {
+TTword *TTvocab::getPrefixedWord(TTstring &str, TTword **srcWord) const {
TTstring tempStr(str);
TTword *word = nullptr;
int prefixLen = 0;
diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h
index 7e5cc29bc5..def42ba63d 100644
--- a/engines/titanic/true_talk/tt_vocab.h
+++ b/engines/titanic/true_talk/tt_vocab.h
@@ -68,7 +68,7 @@ private:
* @param str Word to check
* @returns New word instance for found match, or nullptr otherwise
*/
- TTword *getSuffixedWord(TTstring &str) const;
+ TTword *getSuffixedWord(TTstring &str, TTword **srcWord = nullptr) const;
/**
* Checks the passed word for common prefixes, and checks for a word
@@ -76,7 +76,7 @@ private:
* @param str Word to check
* @returns New word instance for found match, or nullptr otherwise
*/
- TTword *getPrefixedWord(TTstring &str) const;
+ TTword *getPrefixedWord(TTstring &str, TTword **srcWord = nullptr) const;
public:
TTvocab(VocabMode vocabMode);
~TTvocab();