[Scummvm-cvs-logs] SF.net SVN: scummvm: [29903] scummvm/trunk/engines/lure/surface.cpp

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Wed Dec 19 02:47:45 CET 2007


Revision: 29903
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29903&view=rev
Author:   dreammaster
Date:     2007-12-18 17:47:45 -0800 (Tue, 18 Dec 2007)

Log Message:
-----------
Bugfix for correctly handling \n characters in WordWrap method

Modified Paths:
--------------
    scummvm/trunk/engines/lure/surface.cpp

Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp	2007-12-18 22:30:25 UTC (rev 29902)
+++ scummvm/trunk/engines/lure/surface.cpp	2007-12-19 01:47:45 UTC (rev 29903)
@@ -352,13 +352,13 @@
 			(uint32)(wordStart - text), (uint32)((wordEnd == NULL) ? -1 : wordEnd - text), newLine ? 1 : 0);
 
 		if (wordEnd) {
-			if (!newLine) --wordEnd;
+			if (*wordEnd != '\0') --wordEnd;
 		} else {
 			wordEnd = strchr(wordStart, '\0') - 1;
 		}
 
 		int wordBytes = (int) (wordEnd - s + 1);
-		uint16 wordSize = textWidth(s, wordBytes);
+		uint16 wordSize = (wordBytes == 0) ? 0 : textWidth(s, wordBytes);
 		if (gDebugLevel >= ERROR_DETAILED) {
 			char wordBuffer[MAX_DESC_SIZE];
 			strncpy(wordBuffer, wordStart, wordBytes);
@@ -375,7 +375,7 @@
 		} else if (newLine) {
 			// Break on newline
 			++numLines;
-			*wordEnd = '\0';
+			*++wordEnd = '\0';
 			lineWidth = 0;
 		} else {
 			// Add word's length to total for line


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