1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Revert "Return the music format finally retrieved by GetMusicLocation"

This reverts commit 7097c6708dc4e00d2aa86e95cea279cdfe20a432.
This commit is contained in:
Mathieu Schroeter 2018-01-31 23:57:49 +01:00
parent 6975b664b9
commit c6d109f87d
2 changed files with 7 additions and 14 deletions

View File

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

View File

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