[Scummvm-git-logs] scummvm master -> 76f82799df34f4e78f66f528e5f595b8bd09f71a

dreammaster dreammaster at scummvm.org
Sat Aug 12 20:17:48 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
76f82799df TITANIC: Fix converting double digit words into numbers


Commit: 76f82799df34f4e78f66f528e5f595b8bd09f71a
    https://github.com/scummvm/scummvm/commit/76f82799df34f4e78f66f528e5f595b8bd09f71a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-08-12T14:17:42-04:00

Commit Message:
TITANIC: Fix converting double digit words into numbers

Changed paths:
    engines/titanic/true_talk/tt_parser.cpp


diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 1a5c2b9..8c81573 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();





More information about the Scummvm-git-logs mailing list