mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove game_load_sv6 that uses RWops
This commit is contained in:
parent
1867ac2148
commit
fb7f0a21d2
|
@ -844,27 +844,16 @@ bool game_load_save(const utf8 *path)
|
|||
|
||||
safe_strcpy(gScenarioSavePath, path, MAX_PATH);
|
||||
|
||||
SDL_RWops* rw = SDL_RWFromFile(path, "rb");
|
||||
if (rw == NULL) {
|
||||
log_error("unable to open %s", path);
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gGameCommandErrorTitle = STR_FILE_CONTAINS_INVALID_DATA;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 extension_type = get_file_extension_type(path);
|
||||
bool result = false;
|
||||
|
||||
if (extension_type == FILE_EXTENSION_SV6) {
|
||||
result = game_load_sv6(rw);
|
||||
result = game_load_sv6_path(path);
|
||||
} else if (extension_type == FILE_EXTENSION_SV4) {
|
||||
result = rct1_load_saved_game(path);
|
||||
if (result)
|
||||
gFirstTimeSave = 1;
|
||||
}
|
||||
|
||||
SDL_RWclose(rw);
|
||||
|
||||
if (result) {
|
||||
if (network_get_mode() == NETWORK_MODE_CLIENT) {
|
||||
network_close();
|
||||
|
|
|
@ -167,7 +167,6 @@ sint32 game_do_command_p(sint32 command, sint32 *eax, sint32 *ebx, sint32 *ecx,
|
|||
|
||||
void game_load_or_quit_no_save_prompt();
|
||||
bool game_load_sv6_path(const char * path);
|
||||
bool game_load_sv6(SDL_RWops* rw);
|
||||
bool game_load_save(const utf8 *path);
|
||||
void game_load_init();
|
||||
void game_pause_toggle(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp);
|
||||
|
|
|
@ -408,49 +408,6 @@ IParkImporter * ParkImporter::CreateS6()
|
|||
|
||||
extern "C"
|
||||
{
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00675E1B
|
||||
*/
|
||||
bool game_load_sv6(SDL_RWops * rw)
|
||||
{
|
||||
if (!sawyercoding_validate_checksum(rw) && !gConfigGeneral.allow_loading_with_incorrect_checksum)
|
||||
{
|
||||
log_error("invalid checksum");
|
||||
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gGameCommandErrorTitle = STR_FILE_CONTAINS_INVALID_DATA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
auto stream = FileStream(rw, FILE_MODE_OPEN);
|
||||
auto s6Importer = new S6Importer();
|
||||
try
|
||||
{
|
||||
s6Importer->LoadFromStream(&stream, false);
|
||||
s6Importer->Import();
|
||||
|
||||
game_fix_save_vars();
|
||||
sprite_position_tween_reset();
|
||||
result = true;
|
||||
}
|
||||
catch (const ObjectLoadException &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
}
|
||||
delete s6Importer;
|
||||
|
||||
// #2407: Resetting screen time to not open a save prompt shortly after loading a park.
|
||||
gScreenAge = 0;
|
||||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool game_load_sv6_path(const char * path)
|
||||
{
|
||||
bool result = false;
|
||||
|
|
Loading…
Reference in New Issue