diff options
author | Paul Gilbert | 2017-08-12 14:17:42 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-08-12 14:17:42 -0400 |
commit | 76f82799df34f4e78f66f528e5f595b8bd09f71a (patch) | |
tree | 7613f8c331512ba6ebb12618ec807b45f018a75a /engines | |
parent | 19322752751ee5c14116b9693a7b66f409c410ef (diff) | |
download | scummvm-rg350-76f82799df34f4e78f66f528e5f595b8bd09f71a.tar.gz scummvm-rg350-76f82799df34f4e78f66f528e5f595b8bd09f71a.tar.bz2 scummvm-rg350-76f82799df34f4e78f66f528e5f595b8bd09f71a.zip |
TITANIC: Fix converting double digit words into numbers
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 1a5c2b97a6..8c8157370a 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -399,7 +399,7 @@ int TTparser::replaceNumbers(TTstring &line, int startIndex) { return index; bool flag1 = false, flag2 = false, flag3 = false; - int total = 0, factor = 0; + int total = 0, factor = 0, endIndex = index; do { if (!(numEntry->_flags & NF_1)) { @@ -421,8 +421,11 @@ int TTparser::replaceNumbers(TTstring &line, int startIndex) { factor += numEntry->_value; } } - } while (replaceNumbers2(line, &index)); + endIndex = index; + } while ((numEntry = replaceNumbers2(line, &index)) != nullptr); + + index = endIndex; if (!flag2) return index; @@ -440,7 +443,7 @@ int TTparser::replaceNumbers(TTstring &line, int startIndex) { line = CString::format("%s%s%s", CString(line.c_str(), line.c_str() + startIndex).c_str(), numStr.c_str(), - (index == -1) ? "" : line.c_str() + index + (index == -1) ? "" : line.c_str() + index - 1 ); index = startIndex + numStr.size(); |