1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Make rct_windowclass strong type WindowClass

This already revealed some places where implicit conversions were done, including some where its use was nonsense (MouseInput.cpp).
The changes to the Intent class were necessary to keep things working, and this splits things up more neatly.
This commit is contained in:
Hielke Morsink
2022-08-21 18:38:25 +02:00
committed by GitHub
parent ebe38a91ce
commit 7f29e4e39c
145 changed files with 1331 additions and 1235 deletions

View File

@@ -64,33 +64,33 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
gParkFlags &= ~PARK_FLAGS_NO_MONEY;
}
// Invalidate all windows that have anything to do with finance
window_invalidate_by_class(WC_RIDE);
window_invalidate_by_class(WC_PEEP);
window_invalidate_by_class(WC_PARK_INFORMATION);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
window_invalidate_by_class(WC_TOP_TOOLBAR);
window_invalidate_by_class(WindowClass::Ride);
window_invalidate_by_class(WindowClass::Peep);
window_invalidate_by_class(WindowClass::ParkInformation);
window_invalidate_by_class(WindowClass::Finances);
window_invalidate_by_class(WindowClass::BottomToolbar);
window_invalidate_by_class(WindowClass::TopToolbar);
}
break;
case ScenarioSetSetting::InitialCash:
gInitialCash = std::clamp<money64>(_value, 0.00_GBP, 1000000.00_GBP);
gCash = gInitialCash;
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
window_invalidate_by_class(WindowClass::Finances);
window_invalidate_by_class(WindowClass::BottomToolbar);
break;
case ScenarioSetSetting::InitialLoan:
gBankLoan = std::clamp<money64>(_value, 0.00_GBP, 5000000.00_GBP);
gMaxBankLoan = std::max(gBankLoan, gMaxBankLoan);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WindowClass::Finances);
break;
case ScenarioSetSetting::MaximumLoanSize:
gMaxBankLoan = std::clamp<money64>(_value, 0.00_GBP, 5000000.00_GBP);
gBankLoan = std::min(gBankLoan, gMaxBankLoan);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WindowClass::Finances);
break;
case ScenarioSetSetting::AnnualInterestRate:
gBankLoanInterestRate = std::clamp<uint8_t>(_value, 0, 80);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WindowClass::Finances);
break;
case ScenarioSetSetting::ForbidMarketingCampaigns:
if (_value != 0)
@@ -179,13 +179,13 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
gParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
}
window_invalidate_by_class(WC_PARK_INFORMATION);
window_invalidate_by_class(WC_RIDE);
window_invalidate_by_class(WindowClass::ParkInformation);
window_invalidate_by_class(WindowClass::Ride);
}
break;
case ScenarioSetSetting::ParkChargeEntryFee:
gParkEntranceFee = std::clamp<money32>(_value, 0.00_GBP, MAX_ENTRANCE_FEE);
window_invalidate_by_class(WC_PARK_INFORMATION);
window_invalidate_by_class(WindowClass::ParkInformation);
break;
case ScenarioSetSetting::ForbidTreeRemoval:
if (_value != 0)
@@ -244,6 +244,6 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
log_error("Invalid setting: %u", _setting);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
window_invalidate_by_class(WC_EDITOR_SCENARIO_OPTIONS);
window_invalidate_by_class(WindowClass::EditorScenarioOptions);
return GameActions::Result();
}