[Scummvm-cvs-logs] SF.net SVN: scummvm: [27271] scummvm/branches/branch-0-10-0/engines/agos/ script_s1.cpp

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Sun Jun 10 03:17:06 CEST 2007


Revision: 27271
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27271&view=rev
Author:   Kirben
Date:     2007-06-09 18:17:05 -0700 (Sat, 09 Jun 2007)

Log Message:
-----------
Fix crash via assert, when string for subtitles exists, but is only set to zero.

Modified Paths:
--------------
    scummvm/branches/branch-0-10-0/engines/agos/script_s1.cpp

Modified: scummvm/branches/branch-0-10-0/engines/agos/script_s1.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/engines/agos/script_s1.cpp	2007-06-10 01:16:29 UTC (rev 27270)
+++ scummvm/branches/branch-0-10-0/engines/agos/script_s1.cpp	2007-06-10 01:17:05 UTC (rev 27271)
@@ -374,12 +374,12 @@
 	uint vgaSpriteId = getVarOrByte();
 	uint color = getVarOrByte();
 	uint stringId = getNextStringID();
-	const byte *string_ptr = NULL;
+	const byte *stringPtr = NULL;
 	uint speechId = 0;
 	TextLocation *tl;
 
 	if (stringId != 0xFFFF)
-		string_ptr = getStringPtrByID(stringId);
+		stringPtr = getStringPtrByID(stringId);
 
 	if (getFeatures() & GF_TALKIE) {
 		if (getGameType() == GType_FF || getGameType() == GType_PP)
@@ -399,8 +399,8 @@
 		stopAnimateSimon2(2, vgaSpriteId + 2);
 	}
 
-	if (string_ptr != NULL && (speechId == 0 || _subtitles))
-		printScreenText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
+	if (stringPtr != NULL && stringPtr[0] != 0 && (speechId == 0 || _subtitles))
+		printScreenText(vgaSpriteId, color, (const char *)stringPtr, tl->x, tl->y, tl->width);
 
 }
 
@@ -450,7 +450,7 @@
 			}
 			stringPtr = buf;
 		}
-		if (stringPtr != NULL)
+		if (stringPtr != NULL && stringPtr[0] != 0)
 			printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width);
 	}
 }
@@ -512,7 +512,7 @@
 	uint speechId = 0;
 	TextLocation *tl;
 
-	const char *string_ptr = (const char *)getStringPtrByID(_longText[stringId]);
+	const char *stringPtr = (const char *)getStringPtrByID(_longText[stringId]);
 	if (getFeatures() & GF_TALKIE)
 		speechId = _longSound[stringId];
 
@@ -522,8 +522,8 @@
 
 	if (_speech && speechId != 0)
 		playSpeech(speechId, vgaSpriteId);
-	if (string_ptr != NULL && _subtitles)
-		printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
+	if (stringPtr != NULL && stringPtr[0] != 0 && _subtitles)
+		printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width);
 }
 
 void AGOSEngine_Simon1::os1_mouseOn() {


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