From 11f4993c035c2a987277111dbe4085c4a7d007f8 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 9 Apr 2022 12:36:31 +0100 Subject: [PATCH] Remove no money scenerio flag --- .../windows/EditorObjectiveOptions.cpp | 5 ++--- .../windows/EditorScenarioOptions.cpp | 21 ++++--------------- src/openrct2/Editor.cpp | 8 ------- .../actions/ScenarioSetSettingAction.cpp | 4 ++-- src/openrct2/rct1/S4Importer.cpp | 4 +--- src/openrct2/rct2/S6Importer.cpp | 10 ++++++++- src/openrct2/scenario/Scenario.cpp | 3 --- .../scripting/bindings/world/ScPark.cpp | 1 - src/openrct2/world/Park.h | 2 +- 9 files changed, 19 insertions(+), 39 deletions(-) diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 6beb44656d..bb7e59511d 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -386,7 +386,7 @@ static void WindowEditorObjectiveOptionsShowObjectiveDropdown(rct_window* w) if (i == OBJECTIVE_NONE || i == OBJECTIVE_BUILD_THE_BEST) continue; - const bool objectiveAllowedByMoneyUsage = !(parkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) || !ObjectiveNeedsMoney(i); + const bool objectiveAllowedByMoneyUsage = !(parkFlags & PARK_FLAGS_NO_MONEY) || !ObjectiveNeedsMoney(i); // This objective can only work if the player can ask money for rides. const bool objectiveAllowedByPaymentSettings = (i != OBJECTIVE_MONTHLY_RIDE_INCOME) || park_ride_prices_unlocked(); if (objectiveAllowedByMoneyUsage && objectiveAllowedByPaymentSettings) @@ -659,8 +659,7 @@ static void WindowEditorObjectiveOptionsMainUpdate(rct_window* w) objectiveType = gScenarioObjective.Type; // Check if objective is allowed by money and pay-per-ride settings. - const bool objectiveAllowedByMoneyUsage = !(parkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) - || !ObjectiveNeedsMoney(objectiveType); + const bool objectiveAllowedByMoneyUsage = !(parkFlags & PARK_FLAGS_NO_MONEY) || !ObjectiveNeedsMoney(objectiveType); // This objective can only work if the player can ask money for rides. const bool objectiveAllowedByPaymentSettings = (objectiveType != OBJECTIVE_MONTHLY_RIDE_INCOME) || park_ride_prices_unlocked(); diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index c09cf61c4c..af44adfd46 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -387,17 +387,7 @@ static void WindowEditorScenarioOptionsFinancialMouseup(rct_window* w, rct_widge break; case WIDX_NO_MONEY: { - int32_t newMoneySetting; - - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - { - newMoneySetting = (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) ? 0 : 1; - } - else - { - newMoneySetting = (gParkFlags & PARK_FLAGS_NO_MONEY) ? 0 : 1; - } - + auto newMoneySetting = (gParkFlags & PARK_FLAGS_NO_MONEY) ? 0 : 1; auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::NoMoney, newMoneySetting); GameActions::Execute(&scenarioSetSetting); w->Invalidate(); @@ -583,8 +573,7 @@ static void WindowEditorScenarioOptionsFinancialInvalidate(rct_window* w) WindowEditorScenarioOptionsSetPressedTab(w); - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO)) - || (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY))) + if (gParkFlags & PARK_FLAGS_NO_MONEY) { w->pressed_widgets |= (1ULL << WIDX_NO_MONEY); for (int32_t i = WIDX_INITIAL_CASH; i <= WIDX_FORBID_MARKETING; i++) @@ -871,8 +860,7 @@ static void WindowEditorScenarioOptionsGuestsInvalidate(rct_window* w) WindowEditorScenarioOptionsSetPressedTab(w); - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO)) - || (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY))) + if (gParkFlags & PARK_FLAGS_NO_MONEY) { w->widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Empty; w->widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Empty; @@ -1207,8 +1195,7 @@ static void WindowEditorScenarioOptionsParkInvalidate(rct_window* w) WindowEditorScenarioOptionsSetPressedTab(w); - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO)) - || (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY))) + if (gParkFlags & PARK_FLAGS_NO_MONEY) { for (int32_t i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++) w->widgets[i].type = WindowWidgetType::Empty; diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index b291ac63ff..f05c845a4c 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -344,14 +344,6 @@ namespace Editor gGuestChangeModifier = 0; if (fromSave) { - if (gParkFlags & PARK_FLAGS_NO_MONEY) - { - gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO; - } - else - { - gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO; - } gParkFlags |= PARK_FLAGS_NO_MONEY; if (gParkEntranceFee == 0) diff --git a/src/openrct2/actions/ScenarioSetSettingAction.cpp b/src/openrct2/actions/ScenarioSetSettingAction.cpp index 1f31fdd56f..cf58706178 100644 --- a/src/openrct2/actions/ScenarioSetSettingAction.cpp +++ b/src/openrct2/actions/ScenarioSetSettingAction.cpp @@ -46,11 +46,11 @@ GameActions::Result ScenarioSetSettingAction::Execute() const { if (_value != 0) { - gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO; + gParkFlags |= PARK_FLAGS_NO_MONEY; } else { - gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO; + gParkFlags &= ~PARK_FLAGS_NO_MONEY; } } else diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index ecaa95101f..6180fb1562 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2206,11 +2206,9 @@ namespace RCT1 gParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES; } - // RCT2 uses two flags for no money (due to the scenario editor). RCT1 used only one. - // Copy its value to make no money scenarios such as Arid Heights work properly. if (_s4.park_flags & RCT1_PARK_FLAGS_NO_MONEY) { - gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO; + gParkFlags |= PARK_FLAGS_NO_MONEY; } gParkSize = _s4.park_size; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index b2a6ad78a1..0f7bbb9c2a 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -252,7 +252,15 @@ namespace RCT2 gInitialCash = ToMoney64(_s6.initial_cash); gBankLoan = ToMoney64(_s6.current_loan); - gParkFlags = _s6.park_flags; + + gParkFlags = _s6.park_flags & ~PARK_FLAGS_NO_MONEY_SCENARIO; + + // RCT2 used a different flag for `no money` when the park is a scenario + if (_s6.header.type == S6_TYPE_SCENARIO && (_s6.park_flags & PARK_FLAGS_NO_MONEY_SCENARIO)) + gParkFlags |= PARK_FLAGS_NO_MONEY; + else + gParkFlags &= ~PARK_FLAGS_NO_MONEY; + gParkEntranceFee = _s6.park_entrance_fee; // rct1_park_entrance_x // rct1_park_entrance_y diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 72edda8bb5..49396ce1d5 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -105,9 +105,6 @@ void scenario_reset() Random::Rct2::Seed s{ 0x1234567F ^ Platform::GetTicks(), 0x789FABCD ^ Platform::GetTicks() }; gScenarioRand.seed(s); - gParkFlags &= ~PARK_FLAGS_NO_MONEY; - if (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) - gParkFlags |= PARK_FLAGS_NO_MONEY; research_reset_current_item(); scenery_set_default_placement_configuration(); News::InitQueue(); diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 1f21a1c920..1d07f262e7 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -41,7 +41,6 @@ namespace OpenRCT2::Scripting { "difficultGuestGeneration", PARK_FLAGS_DIFFICULT_GUEST_GENERATION }, { "freeParkEntry", PARK_FLAGS_PARK_FREE_ENTRY }, { "difficultParkRating", PARK_FLAGS_DIFFICULT_PARK_RATING }, - { "noMoney", PARK_FLAGS_NO_MONEY_SCENARIO }, { "unlockAllPrices", PARK_FLAGS_UNLOCK_ALL_PRICES }, }); diff --git a/src/openrct2/world/Park.h b/src/openrct2/world/Park.h index d065282459..057a7ba2b7 100644 --- a/src/openrct2/world/Park.h +++ b/src/openrct2/world/Park.h @@ -34,7 +34,7 @@ enum : uint32_t PARK_FLAGS_PARK_FREE_ENTRY = (1 << 13), PARK_FLAGS_DIFFICULT_PARK_RATING = (1 << 14), PARK_FLAGS_LOCK_REAL_NAMES_OPTION_DEPRECATED = (1 << 15), // Deprecated now we use a persistent 'real names' setting - PARK_FLAGS_NO_MONEY_SCENARIO = (1 << 17), // equivalent to PARK_FLAGS_NO_MONEY, but used in scenario editor + PARK_FLAGS_NO_MONEY_SCENARIO = (1 << 17), // Deprecated, originally used in scenario editor PARK_FLAGS_SPRITES_INITIALISED = (1 << 18), // After a scenario is loaded this prevents edits in the scenario editor PARK_FLAGS_SIX_FLAGS_DEPRECATED = (1 << 19), // Not used anymore PARK_FLAGS_UNLOCK_ALL_PRICES = (1u << 31), // OpenRCT2 only!