From c6d109f87d5ea61f5c9adfe4f3337143552448f8 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Wed, 31 Jan 2018 23:57:49 +0100 Subject: [PATCH] Revert "Return the music format finally retrieved by GetMusicLocation" This reverts commit 7097c6708dc4e00d2aa86e95cea279cdfe20a432. --- src/event.cxx | 19 ++++++------------- src/event.h | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/event.cxx b/src/event.cxx index 9b43a4a..ad7876b 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -3079,26 +3079,20 @@ CEvent::IsBaseMusicAvailable (Sint32 music, const std::string & format) } std::string -CEvent::GetMusicLocation (Sint32 music, std::string & format) +CEvent::GetMusicLocation (Sint32 music) { static const std::string exts[] = {"ogg", "mid"}; static const Location locs[] = {LOCATION_USER, LOCATION_BASE}; std::string absolute; - format = ""; - // Look for music in the user directory, then in the game directory. for (size_t i = 0; i < countof (locs); ++i) { - format = exts[g_restoreMidi ? 1 : 0]; - auto filename = - string_format ("music/music%.3d.%s", music - 1, format.c_str ()); + auto filename = string_format ( + "music/music%.3d.%s", music - 1, exts[g_restoreMidi ? 1 : 0].c_str ()); if (!FileExists (filename, absolute, locs[i])) - { - format = exts[g_restoreMidi ? 0 : 1]; - filename = - string_format ("music/music%.3d.%s", music - 1, format.c_str ()); - } + filename = string_format ( + "music/music%.3d.%s", music - 1, exts[g_restoreMidi ? 0 : 1].c_str ()); if (FileExists (filename, absolute, locs[i])) break; @@ -3418,8 +3412,7 @@ CEvent::ChangePhase (Uint32 phase) music = m_pDecor->GetMusic (); if (music > 0) { - std::string format; - auto absolute = this->GetMusicLocation (music, format); + auto absolute = this->GetMusicLocation (music); m_pSound->StopMusic (); m_pSound->PlayMusic (absolute); diff --git a/src/event.h b/src/event.h index 9f5fac0..d31a532 100644 --- a/src/event.h +++ b/src/event.h @@ -101,7 +101,7 @@ public: Sint32 GetImageWorld (); bool IsHelpHide (); bool IsBaseMusicAvailable (Sint32 music, const std::string & format); - std::string GetMusicLocation (Sint32 music, std::string & format); + std::string GetMusicLocation (Sint32 music); bool ChangePhase (Uint32 phase); bool MovieToStart (); Uint32 GetPhase ();