summaryrefslogtreecommitdiff
path: root/src/music
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-04-28 21:06:51 +0000
committerrubidium <rubidium@openttd.org>2014-04-28 21:06:51 +0000
commitb476086c394c6bcf893f292ef67565ef2b5496a2 (patch)
tree7bbdfcc4597cae1378070d82c5da36c8668171e0 /src/music
parent3b634b628c8b8ce30cdd11d38a38cf2f455a1c73 (diff)
downloadopenttd-b476086c394c6bcf893f292ef67565ef2b5496a2.tar.xz
(svn r26538) -Codechange: remove double accounting of the drivers
Diffstat (limited to 'src/music')
-rw-r--r--src/music/extmidi.cpp4
-rw-r--r--src/music/music_driver.hpp8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp
index 919f689e0..7b9e649c0 100644
--- a/src/music/extmidi.cpp
+++ b/src/music/extmidi.cpp
@@ -37,8 +37,8 @@ static FMusicDriver_ExtMidi iFMusicDriver_ExtMidi;
const char *MusicDriver_ExtMidi::Start(const char * const * parm)
{
- if (strcmp(_video_driver->GetName(), "allegro") == 0 ||
- strcmp(_sound_driver->GetName(), "allegro") == 0) {
+ if (strcmp(VideoDriver::GetInstance()->GetName(), "allegro") == 0 ||
+ strcmp(SoundDriver::GetInstance()->GetName(), "allegro") == 0) {
return "the extmidi driver does not work when Allegro is loaded.";
}
diff --git a/src/music/music_driver.hpp b/src/music/music_driver.hpp
index 03c70d569..be09d3ea2 100644
--- a/src/music/music_driver.hpp
+++ b/src/music/music_driver.hpp
@@ -39,9 +39,15 @@ public:
* @param vol The new volume.
*/
virtual void SetVolume(byte vol) = 0;
+
+ /**
+ * Get the currently active instance of the music driver.
+ */
+ static MusicDriver *GetInstance() {
+ return static_cast<MusicDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_MUSIC));
+ }
};
-extern MusicDriver *_music_driver;
extern char *_ini_musicdriver;
#endif /* MUSIC_MUSIC_DRIVER_HPP */