[planetblupi] 02/13: Return the music format finally retrieved by GetMusicLocation
Didier Raboud
odyx at moszumanska.debian.org
Tue Feb 6 19:50:09 UTC 2018
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository planetblupi.
commit 7097c6708dc4e00d2aa86e95cea279cdfe20a432
Author: Mathieu Schroeter <mathieu at schroetersa.ch>
Date: Wed Jan 31 06:59:02 2018 +0100
Return the music format finally retrieved by GetMusicLocation
It means that it's possible that this function returns something
different of the restoreMusic settings. It's the case when the prefered
format is not available in the directories.
---
src/event.cxx | 19 +++++++++++++------
src/event.h | 2 +-
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/event.cxx b/src/event.cxx
index 9854f0c..e9fe135 100644
--- a/src/event.cxx
+++ b/src/event.cxx
@@ -3066,20 +3066,26 @@ CEvent::IsHelpHide ()
}
std::string
-CEvent::GetMusicLocation (Sint32 music)
+CEvent::GetMusicLocation (Sint32 music, std::string & format)
{
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)
{
- auto filename = string_format (
- "music/music%.3d.%s", music - 1, exts[g_restoreMidi ? 1 : 0].c_str ());
+ format = exts[g_restoreMidi ? 1 : 0];
+ auto filename =
+ string_format ("music/music%.3d.%s", music - 1, format.c_str ());
if (!FileExists (filename, absolute, locs[i]))
- filename = string_format (
- "music/music%.3d.%s", music - 1, exts[g_restoreMidi ? 0 : 1].c_str ());
+ {
+ format = exts[g_restoreMidi ? 0 : 1];
+ filename =
+ string_format ("music/music%.3d.%s", music - 1, format.c_str ());
+ }
if (FileExists (filename, absolute, locs[i]))
break;
@@ -3399,7 +3405,8 @@ CEvent::ChangePhase (Uint32 phase)
music = m_pDecor->GetMusic ();
if (music > 0)
{
- auto absolute = this->GetMusicLocation (music);
+ std::string format;
+ auto absolute = this->GetMusicLocation (music, format);
m_pSound->StopMusic ();
m_pSound->PlayMusic (absolute);
diff --git a/src/event.h b/src/event.h
index 73fe2d5..3ca7b03 100644
--- a/src/event.h
+++ b/src/event.h
@@ -100,7 +100,7 @@ public:
Sint32 GetPhysicalWorld ();
Sint32 GetImageWorld ();
bool IsHelpHide ();
- std::string GetMusicLocation (Sint32 music);
+ std::string GetMusicLocation (Sint32 music, std::string & format);
bool ChangePhase (Uint32 phase);
bool MovieToStart ();
Uint32 GetPhase ();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git
More information about the Pkg-games-commits
mailing list