diff options
author | Paul Gilbert | 2019-07-25 19:27:21 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-07-25 19:27:21 -0700 |
commit | 536ae27e1cbc3a2cffd6f664196c46ba2defe4f8 (patch) | |
tree | 7ac21c0e408991ed5bf54f485c1c2cdccd20510d /engines/titanic/true_talk | |
parent | 65b8aa62a086a794937800188b00f19101a1298f (diff) | |
download | scummvm-rg350-536ae27e1cbc3a2cffd6f664196c46ba2defe4f8.tar.gz scummvm-rg350-536ae27e1cbc3a2cffd6f664196c46ba2defe4f8.tar.bz2 scummvm-rg350-536ae27e1cbc3a2cffd6f664196c46ba2defe4f8.zip |
TITANIC: Fix gcc compiler warnings
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/tt_concept.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept.h | 8 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept_node.h | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_sentence.cpp | 4 |
5 files changed, 31 insertions, 22 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 990c8d204f..aed621bd99 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -30,7 +30,7 @@ namespace Titanic { TTconcept::TTconcept() : _string1(" "), _string2(" "), _nextP(nullptr), _scriptP(nullptr), _wordP(nullptr), _word2P(nullptr), _status(SS_VALID), - _scriptType(ST_UNKNOWN_SCRIPT), _field14(0), _field20(0), _field34(0) { + _scriptType(ST_UNKNOWN_SCRIPT), _field14(0), _field1C(0), _field20(0), _field30(0), _field34(0) { if (setStatus()) setScriptType(ST_UNKNOWN_SCRIPT); else @@ -39,7 +39,8 @@ TTconcept::TTconcept() : _string1(" "), _string2(" "), TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : _string1(" "), _string2(" "), _nextP(nullptr), _wordP(nullptr), _word2P(nullptr), _scriptP(nullptr), - _status(SS_VALID), _scriptType(ST_UNKNOWN_SCRIPT), _field14(0), _field20(0), _field34(0) { + _status(SS_VALID), _scriptType(ST_UNKNOWN_SCRIPT), _field14(0), _field1C(0), _field20(0), _field30(0), + _field34(0) { if (!script->getStatus()) { setScriptType(scriptType); _scriptP = script; @@ -53,7 +54,7 @@ TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : } TTconcept::TTconcept(TTword *word, ScriptType scriptType) : - _string1(" "), _string2(" "), _nextP(nullptr), _wordP(nullptr), _scriptP(nullptr), + _string1(" "), _string2(" "), _nextP(nullptr), _wordP(nullptr), _word2P(nullptr), _scriptP(nullptr), _status(SS_VALID), _scriptType(ST_UNKNOWN_SCRIPT), _field14(0), _field1C(0), _field20(0), _field30(0), _field34(0), _flag(false) { if (!word || !setStatus() || word->getStatus()) { @@ -257,7 +258,7 @@ bool TTconcept::checkWordId2() const { bool TTconcept::checkWordId3() const { return isWordClass(WC_ABSTRACT) || isWordClass(WC_ADJECTIVE) || - (isWordClass(WC_ADVERB) && getWordId() != 910); + (isWordClass(WC_ADVERB) && getTheWordId() != 910); } bool TTconcept::checkWordClass() const { @@ -300,16 +301,20 @@ TTconcept *TTconcept::findBy20(int val) { return nullptr; } -bool TTconcept::isWordId(int id) const { - if (this == nullptr) - return false; +bool TTconcept::isTheWordId(int id) const { return _wordP && _wordP->_id == id; } -int TTconcept::getWordId() const { - if (this == nullptr) - return 0; +int TTconcept::getTheWordId() const { return _wordP ? _wordP->_id : 0; } +bool isWordId(const TTconcept *concept, int id) { + return concept ? concept->isTheWordId(id) : 0; +} + +int getWordId(const TTconcept *concept) { + return concept ? concept->getTheWordId() : 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 430b3b6a8c..04da0cf49d 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -159,14 +159,18 @@ public: /** * Returns true if the concept has a word with a given Id */ - bool isWordId(int id) const; + bool isTheWordId(int id) const; /** * If a word is associated, return it's Id */ - int getWordId() const; + int getTheWordId() const; }; +extern bool isWordId(const TTconcept *concept, int id); + +extern int getWordId(const TTconcept *concept); + } // End of namespace Titanic #endif /* TITANIC_TT_CONCEPT_H */ diff --git a/engines/titanic/true_talk/tt_concept_node.h b/engines/titanic/true_talk/tt_concept_node.h index 967625397a..f9e271f3c2 100644 --- a/engines/titanic/true_talk/tt_concept_node.h +++ b/engines/titanic/true_talk/tt_concept_node.h @@ -64,10 +64,10 @@ public: bool createConcept(int mode, int conceptIndex, TTword *word); int concept1WordId() const { - return _concept1P ? _concept1P->getWordId() : 0; + return getWordId(_concept1P); } int concept5WordId() const { - return _concept5P ? _concept5P->getWordId() : 0; + return getWordId(_concept5P); } }; diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 99f2c78f3a..b0014b740d 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -801,7 +801,7 @@ int TTparser::considerRequests(TTword *word) { if (!_sentenceConcept->_concept0P) { flag = filterConcepts(5, 0); } else if (_sentenceConcept->_concept0P->compareTo("?") && - (_sentenceConcept->_concept1P && _sentenceConcept->_concept1P->isWordId(113)) && + (_sentenceConcept->_concept1P && isWordId(_sentenceConcept->_concept1P, 113)) && word->_wordClass == WC_THING) { TTconcept *oldConcept = _sentenceConcept->_concept0P; _sentenceConcept->_concept0P = nullptr; @@ -826,13 +826,13 @@ int TTparser::considerRequests(TTword *word) { if (flag) delete oldConcept; } else if (!_sentenceConcept->_concept3P && - (!_sentenceConcept->_concept1P || (_sentenceConcept->_concept1P->getWordId() != 113 && - _sentenceConcept->_concept1P->getWordId() != 112)) && + (!_sentenceConcept->_concept1P || (getWordId(_sentenceConcept->_concept1P) != 113 && + getWordId(_sentenceConcept->_concept1P) != 112)) && _sentenceConcept->_concept2P->checkWordId1() && (word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN)) { _sentenceConcept->changeConcept(0, &_sentenceConcept->_concept2P, 3); - if (_conceptP && _conceptP->isWordId(word->_id)) { + if (_conceptP && isWordId(_conceptP, word->_id)) { status = _sentenceConcept->replaceConcept(0, 2, _conceptP); removeConcept(_conceptP); } else { @@ -1478,11 +1478,11 @@ int TTparser::checkForAction() { } if (flag && _conceptP) { - if (actionFlag && (!_sentenceConcept->_concept1P || _sentenceConcept->_concept1P->isWordId(113))) { + if (actionFlag && (!_sentenceConcept->_concept1P || isWordId(_sentenceConcept->_concept1P, 113))) { _sentenceConcept->replaceConcept(0, 1, _conceptP); } else if (!_sentenceConcept->_concept5P) { _sentenceConcept->replaceConcept(1, 5, _conceptP); - } else if (_sentenceConcept->_concept5P->isWordId(904)) { + } else if (isWordId(_sentenceConcept->_concept5P, 904)) { _sentenceConcept->replaceConcept(0, 5, _conceptP); } diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 1bb30d33d6..7e4f608e01 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -251,10 +251,10 @@ bool TTsentence::fn4(int mode, int wordId, const TTconceptNode *node) const { switch (mode) { case 1: - return node->_concept1P && node->_concept1P->getWordId() == wordId; + return node->_concept1P && getWordId(node->_concept1P) == wordId; case 5: - return node->_concept5P && node->_concept5P->getWordId() == wordId; + return node->_concept5P && getWordId(node->_concept5P) == wordId; default: return false; |