summaryrefslogtreecommitdiff
path: root/src/music/allegro_m.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2018-03-21 17:12:29 +0100
committerMichael Lutz <michi@icosahedron.de>2018-06-05 22:58:35 +0200
commita8080f14a9c75a1175976ee8d0cd17c677b55119 (patch)
treedc57362c439d6958f01c680f8f538da28fd3bf4e /src/music/allegro_m.cpp
parent458e441a4ca5d451941958e056189a059f2eee76 (diff)
downloadopenttd-a8080f14a9c75a1175976ee8d0cd17c677b55119.tar.xz
Change: DOS music loading for non-Windows music drivers
Diffstat (limited to 'src/music/allegro_m.cpp')
-rw-r--r--src/music/allegro_m.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/music/allegro_m.cpp b/src/music/allegro_m.cpp
index fee5bf8a0..906aec84f 100644
--- a/src/music/allegro_m.cpp
+++ b/src/music/allegro_m.cpp
@@ -14,6 +14,7 @@
#include "../stdafx.h"
#include "../debug.h"
#include "allegro_m.h"
+#include "midifile.hpp"
#include <allegro.h>
#include "../safeguards.h"
@@ -60,11 +61,15 @@ void MusicDriver_Allegro::Stop()
void MusicDriver_Allegro::PlaySong(const MusicSongInfo &song)
{
- if (song.filetype != MTT_STANDARDMIDI) return;
+ std::string filename = MidiFile::GetSMFFile(song);
if (_midi != NULL) destroy_midi(_midi);
- _midi = load_midi(song.filename);
- play_midi(_midi, false);
+ if (!filename.empty()) {
+ _midi = load_midi(filename.c_str());
+ play_midi(_midi, false);
+ } else {
+ _midi = NULL;
+ }
}
void MusicDriver_Allegro::StopSong()