From c233eedafeb3650fba261fa75d3a46eceea2034e Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sat, 18 Feb 2017 13:40:10 +0100 Subject: [PATCH] Multiply SV4 park value objectives by 10, fixes #5218 --- src/openrct2/rct1/S4Importer.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index a0bc2eeb73..f7bf48c3ec 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -227,7 +227,11 @@ public: dst->objective_type = _s4.scenario_objective_type; dst->objective_arg_1 = _s4.scenario_objective_years; - dst->objective_arg_2 = _s4.scenario_objective_currency; + // RCT1 used another way of calculating park value. + if (_s4.scenario_objective_type == OBJECTIVE_PARK_VALUE_BY) + dst->objective_arg_2 = CorrectRCT1ParkValue(_s4.scenario_objective_currency); + else + dst->objective_arg_2 = _s4.scenario_objective_currency; dst->objective_arg_3 = _s4.scenario_objective_num_guests; std::string name = std::string(_s4.scenario_name, sizeof(_s4.scenario_name)); @@ -254,6 +258,11 @@ public: return result; } + sint32 CorrectRCT1ParkValue(sint32 oldParkValue) + { + return oldParkValue * 10; + } + private: void Initialise() { @@ -1602,7 +1611,7 @@ private: gInitialCash = _s4.cash; gCompanyValue = _s4.company_value; - gParkValue = _s4.park_value; + gParkValue = CorrectRCT1ParkValue(_s4.park_value); gCurrentProfit = _s4.profit; for (size_t i = 0; i < 128; i++) @@ -2001,8 +2010,15 @@ private: { gScenarioObjectiveType = _s4.scenario_objective_type; gScenarioObjectiveYear = _s4.scenario_objective_years; - gScenarioObjectiveCurrency = _s4.scenario_objective_currency; gScenarioObjectiveNumGuests = _s4.scenario_objective_num_guests; + // RCT1 used a different way of calculating the park value. + // This is corrected here, but since scenario_objective_currency doubles as minimum excitement rating, + // we need to check the goal to avoid affecting scenarios like Volcania. + if (_s4.scenario_objective_type == OBJECTIVE_PARK_VALUE_BY) + gScenarioObjectiveCurrency = CorrectRCT1ParkValue(_s4.scenario_objective_currency); + else + gScenarioObjectiveCurrency = _s4.scenario_objective_currency; + } void ImportSavedView()