Codechange: Store base graphics settings in a separate section in openttd.cfg.

This commit is contained in:
frosch
2023-10-02 13:29:32 +02:00
committed by frosch
parent 2d3fef3113
commit 97df27e41f
6 changed files with 76 additions and 41 deletions

View File

@@ -700,15 +700,22 @@ int openttd_main(int argc, char *argv[])
InitWindowSystem();
BaseGraphics::FindSets();
if (graphics_set.empty() && !BaseGraphics::ini_set.empty()) graphics_set = BaseGraphics::ini_set;
if (!BaseGraphics::SetSet(graphics_set)) {
if (!graphics_set.empty()) {
BaseGraphics::SetSet({});
bool valid_graphics_set;
if (!graphics_set.empty()) {
valid_graphics_set = BaseGraphics::SetSet(graphics_set);
} else if (!BaseGraphics::ini_data.name.empty()) {
graphics_set = BaseGraphics::ini_data.name;
valid_graphics_set = BaseGraphics::SetSet(BaseGraphics::ini_data.name);
} else {
valid_graphics_set = true;
BaseGraphics::SetSet(nullptr); // ignore error, continue to bootstrap GUI
}
if (!valid_graphics_set) {
BaseGraphics::SetSet(nullptr);
ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND);
msg.SetDParamStr(0, graphics_set);
ScheduleErrorMessage(msg);
}
ErrorMessageData msg(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND);
msg.SetDParamStr(0, graphics_set);
ScheduleErrorMessage(msg);
}
/* Initialize game palette */