aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk/tt_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/true_talk/tt_parser.cpp')
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 91bc82db70..3014ebaa07 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -725,17 +725,16 @@ int TTparser::loadRequests(TTword *word) {
}
int TTparser::considerRequests(TTword *word) {
- if (_nodesP)
+ if (!_nodesP || !word)
return 0;
-
- TTparserNode *nodeP = _nodesP;
+
TTconcept *concept = nullptr;
int status = 0;
bool flag = false;
bool modifierFlag = false;
int seekVal = 0;
- while (word) {
+ for (TTparserNode *nodeP = _nodesP; nodeP; ) {
switch (nodeP->_tag) {
case CHECK_COMMAND_FORM:
if (_sentenceConcept->_concept1P && _sentence->_field2C == 1 &&
@@ -1274,9 +1273,13 @@ int TTparser::considerRequests(TTword *word) {
flag = true;
break;
}
+
+ TTparserNode *nextP = static_cast<TTparserNode *>(nodeP->_nextP);
+ if (flag)
+ delete nodeP;
+ nodeP = nextP;
}
- // TODO
delete concept;
return status;
}