[Scummvm-cvs-logs] CVS: scummvm/saga script.cpp,1.39,1.40

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun Jan 2 06:32:07 CET 2005


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

Modified Files:
	script.cpp 
Log Message:
The 'n_voices' field of the voice LUT was never assigned a value. So if
anyone heard any voices - I did, except under Valgrind - it was pure luck.


Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- script.cpp	1 Jan 2005 16:18:36 -0000	1.39
+++ script.cpp	2 Jan 2005 14:30:50 -0000	1.40
@@ -501,7 +501,6 @@
 VOICE_LUT *Script::loadVoiceLUT(const byte *voicelut_p, size_t voicelut_len, SCRIPTDATA *script) {
 	VOICE_LUT *voice_lut;
 
-	uint16 n_voices;
 	uint16 i;
 
 	voice_lut = (VOICE_LUT *)malloc(sizeof *voice_lut);
@@ -509,13 +508,13 @@
 		return NULL;
 	}
 
-	n_voices = voicelut_len / 2;
-	if (n_voices != script->strings->stringsCount) {
+	voice_lut->n_voices = voicelut_len / 2;
+	if (voice_lut->n_voices != script->strings->stringsCount) {
 		warning("Error: Voice LUT entries do not match dialogue entries");
 		return NULL;
 	}
 
-	voice_lut->voices = (int *)malloc(n_voices * sizeof *voice_lut->voices);
+	voice_lut->voices = (int *)malloc(voice_lut->n_voices * sizeof *voice_lut->voices);
 	if (voice_lut->voices == NULL) {
 
 		return NULL;
@@ -523,7 +522,7 @@
 
 	MemoryReadStreamEndian scriptS(voicelut_p, voicelut_len, IS_BIG_ENDIAN);
 
-	for (i = 0; i < n_voices; i++) {
+	for (i = 0; i < voice_lut->n_voices; i++) {
 		voice_lut->voices[i] = scriptS.readUint16();
 	}
 





More information about the Scummvm-git-logs mailing list