diff options
author | Paul Gilbert | 2016-05-22 11:26:01 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:14:20 -0400 |
commit | 1ffb8ff92b9f9d1be7a3f93ad5df859f086f3d94 (patch) | |
tree | a9347c158940d143d772ed81c2ce04e281d0da93 /engines | |
parent | bcfebf8f0fb8b1af29c4c80ad00c67e7707bf9ce (diff) | |
download | scummvm-rg350-1ffb8ff92b9f9d1be7a3f93ad5df859f086f3d94.tar.gz scummvm-rg350-1ffb8ff92b9f9d1be7a3f93ad5df859f086f3d94.tar.bz2 scummvm-rg350-1ffb8ff92b9f9d1be7a3f93ad5df859f086f3d94.zip |
TITANIC: Added TTconcept deleteSiblings
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/true_talk/tt_concept.cpp | 9 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept.h | 5 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 11 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.h | 2 |
4 files changed, 24 insertions, 3 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 2b67c9a66a..59d53a91ae 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -97,6 +97,15 @@ TTconcept::~TTconcept() { g_vm->_exeResources._owner->setParserConcept(this, nullptr); } +void TTconcept::deleteSiblings() { + for (TTconcept *currP = _nextP, *nextP; currP; currP = nextP) { + nextP = currP->_nextP; + delete currP; + } + + _nextP = nullptr; +} + bool TTconcept::setStatus() { if (_string1.isValid() && _string2.isValid()) { _status = SS_VALID; diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index d73fea7f8b..d28ac57575 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -82,6 +82,11 @@ public: ~TTconcept(); /** + * Destroys any attached sibling concepts to the given concept + */ + void deleteSiblings(); + + /** * Compares the name of the associated word, if any, * to the passed string */ diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 76c979a2a7..7c3737b949 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -31,8 +31,8 @@ namespace Titanic { TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceSub(nullptr), - _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0), - _nodesP(nullptr), _conceptP(nullptr) { + _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), + _currentWordP(nullptr), _nodesP(nullptr), _conceptP(nullptr) { loadArrays(); } @@ -41,6 +41,13 @@ TTparser::~TTparser() { _nodesP->deleteSiblings(); delete _nodesP; } + + if (_conceptP) { + _conceptP->deleteSiblings(); + delete _conceptP; + } + + delete _currentWordP; } void TTparser::loadArrays() { diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 84fa1aaa20..675bdd6345 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -162,7 +162,7 @@ public: int _fieldC; int _field10; int _field14; - int _field18; + TTword *_currentWordP; public: TTparser(CScriptHandler *owner); ~TTparser(); |