1
0
Fork 0

Compare commits

...

3 Commits

Author SHA1 Message Date
merni-ns e6792c78e1
Merge cf9c6fcc57 into 03672ed8eb 2025-07-18 11:02:57 +00:00
Jonathan G Rennison 03672ed8eb
Fix: EngineImageType mismatch between sizing and drawing in preview window (#14455) 2025-07-18 07:02:46 -04:00
merni-ns cf9c6fcc57 Fix #13307: Return non-zero value when there is a mistake in command-line arguments
Specifically, when the savegame passed to -q cannot be read or when non-existent/invalid options are passed
2025-02-13 23:26:22 +05:30
2 changed files with 6 additions and 6 deletions

View File

@ -84,7 +84,7 @@ struct EnginePreviewWindow : Window {
/* Get size of engine sprite, on loan from depot_gui.cpp */
EngineID engine = static_cast<EngineID>(this->window_number);
EngineImageType image_type = EIT_PURCHASE;
EngineImageType image_type = EIT_PREVIEW;
uint x, y;
int x_offs, y_offs;

View File

@ -625,6 +625,7 @@ int openttd_main(std::span<std::string_view> arguments)
InitializeLanguagePacks(); // A language pack is needed for GetString()
fmt::print(stderr, "{}\n", GetString(_load_check_data.error, _load_check_data.error_msg));
}
ret = 1;
return ret;
}
@ -646,14 +647,12 @@ int openttd_main(std::span<std::string_view> arguments)
case 'c': _config_file = mgo.opt; break;
case 'x': scanner->save_config = false; break;
case 'X': only_local_path = true; break;
case 'h':
i = -2; // Force printing of help.
break;
case 'h': break; // handled below
}
if (i == -2) break;
if (i == 'h' || i == -2) break;
}
if (i == -2 || !mgo.arguments.empty()) {
if (i == 'h' || i == -2 || !mgo.arguments.empty()) {
/* Either the user typed '-h', they made an error, or they added unrecognized command line arguments.
* In all cases, print the help, and exit.
*
@ -665,6 +664,7 @@ int openttd_main(std::span<std::string_view> arguments)
BaseSounds::FindSets();
BaseMusic::FindSets();
ShowHelp();
if (i != 'h') ret = 1;
return ret;
}