diff options
-rw-r--r-- | engines/titanic/true_talk/tt_input.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_input.h | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 13 |
3 files changed, 16 insertions, 5 deletions
diff --git a/engines/titanic/true_talk/tt_input.cpp b/engines/titanic/true_talk/tt_input.cpp index 5d480425bd..102f86fc27 100644 --- a/engines/titanic/true_talk/tt_input.cpp +++ b/engines/titanic/true_talk/tt_input.cpp @@ -35,9 +35,9 @@ TTinputSubBase::TTinputSubBase() : _field0(0), _field4(0), _field8(0), TTinput::TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript) : _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), - _field38(0), _line(line), _field4C(0), _roomScript(roomScript), + _field38(0), _initialLine(line), _field4C(0), _roomScript(roomScript), _npcScript(npcScript), _field58(0), _field5C(0) { - _status = _line.isValid() && _string2.isValid() ? SS_11: SS_VALID; + _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; } void TTinput::set38(int val) { diff --git a/engines/titanic/true_talk/tt_input.h b/engines/titanic/true_talk/tt_input.h index e4d91d7a58..e378e9b3ab 100644 --- a/engines/titanic/true_talk/tt_input.h +++ b/engines/titanic/true_talk/tt_input.h @@ -59,7 +59,6 @@ private: int _inputCtr; int _field34; int _field38; - TTstring _string2; int _field4C; TTroomScript *_roomScript; TTnpcScript *_npcScript; @@ -67,7 +66,8 @@ private: int _field5C; int _status; public: - TTstring _line; + TTstring _initialLine; + TTstring _normalizedLine; public: TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 5aa3576a0f..343d0aa7d1 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -37,7 +37,7 @@ int TTparser::processInput(TTinput *input) { int TTparser::normalize(TTinput *input) { TTstring *destLine = new TTstring(); - const TTstring &srcLine = input->_line; + const TTstring &srcLine = input->_initialLine; int srcSize = srcLine.size(); int savedIndex = 0; int counter1 = 0; @@ -136,6 +136,17 @@ int TTparser::normalize(TTinput *input) { } } + if (counter1 >= 4) + input->set38(4); + + // Remove any trailing spaces + while (destLine->hasSuffix(" ")) + destLine->deleteLastChar(); + + // Copy out the normalized line + input->_normalizedLine = *destLine; + delete destLine; + return 0; } |