mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r19206) -Add: concept of fallback base sets, i.e. do not automatically load the NoMusic/NoSound sets when there is another set
This commit is contained in:
parent
dd7c2b2f9d
commit
03e5434e63
|
@ -6,6 +6,7 @@
|
||||||
name = NoMusic
|
name = NoMusic
|
||||||
shortname = NOMU
|
shortname = NOMU
|
||||||
version = 0
|
version = 0
|
||||||
|
fallback = true
|
||||||
description = A music pack without actual music.
|
description = A music pack without actual music.
|
||||||
description.cs_CZ = Prázná hudební sada.
|
description.cs_CZ = Prázná hudební sada.
|
||||||
description.de_DE = Ein Musikset ohne Musik.
|
description.de_DE = Ein Musikset ohne Musik.
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct BaseSet {
|
||||||
TranslatedStrings description; ///< Description of the base set
|
TranslatedStrings description; ///< Description of the base set
|
||||||
uint32 shortname; ///< Four letter short variant of the name
|
uint32 shortname; ///< Four letter short variant of the name
|
||||||
uint32 version; ///< The version of this base set
|
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
|
MD5File files[NUM_FILES]; ///< All files part of this set
|
||||||
uint found_files; ///< Number of the files that could be found
|
uint found_files; ///< Number of the files that could be found
|
||||||
|
|
|
@ -58,6 +58,9 @@ bool BaseSet<T, Tnum_files, Tsubdir>::FillSetDetails(IniFile *ini, const char *p
|
||||||
fetch_metadata("version");
|
fetch_metadata("version");
|
||||||
this->version = atoi(item->value);
|
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. */
|
/* For each of the file types we want to find the file, MD5 checksums and warning messages. */
|
||||||
IniGroup *files = ini->GetGroup("files");
|
IniGroup *files = ini->GetGroup("files");
|
||||||
IniGroup *md5s = ini->GetGroup("md5s");
|
IniGroup *md5s = ini->GetGroup("md5s");
|
||||||
|
|
|
@ -296,6 +296,7 @@ template <class Tbase_set>
|
||||||
if (c->GetNumMissing() != 0) continue;
|
if (c->GetNumMissing() != 0) continue;
|
||||||
|
|
||||||
if (best == NULL ||
|
if (best == NULL ||
|
||||||
|
(best->fallback && !c->fallback) ||
|
||||||
best->valid_files < c->valid_files ||
|
best->valid_files < c->valid_files ||
|
||||||
(best->valid_files == c->valid_files && (
|
(best->valid_files == c->valid_files && (
|
||||||
(best->shortname == c->shortname && best->version < c->version) ||
|
(best->shortname == c->shortname && best->version < c->version) ||
|
||||||
|
|
|
@ -45,6 +45,7 @@ template <class Tbase_set>
|
||||||
if (c->GetNumMissing() != 0) continue;
|
if (c->GetNumMissing() != 0) continue;
|
||||||
|
|
||||||
if (best == NULL ||
|
if (best == NULL ||
|
||||||
|
(best->fallback && !c->fallback) ||
|
||||||
best->valid_files < c->valid_files ||
|
best->valid_files < c->valid_files ||
|
||||||
(best->valid_files == c->valid_files &&
|
(best->valid_files == c->valid_files &&
|
||||||
(best->shortname == c->shortname && best->version < c->version))) {
|
(best->shortname == c->shortname && best->version < c->version))) {
|
||||||
|
|
|
@ -301,6 +301,7 @@ template <class Tbase_set>
|
||||||
if (c->GetNumMissing() != 0) continue;
|
if (c->GetNumMissing() != 0) continue;
|
||||||
|
|
||||||
if (best == NULL ||
|
if (best == NULL ||
|
||||||
|
(best->fallback && !c->fallback) ||
|
||||||
best->valid_files < c->valid_files ||
|
best->valid_files < c->valid_files ||
|
||||||
(best->valid_files == c->valid_files &&
|
(best->valid_files == c->valid_files &&
|
||||||
(best->shortname == c->shortname && best->version < c->version))) {
|
(best->shortname == c->shortname && best->version < c->version))) {
|
||||||
|
|
Loading…
Reference in New Issue