Workaround bad values for _curSfxFile in old savegames.

svn-id: r25359
This commit is contained in:
Johannes Schickel 2007-02-03 21:14:35 +00:00
parent a2976a350f
commit c3f84d67b2
2 changed files with 10 additions and 0 deletions

View file

@ -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);
}