[Scummvm-cvs-logs] CVS: scummvm/kyra font.cpp,1.2,1.3

Max Horn fingolfin at users.sourceforge.net
Sat Oct 30 11:04:00 CEST 2004


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26405

Modified Files:
	font.cpp 
Log Message:
Fix by salty-horse: "currently, it doesn't handle the last word in a sentence
properly. the width comes out garbage, and then it is sometimes moved to the
next line for no reason


Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/font.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- font.cpp	16 Oct 2004 22:28:29 -0000	1.2
+++ font.cpp	30 Oct 2004 18:02:48 -0000	1.3
@@ -84,8 +84,8 @@
 	uint32 Font::getStringWidth(const char* string, char terminator) {
 		uint32 strsize;
 		
-		for (strsize = 0; string[strsize] != terminator; ++strsize)
-						;
+		for (strsize = 0; string[strsize] != terminator && string[strsize] != '\0'; ++strsize)
+			;
 		
 		uint32 stringwidth = 0;
 		
@@ -113,11 +113,11 @@
 		
 		// gets start of the word
 		for (; string[startpos] == ' '; ++startpos)
-					;
+			;
 					
 		// not counting size
 		for (*size = 0; string[startpos + *size] != ' ' && string[startpos + *size] != '\0'; ++(*size))
-											;
+			;
 		
 		++(*size);
       				





More information about the Scummvm-git-logs mailing list