mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move handle_park_load_failure into game.c
This commit is contained in:
parent
c3356d457e
commit
d75295b027
|
@ -1126,6 +1126,22 @@ bool game_load_save(const utf8 *path)
|
|||
}
|
||||
}
|
||||
|
||||
void handle_park_load_failure(park_load_result* result, const utf8* path)
|
||||
{
|
||||
if (result->error == PARK_LOAD_ERROR_BAD_OBJECTS)
|
||||
{
|
||||
// The path needs to be duplicated as it's a const here
|
||||
// which the window function doesn't like
|
||||
window_object_load_error_open(strndup(path, strnlen(path, MAX_PATH)), result->object_validity);
|
||||
}
|
||||
else if (result->error != PARK_LOAD_ERROR_NONE) {
|
||||
// If loading the SV6 or SV4 failed for a reason other than invalid objects
|
||||
// the current park state will be corrupted so just go back to the title screen.
|
||||
title_load();
|
||||
}
|
||||
SafeFree(result);
|
||||
}
|
||||
|
||||
void game_load_init()
|
||||
{
|
||||
rct_window *mainWindow;
|
||||
|
|
|
@ -180,6 +180,7 @@ bool game_is_paused();
|
|||
bool game_is_not_paused();
|
||||
void save_game();
|
||||
void save_game_as();
|
||||
void handle_park_load_failure(park_load_result* result, const utf8* path);
|
||||
void rct2_exit();
|
||||
void rct2_exit_reason(rct_string_id title, rct_string_id body);
|
||||
void game_autosave();
|
||||
|
|
|
@ -549,19 +549,3 @@ size_t strcatftime(char * buffer, size_t bufferSize, const char * format, const
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handle_park_load_failure(park_load_result* result, const utf8* path)
|
||||
{
|
||||
if (result->error == PARK_LOAD_ERROR_BAD_OBJECTS)
|
||||
{
|
||||
// The path needs to be duplicated as it's a const here
|
||||
// which the window function doesn't like
|
||||
window_object_load_error_open(strndup(path, strnlen(path, MAX_PATH)), result->object_validity);
|
||||
}
|
||||
else if (result->error != PARK_LOAD_ERROR_NONE) {
|
||||
// If loading the SV6 or SV4 failed for a reason other than invalid objects
|
||||
// the current park state will be corrupted so just go back to the title screen.
|
||||
title_load();
|
||||
}
|
||||
SafeFree(result);
|
||||
}
|
|
@ -66,5 +66,4 @@ money32 add_clamp_money32(money32 value, money32 value_to_add);
|
|||
|
||||
size_t strcatftime(char * buffer, size_t bufferSize, const char * format, const struct tm * tp);
|
||||
|
||||
void handle_park_load_failure(park_load_result* result, const utf8* path);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue