summaryrefslogtreecommitdiff
path: root/src/music_gui.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2018-03-17 14:51:30 +0100
committerMichael Lutz <michi@icosahedron.de>2018-06-05 22:58:35 +0200
commitf946b3da56b22c1fc32a9ffc9008374e4fb4f8c8 (patch)
tree3d8b2b0cf0e3931d2e38cce4b822f5b082d0cb92 /src/music_gui.cpp
parent1c2d29e1a3b5afdf3933f4cc743dda35c3ebb5fb (diff)
downloadopenttd-f946b3da56b22c1fc32a9ffc9008374e4fb4f8c8.tar.xz
Codechange: Pass a MusicSongInfo struct instead of bare filename to music drivers.
Preparation for later extending the info passed to music drivers.
Diffstat (limited to 'src/music_gui.cpp')
-rw-r--r--src/music_gui.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 25bb41314..4333e889c 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -42,7 +42,7 @@
*/
static const char *GetSongName(int index)
{
- return BaseMusic::GetUsedSet()->song_name[index];
+ return BaseMusic::GetUsedSet()->songinfo[index].songname;
}
/**
@@ -52,7 +52,7 @@ static const char *GetSongName(int index)
*/
static int GetTrackNumber(int index)
{
- return BaseMusic::GetUsedSet()->track_nr[index];
+ return BaseMusic::GetUsedSet()->songinfo[index].tracknr;
}
/** The currently played song */
@@ -186,10 +186,12 @@ static void MusicVolumeChanged(byte new_vol)
static void DoPlaySong()
{
char filename[MAX_PATH];
- if (FioFindFullPath(filename, lastof(filename), BASESET_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename) == NULL) {
- FioFindFullPath(filename, lastof(filename), OLD_GM_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename);
+ MusicSongInfo songinfo = BaseMusic::GetUsedSet()->songinfo[_music_wnd_cursong - 1]; // copy
+ if (FioFindFullPath(filename, lastof(filename), BASESET_DIR, songinfo.filename) == NULL) {
+ FioFindFullPath(filename, lastof(filename), OLD_GM_DIR, songinfo.filename);
}
- MusicDriver::GetInstance()->PlaySong(filename);
+ songinfo.filename = filename; // non-owned pointer
+ MusicDriver::GetInstance()->PlaySong(songinfo);
SetWindowDirty(WC_MUSIC_WINDOW, 0);
}