aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/saveload.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2007-02-03 21:14:35 +0000
committerJohannes Schickel2007-02-03 21:14:35 +0000
commitc3f84d67b283a557b3d5b654d5b583e1e211f63f (patch)
treedaebdafd952f97e57fd8830dbd95c7a54815b999 /engines/kyra/saveload.cpp
parenta2976a350fc7346148838125d751f902f66b8ca1 (diff)
downloadscummvm-rg350-c3f84d67b283a557b3d5b654d5b583e1e211f63f.tar.gz
scummvm-rg350-c3f84d67b283a557b3d5b654d5b583e1e211f63f.tar.bz2
scummvm-rg350-c3f84d67b283a557b3d5b654d5b583e1e211f63f.zip
Workaround bad values for _curSfxFile in old savegames.
svn-id: r25359
Diffstat (limited to 'engines/kyra/saveload.cpp')
-rw-r--r--engines/kyra/saveload.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index c0482d1da0..8f095237ab 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -206,6 +206,14 @@ void KyraEngine::loadGame(const char *fileName) {
if (version >= 7) {
_curSfxFile = in->readByte();
+
+
+ // In the first version there this entry was introduced,
+ // it wasn't made sure that _curSfxFile was initialized
+ // so if it's out of bounds we just set it to 0.
+ if (_curSfxFile >= _soundFilesTownsCount || _curSfxFile < 0)
+ _curSfxFile = 0;
+
if (_flags.platform == Common::kPlatformFMTowns)
_sound->loadSoundFile(_curSfxFile);
}