diff options
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/tt_concept.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept.h | 13 |
2 files changed, 31 insertions, 0 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 8f428391bf..6683c8e457 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -255,4 +255,22 @@ const TTstring TTconcept::getText() { return TTstring(); } +TTconcept *TTconcept::findByWordId(int id) { + for (TTconcept *conceptP = this; conceptP; conceptP = conceptP->_nextP) { + if (conceptP->_wordP && conceptP->_wordP->_id == id) + return conceptP; + } + + return nullptr; +} + +TTconcept *TTconcept::findByWordClass(WordClass wordClass) { + for (TTconcept *conceptP = this; conceptP; conceptP = conceptP->_nextP) { + if (conceptP->_wordP && conceptP->_wordP->_wordClass == wordClass) + return conceptP; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 4b908ca2b2..eefe113533 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -24,6 +24,7 @@ #define TITANIC_TT_CONCEPT_H #include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/tt_word.h" namespace Titanic { @@ -114,6 +115,8 @@ public: void setFlag(bool val) { _flag = val; } + void set1C(int val) { _field1C = val; } + bool checkWordId1() const; bool checkWordId2() const; bool checkWordClass() const; @@ -122,6 +125,16 @@ public: * Return text assocaited with the concept's word or script */ const TTstring getText(); + + /** + * Find a word by Id + */ + TTconcept *findByWordId(int id); + + /** + * Find a word by it's class + */ + TTconcept *findByWordClass(WordClass wordClass); }; } // End of namespace Titanic |