[Scummvm-cvs-logs] CVS: scummvm/gui gui.cpp,1.7,1.8

Jonathan Gray khalek at users.sourceforge.net
Sun Sep 15 02:08:01 CEST 2002


Update of /cvsroot/scummvm/scummvm/gui
In directory usw-pr-cvs1:/tmp/cvs-serv21437

Modified Files:
	gui.cpp 
Log Message:
apply patch #609508 real fix for MI2 Dialog Box crash, by CCCP at Endy's request

Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/gui.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gui.cpp	11 Sep 2002 13:28:32 -0000	1.7
+++ gui.cpp	15 Sep 2002 09:06:58 -0000	1.8
@@ -287,7 +287,6 @@
 	{0, 0, 0, 0, 0, 0, 0, 0, 0}
 };
 
-
 void Gui::draw(int start, int end)
 {
 	int i;
@@ -419,8 +418,15 @@
 				break;
 			case GUI_RESTEXT:
 				s = queryString(w->_string_number, w->_id);
-				if (s)
-					strcpy(text, s);
+				if (s) {
+					int t = resStrLen(s);
+					if (t >= 500) { // probably won't happen, but just in case...
+						warning("Resource string is too long, truncating");
+						t = 498;
+						text[499] = '\0';
+					}
+					memcpy(text, s, t+1);					
+				}
 				break;
 			case GUI_VARTEXT:
 				sprintf(text, "%s %d", string_map_table_custom[w->_string_number],
@@ -907,8 +913,6 @@
 
 const char *Gui::queryString(int stringno, int id)
 {
-	if ((stringno == 1) && (_s->_gameId == GID_MONKEY2)) return "How may I serve you?"; // FIXME (MI2 data file is wrong)
-
 	static char namebuf[64];
 	char *result;
 	int string;





More information about the Scummvm-git-logs mailing list