This is an automated email from the git hooks/post-receive script. odyx pushed a commit to annotated tag debian/1.12.1-22-g13a7e27-3 in repository planetblupi.
commit c2db10c29276a6bdab67c64cc290a6347b35a9b5 Author: Mathieu Schroeter <math...@schroetersa.ch> Date: Wed Jan 31 06:50:56 2018 +0100 Move the code to retrieve the music in a dedicated method --- src/event.cxx | 46 ++++++++++++++++++++++++++-------------------- src/event.h | 21 +++++++++++---------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/event.cxx b/src/event.cxx index 31429a9..9854f0c 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -3065,6 +3065,31 @@ CEvent::IsHelpHide () return bHide; } +std::string +CEvent::GetMusicLocation (Sint32 music) +{ + static const std::string exts[] = {"ogg", "mid"}; + static const Location locs[] = {LOCATION_USER, LOCATION_BASE}; + std::string absolute; + + // 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 ()); + if (!FileExists (filename, absolute, locs[i])) + filename = string_format ( + "music/music%.3d.%s", music - 1, exts[g_restoreMidi ? 0 : 1].c_str ()); + + if (FileExists (filename, absolute, locs[i])) + break; + + absolute = ""; + } + + return absolute; +} + /** * \brief Change the phase. * @@ -3374,26 +3399,7 @@ CEvent::ChangePhase (Uint32 phase) music = m_pDecor->GetMusic (); if (music > 0) { - static const std::string exts[] = {"ogg", "mid"}; - static const Location locs[] = {LOCATION_USER, LOCATION_BASE}; - std::string absolute; - - // Look for music in the user directory, then in the game directory. - for (size_t i = 0; i < countof (locs); ++i) - { - filename = string_format ( - "music/music%.3d.%s", music - 1, - exts[g_restoreMidi ? 1 : 0].c_str ()); - if (!FileExists (filename, absolute, locs[i])) - filename = string_format ( - "music/music%.3d.%s", music - 1, - exts[g_restoreMidi ? 0 : 1].c_str ()); - - if (FileExists (filename, absolute, locs[i])) - break; - - absolute = ""; - } + auto absolute = this->GetMusicLocation (music); m_pSound->StopMusic (); m_pSound->PlayMusic (absolute); diff --git a/src/event.h b/src/event.h index 4f16e91..73fe2d5 100644 --- a/src/event.h +++ b/src/event.h @@ -94,16 +94,17 @@ public: Point GetMousePos (); void - Create (CPixmap * pPixmap, CDecor * pDecor, CSound * pSound, CMovie * pMovie); - void SetFullScreen (bool bFullScreen); - Sint32 GetWorld (); - Sint32 GetPhysicalWorld (); - Sint32 GetImageWorld (); - bool IsHelpHide (); - bool ChangePhase (Uint32 phase); - bool MovieToStart (); - Uint32 GetPhase (); - void TryInsert (); + Create (CPixmap * pPixmap, CDecor * pDecor, CSound * pSound, CMovie * pMovie); + void SetFullScreen (bool bFullScreen); + Sint32 GetWorld (); + Sint32 GetPhysicalWorld (); + Sint32 GetImageWorld (); + bool IsHelpHide (); + std::string GetMusicLocation (Sint32 music); + bool ChangePhase (Uint32 phase); + bool MovieToStart (); + Uint32 GetPhase (); + void TryInsert (); Sint32 GetButtonIndex (Sint32 button); Sint32 GetState (Sint32 button); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits