From 1fc32182af399143ddd777fc6c475ca9879fab2d Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Sun, 14 Jan 2018 19:25:35 +0000 Subject: [PATCH] Fix #6314: SV4s do not mark corresponding scenario as completed --- src/openrct2/rct1/S4Importer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index f4d76caf8c..e4dc438092 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -126,6 +126,9 @@ private: uint8 _researchRideEntryUsed[MAX_RIDE_OBJECTS]; uint8 _researchRideTypeUsed[RCT1_RIDE_TYPE_COUNT]; + // Scenario repository - used for determining scenario name + IScenarioRepository * _scenarioRepository = GetScenarioRepository(); + public: ParkLoadResult Load(const utf8 * path) override { @@ -325,7 +328,7 @@ private: InitialiseEntryMaps(); uint16 mapSize = _s4.map_size == 0 ? 128 : _s4.map_size; - String::Set(gScenarioFileName, sizeof(gScenarioFileName), Path::GetFileName(_s4Path)); + String::Set(gScenarioFileName, sizeof(gScenarioFileName), GetRCT1ScenarioName().c_str()); // Do map initialisation, same kind of stuff done when loading scenario editor GetObjectManager()->UnloadAll(); @@ -335,6 +338,12 @@ private: gS6Info.category = SCENARIO_CATEGORY_OTHER; } + std::string GetRCT1ScenarioName() + { + const scenario_index_entry * scenarioEntry = _scenarioRepository->GetByIndex(_s4.scenario_slot_index); + return path_get_filename(scenarioEntry->path); + } + void InitialiseEntryMaps() { Memory::Set(_rideTypeToRideEntryMap, 255, sizeof(_rideTypeToRideEntryMap));