From 76f82799df34f4e78f66f528e5f595b8bd09f71a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Aug 2017 14:17:42 -0400 Subject: TITANIC: Fix converting double digit words into numbers --- engines/titanic/true_talk/tt_parser.cpp | 9 ++++++--- 1 file 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(); -- cgit v1.2.3