From bcfebf8f0fb8b1af29c4c80ad00c67e7707bf9ce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 11:10:00 -0400 Subject: TITANIC: Added TTconcept destructor --- engines/titanic/true_talk/script_handler.cpp | 2 ++ engines/titanic/true_talk/tt_concept.cpp | 36 ++++++++++++++++++++-------- engines/titanic/true_talk/tt_concept.h | 7 +++--- 3 files changed, 32 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 470a1fc807..bfd7cdfdfc 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -71,6 +71,8 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp _concept2P = nullptr; _concept3P = nullptr; _concept4P = nullptr; + + return result; } int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScript, diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index cab67c9621..2b67c9a66a 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -27,7 +27,12 @@ namespace Titanic { -TTconcept::TTconcept() { +TTconcept::TTconcept() : _string1(" "), _string2(" "), + _scriptP(nullptr), _wordP(nullptr) { + if (setStatus()) + setScriptType(ST_UNKNOWN_SCRIPT); + else + reset(); } TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : @@ -81,6 +86,17 @@ TTconcept::TTconcept(TTconcept &src) : reset(); } +TTconcept::~TTconcept() { + if (_word2P) { + _word2P->deleteSiblings(); + delete _word2P; + } + delete _wordP; + + if (_flag) + g_vm->_exeResources._owner->setParserConcept(this, nullptr); +} + bool TTconcept::setStatus() { if (_string1.isValid() && _string2.isValid()) { _status = SS_VALID; @@ -97,10 +113,10 @@ void TTconcept::setScriptType(ScriptType scriptType) { _scriptType = scriptType; _field1C = -1; _field20 = 0; - _word2 = nullptr; + _word2P = nullptr; _field30 = 0; _field34 = 0; - _field38 = 0; + _flag = false; _status = 0; } @@ -132,21 +148,21 @@ void TTconcept::copyFrom(TTconcept &src) { _field1C = src._field1C; _field20 = src._field20; - if (src._word2) { - _word2 = src._word2->copyWords(); - if (src._word2->getChainStatus()) + if (src._word2P) { + _word2P = src._word2P->copyWords(); + if (src._word2P->getChainStatus()) _status = 11; } else { - _word2 = nullptr; + _word2P = nullptr; } _field30 = src._field30; _field34 = src._field34; - if (src._field38 == 1) { + if (src._flag) { g_vm->_exeResources._owner->setParserConcept(this, &src); - src.set38(1); - _field38 = 1; + src.setFlag(true); + _flag = true; } _status = src._status; diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index ba48e70369..d73fea7f8b 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -42,10 +42,10 @@ private: int _field1C; int _field20; TTstring _string2; - TTword *_word2; + TTword *_word2P; int _field30; int _field34; - int _field38; + bool _flag; int _status; private: /** @@ -79,6 +79,7 @@ public: TTconcept(TTscriptBase *script, ScriptType scriptType); TTconcept(TTword *word, ScriptType scriptType); TTconcept(TTconcept &src); + ~TTconcept(); /** * Compares the name of the associated word, if any, @@ -91,7 +92,7 @@ public: */ int getStatus() const { return _status; } - void set38(int val) { _field38 = val; } + void setFlag(bool val) { _flag = val; } }; } // End of namespace Titanic -- cgit v1.2.3