From a7c1b2fc6bb7d158f8a48664dd07b4d03f4dc1d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 07:19:13 -0400 Subject: TITANIC: Finished TTparser processInput --- engines/titanic/true_talk/tt_parser.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'engines/titanic/true_talk') diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9787d1cd98..46eb50daa1 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -84,7 +84,24 @@ int TTparser::processInput(TTinput *input) { // Do a further search and replace of roman numerals to decimal searchAndReplace(input->_normalizedLine, _replacements3); - warning("TODO: TTparser::processInput"); + // Replace any roman numerals, spelled out words, etc. with decimal numbers + CTrueTalkManager::_v1 = -1000; + int idx = 0; + do { + idx = replaceNumbers(input->_normalizedLine, idx); + } while (idx >= 0); + + if (CTrueTalkManager::_v1 == -1000 && !input->_normalizedLine.empty()) { + // Scan the text for any numeric digits + for (const char *strP = input->_normalizedLine.c_str(); *strP; ++strP) { + if (Common::isDigit(*strP)) { + // Found digit, so convert it and any following ones + CTrueTalkManager::_v1 = atoi(strP); + break; + } + } + } + return 0; } -- cgit v1.2.3