aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/true_talk/tt_concept.cpp9
-rw-r--r--engines/titanic/true_talk/tt_concept.h5
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp11
-rw-r--r--engines/titanic/true_talk/tt_parser.h2
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();