[Scummvm-cvs-logs] SF.net SVN: scummvm: [29365] scummvm/trunk/engines/queen/journal.cpp

cyx at users.sourceforge.net cyx at users.sourceforge.net
Thu Nov 1 19:16:52 CET 2007


Revision: 29365
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29365&view=rev
Author:   cyx
Date:     2007-11-01 11:16:52 -0700 (Thu, 01 Nov 2007)

Log Message:
-----------
dont call trim(), which relies on isspace(), with specific game charset strings

Modified Paths:
--------------
    scummvm/trunk/engines/queen/journal.cpp

Modified: scummvm/trunk/engines/queen/journal.cpp
===================================================================
--- scummvm/trunk/engines/queen/journal.cpp	2007-11-01 18:16:02 UTC (rev 29364)
+++ scummvm/trunk/engines/queen/journal.cpp	2007-11-01 18:16:52 UTC (rev 29365)
@@ -383,9 +383,18 @@
 void Journal::drawPanelText(int y, const char *text) {
 	debug(7, "Journal::drawPanelText(%d, '%s')", y, text);
 	char s[80];
-	strcpy(s, text);
+	strncpy(s, text, 79);
+	s[79] = 0;
+	// remove leading and trailing spaces (necessary for spanish version)
+	for (char *p = s + strlen(s) - 1; p >= s && *p == ' '; --p) {
+		*p = 0;
+	}
+	for (char *p = s; *p == ' '; ++p) {
+		*p = 0;
+	}
+	// draw the substrings
 	char *p = strchr(s, ' ');
-	if (p == NULL) {
+	if (!p) {
 		int x = (128 - _vm->display()->textWidth(s)) / 2;
 		_vm->display()->setText(x, y, s, false);
 		assert(_panelTextCount < MAX_PANEL_TEXTS);
@@ -423,14 +432,7 @@
 	int y = 8;
 	while (n--) {
 		showBob(bobNum++, 32, y, *frames++);
-		// trim panel texts for spanish version
-		char buf[128];
-		strncpy(buf, _vm->logic()->joeResponse(*titles++), 128);
-		buf[127] = 0;
-		if (_vm->resource()->getLanguage() != Common::GR_GRE)
-			drawPanelText(y + 12, Common::trim(buf));
-		else
-			drawPanelText(y + 12, buf);	// don't trim panel text in Greek version
+		drawPanelText(y + 12, _vm->logic()->joeResponse(*titles++));
 		y += 48;
 	}
 }


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