[Scummvm-cvs-logs] SF.net SVN: scummvm:[42897] scummvm/branches/gsoc2009-draci/engines/draci/ font.cpp

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Wed Jul 29 18:39:12 CEST 2009


Revision: 42897
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42897&view=rev
Author:   dkasak13
Date:     2009-07-29 16:39:12 +0000 (Wed, 29 Jul 2009)

Log Message:
-----------
Fixed text bugs related to the fact that some strings in the data files don't end with '|' like they should.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/font.cpp

Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-07-29 16:26:08 UTC (rev 42896)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-07-29 16:39:12 UTC (rev 42897)
@@ -266,17 +266,21 @@
 
 	for (unsigned int i = 0, tmp = 0; i < len; ++i) {
 
-		// Newline char encountered, skip it and store the new length if it is greater
-		if (str[i] == '|') {
+		if (str[i] != '|') {
+			uint8 charIndex = str[i] - kCharIndexOffset;
+			tmp += _charWidths[charIndex];
+			tmp += spacing;
+		}
+
+		// Newline char encountered, skip it and store the new length if it is greater.
+		// Also, all strings in the data files should end with '|' but not all do.
+		// This is why we check whether we are at the last char too.
+		if (str[i] == '|' || i == len - 1) {
 			if (tmp > width) {
 				width = tmp;
 			}
 			continue;
 		}
-
-		uint8 charIndex = str[i] - kCharIndexOffset;
-		tmp += _charWidths[charIndex];
-		tmp += spacing;
 	}
 
 	return width + 1;
@@ -298,7 +302,9 @@
 	int separators = 0;
 
 	for (unsigned int i = 0; i < len; ++i) {
-		if (str[i] == '|') {
+		// All strings in the data files should end with '|' but not all do.
+		// This is why we check whether we are at the last char too.
+		if (str[i] == '|' || i == len - 1) {
 			++separators;
 		}
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list