From 15843eb4c23c3d8ac88edd9b482fae09d4414582 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 16:03:39 -0400 Subject: TITANIC: Remainder of TTparser considerRequests --- engines/titanic/true_talk/tt_parser.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'engines') 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(nodeP->_nextP); + if (flag) + delete nodeP; + nodeP = nextP; } - // TODO delete concept; return status; } -- cgit v1.2.3