mirror of https://github.com/OpenRCT2/OpenRCT2.git
Allow loading saved games in editor
This commit is contained in:
parent
9359379d29
commit
5e554ebdcb
|
@ -309,7 +309,14 @@ static int editor_load_landscape_from_sc4(const char *path)
|
||||||
*/
|
*/
|
||||||
static int editor_read_s6(const char *path)
|
static int editor_read_s6(const char *path)
|
||||||
{
|
{
|
||||||
if (!scenario_load(path)) {
|
bool loadResult;
|
||||||
|
const char *extension = path_get_extension(path);
|
||||||
|
if (_stricmp(extension, ".sc6") == 0) {
|
||||||
|
loadResult = scenario_load(path);
|
||||||
|
} else if (_stricmp(extension, ".sv6") == 0) {
|
||||||
|
loadResult = game_load_sv6_path(path);
|
||||||
|
}
|
||||||
|
if (!loadResult) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,7 @@ void game_increase_game_speed();
|
||||||
void game_reduce_game_speed();
|
void game_reduce_game_speed();
|
||||||
|
|
||||||
void game_load_or_quit_no_save_prompt();
|
void game_load_or_quit_no_save_prompt();
|
||||||
|
bool game_load_sv6_path(const char * path);
|
||||||
int game_load_sv6(SDL_RWops* rw);
|
int game_load_sv6(SDL_RWops* rw);
|
||||||
int game_load_network(SDL_RWops* rw);
|
int game_load_network(SDL_RWops* rw);
|
||||||
bool game_load_save(const utf8 *path);
|
bool game_load_save(const utf8 *path);
|
||||||
|
|
|
@ -400,6 +400,41 @@ extern "C"
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool game_load_sv6_path(const char * path)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
auto s6Importer = new S6Importer();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
s6Importer->FixIssues = true;
|
||||||
|
s6Importer->LoadSavedGame(path);
|
||||||
|
s6Importer->Import();
|
||||||
|
|
||||||
|
openrct2_reset_object_tween_locations();
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
catch (ObjectLoadException)
|
||||||
|
{
|
||||||
|
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||||
|
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||||
|
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||||
|
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
|
||||||
|
}
|
||||||
|
delete s6Importer;
|
||||||
|
|
||||||
|
gScreenAge = 0;
|
||||||
|
gLastAutoSaveTick = SDL_GetTicks();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x00676053
|
* rct2: 0x00676053
|
||||||
|
|
Loading…
Reference in New Issue