From 99d50975cc0b261b2e2c000dc7e11dfde02a4f53 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Aug 2017 12:22:57 -0400 Subject: TITANIC: Fix to processing textual numbers in sentences --- engines/titanic/true_talk/tt_parser.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 4ed970533a..1a5c2b97a6 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -402,7 +402,7 @@ int TTparser::replaceNumbers(TTstring &line, int startIndex) { int total = 0, factor = 0; do { - if (numEntry->_flags & NF_1) { + if (!(numEntry->_flags & NF_1)) { flag2 = true; if (numEntry->_flags & NF_8) flag1 = true; @@ -437,8 +437,13 @@ int TTparser::replaceNumbers(TTstring &line, int startIndex) { total = -total; CString numStr = CString::format("%d", total); - line = CString(line.c_str(), line.c_str() + startIndex) + numStr + - CString(line.c_str() + index); + 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 = startIndex + numStr.size(); return index; } -- cgit v1.2.3