summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-02-22 16:24:23 +0000
committerrubidium <rubidium@openttd.org>2010-02-22 16:24:23 +0000
commit03e5434e63305fa66cbd6460f584c2dd99cdb128 (patch)
treedaa94b4c2147626dd1ab275f61ad1badd971a7fb
parentdd7c2b2f9db8b2ca2339d43fcf7b0f6da46e8c96 (diff)
downloadopenttd-03e5434e63305fa66cbd6460f584c2dd99cdb128.tar.xz
(svn r19206) -Add: concept of fallback base sets, i.e. do not automatically load the NoMusic/NoSound sets when there is another set
-rw-r--r--bin/gm/no_music.obm1
-rw-r--r--src/base_media_base.h1
-rw-r--r--src/base_media_func.h3
-rw-r--r--src/gfxinit.cpp1
-rw-r--r--src/music.cpp1
-rw-r--r--src/sound.cpp1
6 files changed, 8 insertions, 0 deletions
diff --git a/bin/gm/no_music.obm b/bin/gm/no_music.obm
index 9898a71c2..c0149dbfd 100644
--- a/bin/gm/no_music.obm
+++ b/bin/gm/no_music.obm
@@ -6,6 +6,7 @@
name = NoMusic
shortname = NOMU
version = 0
+fallback = true
description = A music pack without actual music.
description.cs_CZ = Prázná hudební sada.
description.de_DE = Ein Musikset ohne Musik.
diff --git a/src/base_media_base.h b/src/base_media_base.h
index 7567d1b81..5ff85f268 100644
--- a/src/base_media_base.h
+++ b/src/base_media_base.h
@@ -59,6 +59,7 @@ struct BaseSet {
TranslatedStrings description; ///< Description of the base set
uint32 shortname; ///< Four letter short variant of the name
uint32 version; ///< The version of this base set
+ bool fallback; ///< This set is a fallback set, i.e. it should be used only as last resort
MD5File files[NUM_FILES]; ///< All files part of this set
uint found_files; ///< Number of the files that could be found
diff --git a/src/base_media_func.h b/src/base_media_func.h
index 6a77501c4..ba0f75acd 100644
--- a/src/base_media_func.h
+++ b/src/base_media_func.h
@@ -58,6 +58,9 @@ bool BaseSet<T, Tnum_files, Tsubdir>::FillSetDetails(IniFile *ini, const char *p
fetch_metadata("version");
this->version = atoi(item->value);
+ item = metadata->GetItem("fallback", false);
+ this->fallback = (item != NULL && strcmp(item->value, "0") != 0 && strcmp(item->value, "false") != 0);
+
/* For each of the file types we want to find the file, MD5 checksums and warning messages. */
IniGroup *files = ini->GetGroup("files");
IniGroup *md5s = ini->GetGroup("md5s");
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index 999d24856..188b6c87b 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -296,6 +296,7 @@ template <class Tbase_set>
if (c->GetNumMissing() != 0) continue;
if (best == NULL ||
+ (best->fallback && !c->fallback) ||
best->valid_files < c->valid_files ||
(best->valid_files == c->valid_files && (
(best->shortname == c->shortname && best->version < c->version) ||
diff --git a/src/music.cpp b/src/music.cpp
index e902f4b80..7ba0f23e7 100644
--- a/src/music.cpp
+++ b/src/music.cpp
@@ -45,6 +45,7 @@ template <class Tbase_set>
if (c->GetNumMissing() != 0) continue;
if (best == NULL ||
+ (best->fallback && !c->fallback) ||
best->valid_files < c->valid_files ||
(best->valid_files == c->valid_files &&
(best->shortname == c->shortname && best->version < c->version))) {
diff --git a/src/sound.cpp b/src/sound.cpp
index a0f386297..cfdee243d 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -301,6 +301,7 @@ template <class Tbase_set>
if (c->GetNumMissing() != 0) continue;
if (best == NULL ||
+ (best->fallback && !c->fallback) ||
best->valid_files < c->valid_files ||
(best->valid_files == c->valid_files &&
(best->shortname == c->shortname && best->version < c->version))) {