From 1fff06e97a2d29aa94c4a5a4ee3c08f310ece0d3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 May 2016 06:50:52 -0400 Subject: TITANIC: Added TTparser processRequests --- engines/titanic/true_talk/tt_parser.cpp | 40 +++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 498c0cc015..5a94196552 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -888,8 +888,44 @@ int TTparser::considerRequests(TTword *word) { } int TTparser::processRequests(TTword *word) { - // TODO - return 0; + int status = loadRequests(word); + switch (status) { + case 0: + status = considerRequests(word); + + // Iterate through the words + while (_currentWordP) { + considerRequests(_currentWordP); + TTword *nextP = _currentWordP->_nextP; + + delete _currentWordP; + _currentWordP = nextP; + } + break; + + case 1: { + TTword *newWord = new TTword(word); + newWord->_nextP = nullptr; + + // Add word to word chain + if (_currentWordP) { + // Add at end of existing chain + for (word = _currentWordP; word->_nextP; word = word->_nextP) + ; + word->_nextP = newWord; + } else { + // First word, so set as head + _currentWordP = newWord; + } + break; + } + + default: + warning("unexpected return from consider requests"); + break; + } + + return status; } void TTparser::addToConceptList(TTword *word) { -- cgit v1.2.3