From 7089ec80fcead58d0399b54fe1b6669fa7fdf990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Sat, 4 Nov 2017 22:18:37 +0100 Subject: [PATCH] Fix highscores for savegames When loading a savegame, its filename gets stored as gScenarioFileName. However, that isn't necessarily the same name as the filename of the corresponding scenario (or any, for that matter, due to the different file extension). This broke highscores, so for savegames we have to take the scenario filename stored in the file. --- src/openrct2/rct2/S6Importer.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 01705d5310..dad3f640ca 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -358,8 +358,16 @@ public: gParkEntrances[i].z = _s6.park_entrance_z[i]; gParkEntrances[i].direction = _s6.park_entrance_direction[i]; } - // _s6.scenario_filename is wrong for some RCT2 expansion scenarios, so we use the real filename - String::Set(gScenarioFileName, sizeof(gScenarioFileName), Path::GetFileName(_s6Path)); + if (_s6.header.type == S6_TYPE_SCENARIO) + { + // _s6.scenario_filename is wrong for some RCT2 expansion scenarios, so we use the real filename + String::Set(gScenarioFileName, sizeof(gScenarioFileName), Path::GetFileName(_s6Path)); + } + else + { + // For savegames the filename can be arbitrary, so we have no choice but to rely on the name provided + String::Set(gScenarioFileName, sizeof(gScenarioFileName), _s6.scenario_filename); + } memcpy(gScenarioExpansionPacks, _s6.saved_expansion_pack_names, sizeof(_s6.saved_expansion_pack_names)); memcpy(gBanners, _s6.banners, sizeof(_s6.banners)); memcpy(gUserStrings, _s6.custom_strings, sizeof(_s6.custom_strings));