diff options
author | Paul Gilbert | 2016-05-17 07:19:13 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:12:42 -0400 |
commit | a7c1b2fc6bb7d158f8a48664dd07b4d03f4dc1d5 (patch) | |
tree | 55ae72e8a367ca504a820b4ae9cfc434b1eec6a6 /engines/titanic | |
parent | 361ac2cfe4c6e778ad5eeafac94bbc6927aeaf1b (diff) | |
download | scummvm-rg350-a7c1b2fc6bb7d158f8a48664dd07b4d03f4dc1d5.tar.gz scummvm-rg350-a7c1b2fc6bb7d158f8a48664dd07b4d03f4dc1d5.tar.bz2 scummvm-rg350-a7c1b2fc6bb7d158f8a48664dd07b4d03f4dc1d5.zip |
TITANIC: Finished TTparser processInput
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
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; } |