[Scummvm-cvs-logs] scummvm master -> 4f708b021269c67da42177df8170a86d073c6e49

Strangerke arnaud.boutonne at gmail.com
Sun Apr 24 22:30:12 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4f708b0212 HUGO: Hopefully fix the valgrind error reported by Digitall in bug #3292391


Commit: 4f708b021269c67da42177df8170a86d073c6e49
    https://github.com/scummvm/scummvm/commit/4f708b021269c67da42177df8170a86d073c6e49
Author: strangerke (arnaud.boutonne at gmail.com)
Date: 2011-04-24T13:29:27-07:00

Commit Message:
HUGO: Hopefully fix the valgrind error reported by Digitall in bug #3292391

Changed paths:
    engines/hugo/file.cpp
    engines/hugo/hugo.cpp
    engines/hugo/hugo.h



diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index a0e3ff0..dcbc156 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -400,7 +400,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
 	out->writeByte((gameStatus.gameOverFl) ? 1 : 0);
 
 	// Save screen states
-	for (int i = 0; i < _vm->_numScreens; i++)
+	for (int i = 0; i < _vm->_numStates; i++)
 		out->writeByte(_vm->_screenStates[i]);
 
 	_vm->_scheduler->saveSchedulerData(out);
@@ -497,7 +497,7 @@ bool FileManager::restoreGame(const int16 slot) {
 	gameStatus.storyModeFl = (in->readByte() == 1);
 	_vm->_mouse->setJumpExitFl(in->readByte() == 1);
 	gameStatus.gameOverFl = (in->readByte() == 1);
-	for (int i = 0; i < _vm->_numScreens; i++)
+	for (int i = 0; i < _vm->_numStates; i++)
 		_vm->_screenStates[i] = in->readByte();
 
 	_vm->_scheduler->restoreSchedulerData(in);
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index ba87f58..32247be 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -53,7 +53,7 @@ HugoEngine *HugoEngine::s_Engine = 0;
 
 HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(syst), _gameDescription(gd),
 	_hero(0), _heroImage(0), _defltTunes(0), _numScreens(0), _tunesNbr(0), _soundSilence(0), _soundTest(0),
-	_screenStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(0)
+	_screenStates(0), _numStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(0)
 {
 	_system = syst;
 	DebugMan.addDebugChannel(kDebugSchedule, "Schedule", "Script Schedule debug level");
@@ -463,6 +463,7 @@ bool HugoEngine::loadHugoDat() {
 	for (int varnt = 0; varnt < _numVariant; varnt++) {
 		numElem = in.readUint16BE();
 		if (varnt == _gameVariant) {
+			_numStates = numElem;
 			_screenStates = (byte *)malloc(sizeof(byte) * numElem);
 			memset(_screenStates, 0, sizeof(_screenStates));
 		}
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index ed021f5..0a8325f 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -238,6 +238,7 @@ public:
 	int8   _soundTest;
 	int8   _tunesNbr;
 	uint16 _numScreens;
+	uint16 _numStates;
 	int8   _normalTPS;                              // Number of ticks (frames) per second.
 	                                                // 8 for Win versions, 9 for DOS versions
 	object_t *_hero;






More information about the Scummvm-git-logs mailing list