Permalink
Browse files

Don't hang when Inn music failed to load. Fixes #956

  • Loading branch information...
Ghabry committed Jul 28, 2016
1 parent 3448f30 commit 877baa23857dfbfa955ed0229baa7c6a4e6dc7ab
Showing with 9 additions and 5 deletions.
  1. +3 −4 src/audio_sdl.cpp
  2. +6 −1 src/game_interpreter_map.cpp
View
@@ -246,15 +246,11 @@ void SdlAudio::BGM_OnPlayedOnce() {
}
void SdlAudio::BGM_Play(std::string const& file, int volume, int pitch, int fadein) {
bgm_stop = false;
played_once = false;
FILE* filehandle = FileFinder::fopenUTF8(file, "rb");
if (!filehandle) {
Output::Warning("Music not readable: %s", file.c_str());
return;
}
audio_decoder = AudioDecoder::Create(filehandle, file);
if (audio_decoder) {
SetupAudioDecoder(filehandle, file, volume, pitch, fadein);
@@ -264,6 +260,9 @@ void SdlAudio::BGM_Play(std::string const& file, int volume, int pitch, int fade
SDL_RWops *rw = SDL_RWFromFile(file.c_str(), "rb");
bgm_stop = false;
played_once = false;
#if SDL_MIXER_MAJOR_VERSION>1
bgm.reset(Mix_LoadMUS_RW(rw, 0), &Mix_FreeMusic);
#else
@@ -480,7 +480,12 @@ bool Game_Interpreter_Map::ContinuationShowInnFinish(RPG::EventCommand const& /*
return false;
const RPG::Music& bgm_inn = Game_System::GetSystemBGM(Game_System::BGM_Inn);
if (bgm_inn.name.empty() || bgm_inn.name == "(OFF)" || bgm_inn.name == "(Brak)" || Audio().BGM_PlayedOnce()) {
if (bgm_inn.name.empty() ||
bgm_inn.name == "(OFF)" ||
bgm_inn.name == "(Brak)" ||
!Audio().BGM_IsPlaying() ||
Audio().BGM_PlayedOnce()) {
Game_System::BgmStop();
continuation = NULL;
Graphics::Transition(Graphics::TransitionFadeIn, 36, false);

0 comments on commit 877baa2

Please sign in to comment.