diff options
author | Paul Gilbert | 2016-05-22 15:22:36 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:14:33 -0400 |
commit | 76c84afdfe5cf020f74d724d8cc3bcf67b6d754d (patch) | |
tree | 3aac920243cd75c54c1ec36deb0cfc56598dbf7e /engines | |
parent | c3055aeaf08601f8072de1c7d1922284bc3f933f (diff) | |
download | scummvm-rg350-76c84afdfe5cf020f74d724d8cc3bcf67b6d754d.tar.gz scummvm-rg350-76c84afdfe5cf020f74d724d8cc3bcf67b6d754d.tar.bz2 scummvm-rg350-76c84afdfe5cf020f74d724d8cc3bcf67b6d754d.zip |
TITANIC: Added TTconcept find methods
Diffstat (limited to 'engines')
-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 |