summaryrefslogtreecommitdiff
path: root/src/music_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-17 15:48:57 +0000
committerrubidium <rubidium@openttd.org>2007-06-17 15:48:57 +0000
commit347c28b71ac754aee20f8eeeae1df1a3b9a49d10 (patch)
tree8bc2a050b44170ed785af66e6e9045d429c789db /src/music_gui.cpp
parent5fdde681c2aff0976eef8cea59422332527b3a65 (diff)
downloadopenttd-347c28b71ac754aee20f8eeeae1df1a3b9a49d10.tar.xz
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
-Codechange: add support for personal directories on Windows. -Fix [FS#153, FS#193, FS#502, FS#816, FS#854]: fix issues related to fixed names, fixed places of files/directories and application bundles.
Diffstat (limited to 'src/music_gui.cpp')
-rw-r--r--src/music_gui.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 8566a9aa2..0d932cb26 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -7,6 +7,7 @@
#include "table/strings.h"
#include "table/sprites.h"
#include "functions.h"
+#include "fileio.h"
#include "window.h"
#include "gfx.h"
#include "sound.h"
@@ -90,9 +91,9 @@ static void MusicVolumeChanged(byte new_vol)
static void DoPlaySong()
{
- char filename[256];
- snprintf(filename, sizeof(filename), "%s%s",
- _paths.gm_dir, origin_songs_specs[_music_wnd_cursong - 1].filename);
+ char filename[MAX_PATH];
+ FioFindFullPath(filename, lengthof(filename), GM_DIR,
+ origin_songs_specs[_music_wnd_cursong - 1].filename);
_music_driver->play_song(filename);
}
@@ -105,20 +106,14 @@ static void SelectSongToPlay()
{
uint i = 0;
uint j = 0;
- char filename[256];
memset(_cur_playlist, 0, sizeof(_cur_playlist));
do {
- if (_playlists[msf.playlist][i] != 0) { // Don't evaluate playlist terminator
- snprintf(filename, sizeof(filename), "%s%s",
- _paths.gm_dir, origin_songs_specs[(_playlists[msf.playlist][i]) - 1].filename);
-
- /* we are now checking for the existence of that file prior
- * to add it to the list of available songs */
- if (FileExists(filename)) {
- _cur_playlist[j] = _playlists[msf.playlist][i];
- j++;
- }
+ /* We are now checking for the existence of that file prior
+ * to add it to the list of available songs */
+ if (FioCheckFileExists(origin_songs_specs[_playlists[msf.playlist][i]].filename, GM_DIR)) {
+ _cur_playlist[j] = _playlists[msf.playlist][i];
+ j++;
}
} while (_playlists[msf.playlist][i++] != 0 && i < lengthof(_cur_playlist) - 1);