diff options
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 22 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 7b9f4c4c1c..013e5f1433 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -974,4 +974,26 @@ bool TTparser::checkConcept2(TTconcept *concept, int conceptMode) { return false; } +int TTparser::filterConcepts(int conceptMode, int conceptIndex) { + int result = 0; + + for (TTconcept *currP = _conceptP; currP && !result; currP = currP->_nextP) { + if (checkConcept2(currP, conceptMode)) { + TTconcept **ptrPP = _sentenceConcept->setConcept(conceptIndex, currP); + TTconcept *newConcept = new TTconcept(*currP); + *ptrPP = newConcept; + + if (newConcept->isValid()) { + removeConcept(currP); + (*ptrPP)->_nextP = nullptr; + result = 1; + } else { + result = -2; + } + } + } + + return result; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 512acbec89..d7e67b2d51 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -168,6 +168,7 @@ private: int fn2(TTword *word); bool fn3(TTconcept **v, int v2); bool checkConcept2(TTconcept *concept, int conceptMode); + int filterConcepts(int conceptMode, int conceptIndex); public: CScriptHandler *_owner; TTsentenceConcept *_sentenceConcept; |