mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #5789: No missing obj notification when loading from cmd line
This commit is contained in:
parent
3151b2b9da
commit
fe140c5c20
|
@ -287,7 +287,6 @@ namespace OpenRCT2
|
||||||
if (!parkLoaded)
|
if (!parkLoaded)
|
||||||
{
|
{
|
||||||
Console::Error::WriteLine("Failed to load '%s'", gOpenRCT2StartupActionPath);
|
Console::Error::WriteLine("Failed to load '%s'", gOpenRCT2StartupActionPath);
|
||||||
title_load();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1128,10 +1128,15 @@ bool game_load_save(const utf8 *path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_park_load_failure(const ParkLoadResult * result, const utf8 * path)
|
void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, const utf8 * path, bool loadTitleFirst)
|
||||||
{
|
{
|
||||||
if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_MISSING_OBJECTS)
|
if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_MISSING_OBJECTS)
|
||||||
{
|
{
|
||||||
|
// This option is used when loading parks from the command line
|
||||||
|
// to ensure that the title sequence loads before the window
|
||||||
|
if (loadTitleFirst) {
|
||||||
|
title_load();
|
||||||
|
}
|
||||||
// The path needs to be duplicated as it's a const here
|
// The path needs to be duplicated as it's a const here
|
||||||
// which the window function doesn't like
|
// which the window function doesn't like
|
||||||
window_object_load_error_open(strndup(path, strnlen(path, MAX_PATH)),
|
window_object_load_error_open(strndup(path, strnlen(path, MAX_PATH)),
|
||||||
|
@ -1144,6 +1149,11 @@ void handle_park_load_failure(const ParkLoadResult * result, const utf8 * path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_park_load_failure(const ParkLoadResult * result, const utf8 * path)
|
||||||
|
{
|
||||||
|
handle_park_load_failure_with_title_opt(result, path, false);
|
||||||
|
}
|
||||||
|
|
||||||
void game_load_init()
|
void game_load_init()
|
||||||
{
|
{
|
||||||
rct_window *mainWindow;
|
rct_window *mainWindow;
|
||||||
|
|
|
@ -179,6 +179,7 @@ bool game_is_paused();
|
||||||
bool game_is_not_paused();
|
bool game_is_not_paused();
|
||||||
void save_game();
|
void save_game();
|
||||||
void save_game_as();
|
void save_game_as();
|
||||||
|
void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, const utf8 * path, bool loadTitleFirst);
|
||||||
void handle_park_load_failure(const ParkLoadResult * result, const utf8 * path);
|
void handle_park_load_failure(const ParkLoadResult * result, const utf8 * path);
|
||||||
void rct2_exit();
|
void rct2_exit();
|
||||||
void rct2_exit_reason(rct_string_id title, rct_string_id body);
|
void rct2_exit_reason(rct_string_id title, rct_string_id body);
|
||||||
|
|
|
@ -334,10 +334,17 @@ bool rct2_open_file(const char *path)
|
||||||
extension++;
|
extension++;
|
||||||
|
|
||||||
if (_stricmp(extension, "sv6") == 0) {
|
if (_stricmp(extension, "sv6") == 0) {
|
||||||
if (game_load_save(path)) {
|
ParkLoadResult * result = game_load_sv6_path(path);
|
||||||
|
if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_OK) {
|
||||||
|
ParkLoadResult_Delete(result);
|
||||||
gFirstTimeSaving = false;
|
gFirstTimeSaving = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
handle_park_load_failure_with_title_opt(result, path, true);
|
||||||
|
ParkLoadResult_Delete(result);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if (_stricmp(extension, "sc6") == 0) {
|
} else if (_stricmp(extension, "sc6") == 0) {
|
||||||
// TODO scenario install
|
// TODO scenario install
|
||||||
ParkLoadResult * result = scenario_load_and_play_from_path(path);
|
ParkLoadResult * result = scenario_load_and_play_from_path(path);
|
||||||
|
@ -345,7 +352,7 @@ bool rct2_open_file(const char *path)
|
||||||
ParkLoadResult_Delete(result);
|
ParkLoadResult_Delete(result);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
handle_park_load_failure(result, path);
|
handle_park_load_failure_with_title_opt(result, path, true);
|
||||||
ParkLoadResult_Delete(result);
|
ParkLoadResult_Delete(result);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -353,15 +360,29 @@ bool rct2_open_file(const char *path)
|
||||||
// TODO track design install
|
// TODO track design install
|
||||||
return true;
|
return true;
|
||||||
} else if (_stricmp(extension, "sv4") == 0) {
|
} else if (_stricmp(extension, "sv4") == 0) {
|
||||||
if (rct1_load_saved_game(path)) {
|
ParkLoadResult * result = rct1_load_saved_game(path);
|
||||||
|
if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_OK) {
|
||||||
|
ParkLoadResult_Delete(result);
|
||||||
game_load_init();
|
game_load_init();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
handle_park_load_failure_with_title_opt(result, path, true);
|
||||||
|
ParkLoadResult_Delete(result);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if (_stricmp(extension, "sc4") == 0) {
|
} else if (_stricmp(extension, "sc4") == 0) {
|
||||||
if (rct1_load_scenario(path)) {
|
ParkLoadResult * result = rct1_load_scenario(path);
|
||||||
|
if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_OK) {
|
||||||
|
ParkLoadResult_Delete(result);
|
||||||
scenario_begin();
|
scenario_begin();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
handle_park_load_failure_with_title_opt(result, path, true);
|
||||||
|
ParkLoadResult_Delete(result);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue