From 3ccd6704bdc4a6fad19d2fb68a75c089dc4f60ca Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Thu, 23 Oct 2003 04:49:04 +0000 Subject: Don't attempt to play sound in simon2mac if file doesn't exist. Add fixme for simon2mac, freeing voice at this point which causes crashes. svn-id: r10943 --- simon/sound.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'simon/sound.cpp') diff --git a/simon/sound.cpp b/simon/sound.cpp index b56d5a428f..04391b61d3 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -355,7 +355,7 @@ void SimonSound::readSfxFile(const char *filename, const Common::String &gameDat free(filename2); if (file->isOpen() == false) { if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30) - warning("readSfxFile: Can't load sfx file %s", filename); + warning("readSfxFile: Can't load sfx file %s", filename); return; } } @@ -390,7 +390,6 @@ void SimonSound::readVoiceFile(const char *filename, const Common::String &gameD file->open(filename2, gameDataPath); free(filename2); if (file->isOpen() == false) { - if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30) warning("readVoiceFile: Can't load voice file %s", filename); return; } @@ -409,11 +408,13 @@ void SimonSound::playVoice(uint sound) { File *file = new File(); file->open(filename, _gameDataPath); if (file->isOpen() == false) { - warning("Can't open voice file %s", filename); - } else { - delete _voice; - _voice = new WavSound(_mixer, file, _offsets); - } + warning("playVoice: Can't load voice file %s", filename); + return; + } + // FIXME freeing voice at this point causes frequent game crashes + // Maybe related to sound effects and speech using same sound format ? + // delete _voice; + _voice = new WavSound(_mixer, file, _offsets); } if (!_voice) -- cgit v1.2.3