summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-02-23 15:51:26 +0000
committerrubidium <rubidium@openttd.org>2010-02-23 15:51:26 +0000
commitfa6ef9d45dae0bf0b85bc83c2ae9b4c0ffa296de (patch)
treeab6569a2266d0290075a8a13812f142b4ae84fc2 /src
parent63b01f2009be96797bc3a08c6391516604e00e86 (diff)
downloadopenttd-fa6ef9d45dae0bf0b85bc83c2ae9b4c0ffa296de.tar.xz
(svn r19219) -Fix: having OpenMSX's files in a subdirectory did not work as it should.
Diffstat (limited to 'src')
-rw-r--r--src/music.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/music.cpp b/src/music.cpp
index 7ba0f23e7..c4f15cc39 100644
--- a/src/music.cpp
+++ b/src/music.cpp
@@ -70,7 +70,19 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path)
continue;
}
- IniItem *item = names->GetItem(filename, false);
+ IniItem *item = NULL;
+ /* As we possibly add a path to the filename and we compare
+ * on the filename with the path as in the .obm, we need to
+ * keep stripping path elements until we find a match. */
+ for (const char *p = filename; p != NULL; p = strchr(p, PATHSEPCHAR)) {
+ /* Remove possible double path separator characters from
+ * the beginning, so we don't start reading e.g. root. */
+ while (*p == PATHSEPCHAR) p++;
+
+ item = names->GetItem(p, false);
+ if (item != NULL && !StrEmpty(item->value)) break;
+ }
+
if (item == NULL || StrEmpty(item->value)) {
DEBUG(grf, 0, "Base music set song name missing: %s", filename);
return false;