From 144d312ead5fd4192f04ca7179bf043b951d8382 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Fri, 24 Apr 2020 04:00:41 +0200 Subject: [PATCH] Fix RCT1 import importing too many vehicle types (#11419) --- distribution/changelog.txt | 1 + src/openrct2/rct1/S4Importer.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index af08d22de0..3964cd885f 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -11,6 +11,7 @@ - Fix: [#11259] Custom JSON object breaks saves. - Fix: [#11315] Ride that has never opened is shown as favorite ride of many guests. - Fix: [#11405] Building a path through walls does not always remove the walls. +- Fix: RCT1 scenarios have more items in the object list than are present in the park or the research list. - Improved: [#6530] Allow water and land height changes on park borders. 0.2.6 (2020-04-17) diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 137249a383..9e355cf31c 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -409,6 +409,8 @@ private: { size_t researchListCount; const rct1_research_item* researchList = GetResearchList(&researchListCount); + std::bitset rideTypeInResearch = GetRideTypesPresentInResearchList( + researchList, researchListCount); for (size_t i = 0; i < researchListCount; i++) { const rct1_research_item* researchItem = &researchList[i]; @@ -434,7 +436,12 @@ private: AddEntryForRideType(researchItem->item); break; case RCT1_RESEARCH_TYPE_VEHICLE: - AddEntryForVehicleType(researchItem->related_ride, researchItem->item); + // For some bizarre reason, RCT1 research lists contain vehicles that aren't actually researched. + // Extra bizarrely, this does not seem to apply to Loopy Landscapes saves/scenarios. + if (rideTypeInResearch[researchItem->related_ride] || _gameVersion == FILE_VERSION_RCT1_LL) + { + AddEntryForVehicleType(researchItem->related_ride, researchItem->item); + } break; } }