diff options
author | strangerke | 2011-04-24 22:29:27 +0200 |
---|---|---|
committer | strangerke | 2011-04-24 22:29:27 +0200 |
commit | 4f708b021269c67da42177df8170a86d073c6e49 (patch) | |
tree | 088f4ea5df80138d294f8c94794e16bebee6d3d6 /engines/hugo | |
parent | 06ef66cd35b9185305cf2244108d51eff4859bff (diff) | |
download | scummvm-rg350-4f708b021269c67da42177df8170a86d073c6e49.tar.gz scummvm-rg350-4f708b021269c67da42177df8170a86d073c6e49.tar.bz2 scummvm-rg350-4f708b021269c67da42177df8170a86d073c6e49.zip |
HUGO: Hopefully fix the valgrind error reported by Digitall in bug #3292391
Diffstat (limited to 'engines/hugo')
-rw-r--r-- | engines/hugo/file.cpp | 4 | ||||
-rw-r--r-- | engines/hugo/hugo.cpp | 3 | ||||
-rw-r--r-- | engines/hugo/hugo.h | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index a0e3ff05ce..dcbc1569eb 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 ba87f58150..32247be2da 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 ed021f5cd6..0a8325f439 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; |