1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix #16287: Incorrect sv6 extension using console or system browser

This commit is contained in:
Duncan
2021-12-22 15:19:02 +00:00
committed by GitHub
parent 24567290ad
commit ee297e9ed3
3 changed files with 17 additions and 6 deletions

View File

@@ -349,8 +349,8 @@ static bool Browse(bool isSave, char* path, size_t pathSize)
switch (_type & 0x0E)
{
case LOADSAVETYPE_GAME:
extension = ".sv6";
fileType = FILE_EXTENSION_SV6;
extension = ".park";
fileType = FILE_EXTENSION_PARK;
title = isSave ? STR_FILE_DIALOG_TITLE_SAVE_GAME : STR_FILE_DIALOG_TITLE_LOAD_GAME;
desc.filters[0].name = language_get_string(STR_OPENRCT2_SAVED_GAME);
desc.filters[0].pattern = GetFilterPatternByType(_type, isSave);

View File

@@ -532,7 +532,12 @@ void save_game()
{
if (!gFirstTimeSaving)
{
save_game_with_name(gScenarioSavePath.c_str());
char savePath[MAX_PATH];
safe_strcpy(savePath, gScenarioSavePath.c_str(), MAX_PATH);
path_remove_extension(savePath);
path_append_extension(savePath, ".park", MAX_PATH);
save_game_with_name(savePath);
}
else
{
@@ -544,7 +549,12 @@ void save_game_cmd(const utf8* name /* = nullptr */)
{
if (name == nullptr)
{
save_game_with_name(gScenarioSavePath.c_str());
char savePath[MAX_PATH];
safe_strcpy(savePath, gScenarioSavePath.c_str(), MAX_PATH);
path_remove_extension(savePath);
path_append_extension(savePath, ".park", MAX_PATH);
save_game_with_name(savePath);
}
else
{

View File

@@ -1365,9 +1365,10 @@ static int32_t cc_load_park([[maybe_unused]] InteractiveConsole& console, [[mayb
{
safe_strcpy(savePath, argv[0].c_str(), sizeof(savePath));
}
if (!String::EndsWith(savePath, ".sv6", true) && !String::EndsWith(savePath, ".sc6", true))
if (!String::EndsWith(savePath, ".sv6", true) && !String::EndsWith(savePath, ".sc6", true)
&& !String::EndsWith(savePath, ".park", true))
{
path_append_extension(savePath, ".sv6", sizeof(savePath));
path_append_extension(savePath, ".park", sizeof(savePath));
}
if (context_load_park_from_file(savePath))
{