Codechange: use the shortname as unique id to identify the base graphics in openttd.cfg.

This commit is contained in:
frosch
2023-10-02 14:17:32 +02:00
committed by frosch
parent 97df27e41f
commit 0b7ecf6102
6 changed files with 62 additions and 16 deletions

View File

@@ -702,10 +702,13 @@ int openttd_main(int argc, char *argv[])
BaseGraphics::FindSets();
bool valid_graphics_set;
if (!graphics_set.empty()) {
valid_graphics_set = BaseGraphics::SetSet(graphics_set);
valid_graphics_set = BaseGraphics::SetSetByName(graphics_set);
} else if (BaseGraphics::ini_data.shortname != 0) {
graphics_set = BaseGraphics::ini_data.name;
valid_graphics_set = BaseGraphics::SetSetByShortname(BaseGraphics::ini_data.shortname);
} else if (!BaseGraphics::ini_data.name.empty()) {
graphics_set = BaseGraphics::ini_data.name;
valid_graphics_set = BaseGraphics::SetSet(BaseGraphics::ini_data.name);
valid_graphics_set = BaseGraphics::SetSetByName(BaseGraphics::ini_data.name);
} else {
valid_graphics_set = true;
BaseGraphics::SetSet(nullptr); // ignore error, continue to bootstrap GUI
@@ -769,7 +772,7 @@ int openttd_main(int argc, char *argv[])
BaseSounds::FindSets();
if (sounds_set.empty() && !BaseSounds::ini_set.empty()) sounds_set = BaseSounds::ini_set;
if (!BaseSounds::SetSet(sounds_set)) {
if (!BaseSounds::SetSetByName(sounds_set)) {
if (sounds_set.empty() || !BaseSounds::SetSet({})) {
UserError("Failed to find a sounds set. Please acquire a sounds set for OpenTTD. See section 1.4 of README.md.");
} else {
@@ -781,7 +784,7 @@ int openttd_main(int argc, char *argv[])
BaseMusic::FindSets();
if (music_set.empty() && !BaseMusic::ini_set.empty()) music_set = BaseMusic::ini_set;
if (!BaseMusic::SetSet(music_set)) {
if (!BaseMusic::SetSetByName(music_set)) {
if (music_set.empty() || !BaseMusic::SetSet({})) {
UserError("Failed to find a music set. Please acquire a music set for OpenTTD. See section 1.4 of README.md.");
} else {