Move Park into namespace, add other park-related things to struct

This commit is contained in:
Gymnasiast 2024-03-26 21:35:55 +01:00
parent 4f3b7aa8a9
commit c158854a7f
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
76 changed files with 1096 additions and 1086 deletions

View File

@ -278,7 +278,7 @@ static void ShortcutShowFinancialInformation()
return; return;
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
ContextOpenWindow(WindowClass::Finances); ContextOpenWindow(WindowClass::Finances);
} }

View File

@ -371,7 +371,7 @@ static StringId window_cheats_page_titles[] = {
void OnOpen() override void OnOpen() override
{ {
SetPage(WINDOW_CHEATS_PAGE_MONEY); SetPage(WINDOW_CHEATS_PAGE_MONEY);
_parkRatingSpinnerValue = ParkGetForcedRating() >= 0 ? ParkGetForcedRating() : 999; _parkRatingSpinnerValue = Park::GetForcedRating() >= 0 ? Park::GetForcedRating() : 999;
} }
void OnUpdate() override void OnUpdate() override
@ -459,7 +459,7 @@ static StringId window_cheats_page_titles[] = {
{ {
case WINDOW_CHEATS_PAGE_MONEY: case WINDOW_CHEATS_PAGE_MONEY:
{ {
auto moneyDisabled = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) != 0; auto moneyDisabled = (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) != 0;
SetCheckboxValue(WIDX_NO_MONEY, moneyDisabled); SetCheckboxValue(WIDX_NO_MONEY, moneyDisabled);
SetWidgetDisabled(WIDX_ADD_SET_MONEY_GROUP, moneyDisabled); SetWidgetDisabled(WIDX_ADD_SET_MONEY_GROUP, moneyDisabled);
SetWidgetDisabled(WIDX_MONEY_SPINNER, moneyDisabled); SetWidgetDisabled(WIDX_MONEY_SPINNER, moneyDisabled);
@ -480,9 +480,9 @@ static StringId window_cheats_page_titles[] = {
break; break;
} }
case WINDOW_CHEATS_PAGE_MISC: case WINDOW_CHEATS_PAGE_MISC:
widgets[WIDX_OPEN_CLOSE_PARK].text = (gameState.ParkFlags & PARK_FLAGS_PARK_OPEN) ? STR_CHEAT_CLOSE_PARK widgets[WIDX_OPEN_CLOSE_PARK].text = (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) ? STR_CHEAT_CLOSE_PARK
: STR_CHEAT_OPEN_PARK; : STR_CHEAT_OPEN_PARK;
SetCheckboxValue(WIDX_FORCE_PARK_RATING, ParkGetForcedRating() >= 0); SetCheckboxValue(WIDX_FORCE_PARK_RATING, Park::GetForcedRating() >= 0);
SetCheckboxValue(WIDX_FREEZE_WEATHER, gameState.Cheats.FreezeWeather); SetCheckboxValue(WIDX_FREEZE_WEATHER, gameState.Cheats.FreezeWeather);
SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.Cheats.NeverendingMarketing); SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.Cheats.NeverendingMarketing);
SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gameState.Cheats.DisablePlantAging); SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gameState.Cheats.DisablePlantAging);
@ -788,7 +788,7 @@ static StringId window_cheats_page_titles[] = {
switch (widgetIndex) switch (widgetIndex)
{ {
case WIDX_NO_MONEY: case WIDX_NO_MONEY:
CheatsSet(CheatType::NoMoney, GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY ? 0 : 1); CheatsSet(CheatType::NoMoney, GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY ? 0 : 1);
break; break;
case WIDX_MONEY_SPINNER: case WIDX_MONEY_SPINNER:
MoneyToString(_moneySpinnerValue, _moneySpinnerText, MONEY_STRING_MAXLENGTH, false); MoneyToString(_moneySpinnerValue, _moneySpinnerText, MONEY_STRING_MAXLENGTH, false);
@ -814,7 +814,7 @@ static StringId window_cheats_page_titles[] = {
case WIDX_INCREASE_PARK_RATING: case WIDX_INCREASE_PARK_RATING:
_parkRatingSpinnerValue = std::min(999, 10 * (_parkRatingSpinnerValue / 10 + 1)); _parkRatingSpinnerValue = std::min(999, 10 * (_parkRatingSpinnerValue / 10 + 1));
InvalidateWidget(WIDX_PARK_RATING_SPINNER); InvalidateWidget(WIDX_PARK_RATING_SPINNER);
if (ParkGetForcedRating() >= 0) if (Park::GetForcedRating() >= 0)
{ {
auto cheatSetAction = CheatSetAction(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); auto cheatSetAction = CheatSetAction(CheatType::SetForcedParkRating, _parkRatingSpinnerValue);
GameActions::Execute(&cheatSetAction); GameActions::Execute(&cheatSetAction);
@ -823,7 +823,7 @@ static StringId window_cheats_page_titles[] = {
case WIDX_DECREASE_PARK_RATING: case WIDX_DECREASE_PARK_RATING:
_parkRatingSpinnerValue = std::max(0, 10 * (_parkRatingSpinnerValue / 10 - 1)); _parkRatingSpinnerValue = std::max(0, 10 * (_parkRatingSpinnerValue / 10 - 1));
InvalidateWidget(WIDX_PARK_RATING_SPINNER); InvalidateWidget(WIDX_PARK_RATING_SPINNER);
if (ParkGetForcedRating() >= 0) if (Park::GetForcedRating() >= 0)
{ {
CheatsSet(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); CheatsSet(CheatType::SetForcedParkRating, _parkRatingSpinnerValue);
} }
@ -913,7 +913,7 @@ static StringId window_cheats_page_titles[] = {
CheatsSet(CheatType::NeverEndingMarketing, !gameState.Cheats.NeverendingMarketing); CheatsSet(CheatType::NeverEndingMarketing, !gameState.Cheats.NeverendingMarketing);
break; break;
case WIDX_FORCE_PARK_RATING: case WIDX_FORCE_PARK_RATING:
if (ParkGetForcedRating() >= 0) if (Park::GetForcedRating() >= 0)
{ {
CheatsSet(CheatType::SetForcedParkRating, -1); CheatsSet(CheatType::SetForcedParkRating, -1);
} }

View File

@ -192,7 +192,7 @@ namespace OpenRCT2::Ui::Windows
// Draw cost amount // Draw cost amount
if (gClearSceneryCost != kMoney64Undefined && gClearSceneryCost != 0 if (gClearSceneryCost != kMoney64Undefined && gClearSceneryCost != 0
&& !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(gClearSceneryCost); ft.Add<money64>(gClearSceneryCost);

View File

@ -84,8 +84,8 @@ static Widget window_ride_demolish_widgets[] =
auto currentRide = GetRide(rideId); auto currentRide = GetRide(rideId);
if (currentRide != nullptr) if (currentRide != nullptr)
{ {
auto stringId = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? STR_DEMOLISH_RIDE_ID auto stringId = (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) ? STR_DEMOLISH_RIDE_ID
: STR_DEMOLISH_RIDE_ID_MONEY; : STR_DEMOLISH_RIDE_ID_MONEY;
auto ft = Formatter(); auto ft = Formatter();
currentRide->FormatNameTo(ft); currentRide->FormatNameTo(ft);
ft.Add<money64>(_demolishRideCost); ft.Add<money64>(_demolishRideCost);

View File

@ -105,7 +105,7 @@ static Widget _editorBottomToolbarWidgets[] = {
} }
else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)) else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER))
{ {
if (GetNumFreeEntities() != MAX_ENTITIES || GetGameState().ParkFlags & PARK_FLAGS_SPRITES_INITIALISED) if (GetNumFreeEntities() != MAX_ENTITIES || GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)
{ {
HidePreviousStepButton(); HidePreviousStepButton();
} }
@ -141,7 +141,7 @@ static Widget _editorBottomToolbarWidgets[] = {
if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON) if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
{ {
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|| (GetNumFreeEntities() == MAX_ENTITIES && !(GetGameState().ParkFlags & PARK_FLAGS_SPRITES_INITIALISED))) || (GetNumFreeEntities() == MAX_ENTITIES && !(GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)))
{ {
((this)->*(_previousButtonMouseUp[EnumValue(gameState.EditorStep)]))(); ((this)->*(_previousButtonMouseUp[EnumValue(gameState.EditorStep)]))();
} }

View File

@ -446,10 +446,11 @@ static uint64_t window_editor_objective_options_page_hold_down_widgets[] = {
if (i == OBJECTIVE_NONE || i == OBJECTIVE_BUILD_THE_BEST) if (i == OBJECTIVE_NONE || i == OBJECTIVE_BUILD_THE_BEST)
continue; continue;
const bool objectiveAllowedByMoneyUsage = !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) const bool objectiveAllowedByMoneyUsage = !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
|| !ObjectiveNeedsMoney(i); || !ObjectiveNeedsMoney(i);
// This objective can only work if the player can ask money for rides. // This objective can only work if the player can ask money for rides.
const bool objectiveAllowedByPaymentSettings = (i != OBJECTIVE_MONTHLY_RIDE_INCOME) || ParkRidePricesUnlocked(); const bool objectiveAllowedByPaymentSettings = (i != OBJECTIVE_MONTHLY_RIDE_INCOME)
|| Park::RidePricesUnlocked();
if (objectiveAllowedByMoneyUsage && objectiveAllowedByPaymentSettings) if (objectiveAllowedByMoneyUsage && objectiveAllowedByPaymentSettings)
{ {
gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL; gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL;
@ -763,11 +764,11 @@ static uint64_t window_editor_objective_options_page_hold_down_widgets[] = {
objectiveType = GetGameState().ScenarioObjective.Type; objectiveType = GetGameState().ScenarioObjective.Type;
// Check if objective is allowed by money and pay-per-ride settings. // Check if objective is allowed by money and pay-per-ride settings.
const bool objectiveAllowedByMoneyUsage = !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) const bool objectiveAllowedByMoneyUsage = !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
|| !ObjectiveNeedsMoney(objectiveType); || !ObjectiveNeedsMoney(objectiveType);
// This objective can only work if the player can ask money for rides. // This objective can only work if the player can ask money for rides.
const bool objectiveAllowedByPaymentSettings = (objectiveType != OBJECTIVE_MONTHLY_RIDE_INCOME) const bool objectiveAllowedByPaymentSettings = (objectiveType != OBJECTIVE_MONTHLY_RIDE_INCOME)
|| ParkRidePricesUnlocked(); || Park::RidePricesUnlocked();
if (!objectiveAllowedByMoneyUsage || !objectiveAllowedByPaymentSettings) if (!objectiveAllowedByMoneyUsage || !objectiveAllowedByPaymentSettings)
{ {
// Reset objective // Reset objective

View File

@ -385,7 +385,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
break; break;
case WIDX_NO_MONEY: case WIDX_NO_MONEY:
{ {
auto newMoneySetting = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) ? 0 : 1; auto newMoneySetting = (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) ? 0 : 1;
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::NoMoney, newMoneySetting); auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::NoMoney, newMoneySetting);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
@ -395,7 +395,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::ForbidMarketingCampaigns, ScenarioSetSetting::ForbidMarketingCampaigns,
gameState.ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1); gameState.Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -403,7 +403,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
case WIDX_RCT1_INTEREST: case WIDX_RCT1_INTEREST:
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::UseRCT1Interest, gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1); ScenarioSetSetting::UseRCT1Interest, gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -570,7 +570,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
SetPressedTab(); SetPressedTab();
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
SetWidgetPressed(WIDX_NO_MONEY, true); SetWidgetPressed(WIDX_NO_MONEY, true);
for (int32_t i = WIDX_INITIAL_CASH; i <= WIDX_RCT1_INTEREST; i++) for (int32_t i = WIDX_INITIAL_CASH; i <= WIDX_RCT1_INTEREST; i++)
@ -590,7 +590,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
widgets[WIDX_MAXIMUM_LOAN_DECREASE].type = WindowWidgetType::Button; widgets[WIDX_MAXIMUM_LOAN_DECREASE].type = WindowWidgetType::Button;
widgets[WIDX_FORBID_MARKETING].type = WindowWidgetType::Checkbox; widgets[WIDX_FORBID_MARKETING].type = WindowWidgetType::Checkbox;
if (gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST) if (gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST)
{ {
widgets[WIDX_INTEREST_RATE].type = WindowWidgetType::Empty; widgets[WIDX_INTEREST_RATE].type = WindowWidgetType::Empty;
widgets[WIDX_INTEREST_RATE_INCREASE].type = WindowWidgetType::Empty; widgets[WIDX_INTEREST_RATE_INCREASE].type = WindowWidgetType::Empty;
@ -607,7 +607,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
} }
} }
SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN);
widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty
: WindowWidgetType::CloseBox; : WindowWidgetType::CloseBox;
@ -696,7 +696,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::GuestsPreferLessIntenseRides, ScenarioSetSetting::GuestsPreferLessIntenseRides,
gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES ? 0 : 1); gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -705,7 +705,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::GuestsPreferMoreIntenseRides, ScenarioSetSetting::GuestsPreferMoreIntenseRides,
gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES ? 0 : 1); gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -850,7 +850,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
SetPressedTab(); SetPressedTab();
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Empty; widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Empty;
widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Empty; widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Empty;
@ -863,8 +863,8 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
widgets[WIDX_CASH_PER_GUEST_DECREASE].type = WindowWidgetType::Button; widgets[WIDX_CASH_PER_GUEST_DECREASE].type = WindowWidgetType::Button;
} }
SetWidgetPressed(WIDX_GUEST_PREFER_LESS_INTENSE_RIDES, gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES); SetWidgetPressed(WIDX_GUEST_PREFER_LESS_INTENSE_RIDES, gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES);
SetWidgetPressed(WIDX_GUEST_PREFER_MORE_INTENSE_RIDES, gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES); SetWidgetPressed(WIDX_GUEST_PREFER_MORE_INTENSE_RIDES, gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES);
widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty
: WindowWidgetType::CloseBox; : WindowWidgetType::CloseBox;
@ -948,7 +948,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
case WIDX_FORBID_TREE_REMOVAL: case WIDX_FORBID_TREE_REMOVAL:
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::ForbidTreeRemoval, gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1); ScenarioSetSetting::ForbidTreeRemoval, gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -957,7 +957,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::ForbidLandscapeChanges, ScenarioSetSetting::ForbidLandscapeChanges,
gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1); gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -966,7 +966,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::ForbidHighConstruction, ScenarioSetSetting::ForbidHighConstruction,
gameState.ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1); gameState.Park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -975,7 +975,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::ParkRatingHigherDifficultyLevel, ScenarioSetSetting::ParkRatingHigherDifficultyLevel,
gameState.ParkFlags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1); gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -984,7 +984,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, ScenarioSetSetting::GuestGenerationHigherDifficultyLevel,
gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1); gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
Invalidate(); Invalidate();
break; break;
@ -1058,10 +1058,10 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
Invalidate(); Invalidate();
break; break;
case WIDX_ENTRY_PRICE_INCREASE: case WIDX_ENTRY_PRICE_INCREASE:
if (gameState.ParkEntranceFee < MAX_ENTRANCE_FEE) if (gameState.Park.EntranceFee < MAX_ENTRANCE_FEE)
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::ParkChargeEntryFee, gameState.ParkEntranceFee + 1.00_GBP); ScenarioSetSetting::ParkChargeEntryFee, gameState.Park.EntranceFee + 1.00_GBP);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
} }
else else
@ -1071,10 +1071,10 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
Invalidate(); Invalidate();
break; break;
case WIDX_ENTRY_PRICE_DECREASE: case WIDX_ENTRY_PRICE_DECREASE:
if (gameState.ParkEntranceFee > 0.00_GBP) if (gameState.Park.EntranceFee > 0.00_GBP)
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::ParkChargeEntryFee, gameState.ParkEntranceFee - 1.00_GBP); ScenarioSetSetting::ParkChargeEntryFee, gameState.Park.EntranceFee - 1.00_GBP);
GameActions::Execute(&scenarioSetSetting); GameActions::Execute(&scenarioSetSetting);
} }
else else
@ -1097,9 +1097,9 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1, { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1,
colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3);
if (gameState.ParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES) if (gameState.Park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES)
Dropdown::SetChecked(2, true); Dropdown::SetChecked(2, true);
else if (gameState.ParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) else if (gameState.Park.Flags & PARK_FLAGS_PARK_FREE_ENTRY)
Dropdown::SetChecked(0, true); Dropdown::SetChecked(0, true);
else else
Dropdown::SetChecked(1, true); Dropdown::SetChecked(1, true);
@ -1156,7 +1156,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
SetPressedTab(); SetPressedTab();
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
for (int32_t i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++) for (int32_t i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++)
widgets[i].type = WindowWidgetType::Empty; widgets[i].type = WindowWidgetType::Empty;
@ -1172,7 +1172,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
widgets[WIDX_PAY_FOR_PARK_OR_RIDES].type = WindowWidgetType::DropdownMenu; widgets[WIDX_PAY_FOR_PARK_OR_RIDES].type = WindowWidgetType::DropdownMenu;
widgets[WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN].type = WindowWidgetType::Button; widgets[WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN].type = WindowWidgetType::Button;
if (!ParkEntranceFeeUnlocked()) if (!Park::EntranceFeeUnlocked())
{ {
widgets[WIDX_ENTRY_PRICE].type = WindowWidgetType::Empty; widgets[WIDX_ENTRY_PRICE].type = WindowWidgetType::Empty;
widgets[WIDX_ENTRY_PRICE_INCREASE].type = WindowWidgetType::Empty; widgets[WIDX_ENTRY_PRICE_INCREASE].type = WindowWidgetType::Empty;
@ -1186,11 +1186,11 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
} }
} }
SetWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL); SetWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL);
SetWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES); SetWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES);
SetWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION); SetWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.Park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION);
SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.ParkFlags & PARK_FLAGS_DIFFICULT_PARK_RATING); SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING);
SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION);
widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty
: WindowWidgetType::CloseBox; : WindowWidgetType::CloseBox;
@ -1243,9 +1243,9 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
auto ft = Formatter(); auto ft = Formatter();
// Pay for park and/or rides value // Pay for park and/or rides value
if (gameState.ParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES) if (gameState.Park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES)
ft.Add<StringId>(STR_PAID_ENTRY_PAID_RIDES); ft.Add<StringId>(STR_PAID_ENTRY_PAID_RIDES);
else if (gameState.ParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) else if (gameState.Park.Flags & PARK_FLAGS_PARK_FREE_ENTRY)
ft.Add<StringId>(STR_FREE_PARK_ENTER); ft.Add<StringId>(STR_FREE_PARK_ENTER);
else else
ft.Add<StringId>(STR_PAY_PARK_ENTER); ft.Add<StringId>(STR_PAY_PARK_ENTER);
@ -1263,7 +1263,7 @@ static uint32_t window_editor_scenario_options_page_hold_down_widgets[] = {
// Entry price value // Entry price value
screenCoords = windowPos + ScreenCoordsXY{ entryPriceWidget.left + 1, entryPriceWidget.top }; screenCoords = windowPos + ScreenCoordsXY{ entryPriceWidget.left + 1, entryPriceWidget.top };
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(gameState.ParkEntranceFee); ft.Add<money64>(gameState.Park.EntranceFee);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
} }

View File

@ -230,7 +230,7 @@ static Widget _windowFinancesResearchWidgets[] =
void SetDisabledTabs() void SetDisabledTabs()
{ {
disabled_widgets = (GetGameState().ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) ? (1uLL << WIDX_TAB_5) : 0; disabled_widgets = (GetGameState().Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) ? (1uLL << WIDX_TAB_5) : 0;
} }
public: public:
@ -569,7 +569,7 @@ static Widget _windowFinancesResearchWidgets[] =
// Loan and interest rate // Loan and interest rate
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 279 }, STR_FINANCES_SUMMARY_LOAN); DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 279 }, STR_FINANCES_SUMMARY_LOAN);
if (!(gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST)) if (!(gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<uint16_t>(gameState.BankLoanInterestRate); ft.Add<uint16_t>(gameState.BankLoanInterestRate);
@ -596,7 +596,7 @@ static Widget _windowFinancesResearchWidgets[] =
{ {
// Park value and company value // Park value and company value
ft = Formatter(); ft = Formatter();
ft.Add<money64>(gameState.ParkValue); ft.Add<money64>(gameState.Park.Value);
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft); DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft);
ft = Formatter(); ft = Formatter();
ft.Add<money64>(gameState.CompanyValue); ft.Add<money64>(gameState.CompanyValue);
@ -688,7 +688,7 @@ static Widget _windowFinancesResearchWidgets[] =
// Park value // Park value
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(gameState.ParkValue); ft.Add<money64>(gameState.Park.Value);
DrawTextBasic(dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, STR_FINANCES_PARK_VALUE, ft); DrawTextBasic(dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, STR_FINANCES_PARK_VALUE, ft);
// Graph // Graph
@ -698,7 +698,7 @@ static Widget _windowFinancesResearchWidgets[] =
int32_t yAxisScale = 0; int32_t yAxisScale = 0;
for (int32_t i = 0; i < 64; i++) for (int32_t i = 0; i < 64; i++)
{ {
auto balance = gameState.ParkValueHistory[i]; auto balance = gameState.Park.ValueHistory[i];
if (balance == kMoney64Undefined) if (balance == kMoney64Undefined)
continue; continue;
@ -730,7 +730,7 @@ static Widget _windowFinancesResearchWidgets[] =
// X axis labels and values // X axis labels and values
coords = graphTopLeft + ScreenCoordsXY{ 98, 17 }; coords = graphTopLeft + ScreenCoordsXY{ 98, 17 };
Graph::Draw(dpi, gameState.ParkValueHistory, 64, coords, yAxisScale, 0); Graph::Draw(dpi, gameState.Park.ValueHistory, 64, coords, yAxisScale, 0);
} }
#pragma endregion #pragma endregion

View File

@ -500,7 +500,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 }; window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 };
if (_windowFootpathCost != kMoney64Undefined) if (_windowFootpathCost != kMoney64Undefined)
{ {
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(_windowFootpathCost); ft.Add<money64>(_windowFootpathCost);

View File

@ -92,7 +92,7 @@ static Widget window_game_bottom_toolbar_widgets[] =
auto& gameState = GetGameState(); auto& gameState = GetGameState();
// Draw money // Draw money
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
Widget widget = window_game_bottom_toolbar_widgets[WIDX_MONEY]; Widget widget = window_game_bottom_toolbar_widgets[WIDX_MONEY];
auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(),
@ -143,7 +143,7 @@ static Widget window_game_bottom_toolbar_widgets[] =
Widget widget = window_game_bottom_toolbar_widgets[WIDX_PARK_RATING]; Widget widget = window_game_bottom_toolbar_widgets[WIDX_PARK_RATING];
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 }; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 };
DrawParkRating(dpi, colours[3], screenCoords, std::max(10, ((gameState.ParkRating / 4) * 263) / 256)); DrawParkRating(dpi, colours[3], screenCoords, std::max(10, ((gameState.Park.Rating / 4) * 263) / 256));
} }
} }
@ -422,7 +422,7 @@ static Widget window_game_bottom_toolbar_widgets[] =
{ {
case WIDX_LEFT_OUTSET: case WIDX_LEFT_OUTSET:
case WIDX_MONEY: case WIDX_MONEY:
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
ContextOpenWindow(WindowClass::Finances); ContextOpenWindow(WindowClass::Finances);
break; break;
case WIDX_GUESTS: case WIDX_GUESTS:
@ -478,10 +478,10 @@ static Widget window_game_bottom_toolbar_widgets[] =
{ {
case WIDX_MONEY: case WIDX_MONEY:
ft.Add<money64>(gameState.CurrentProfit); ft.Add<money64>(gameState.CurrentProfit);
ft.Add<money64>(gameState.ParkValue); ft.Add<money64>(gameState.Park.Value);
break; break;
case WIDX_PARK_RATING: case WIDX_PARK_RATING:
ft.Add<int16_t>(gameState.ParkRating); ft.Add<int16_t>(gameState.Park.Rating);
break; break;
} }
return { fallback, ft }; return { fallback, ft };
@ -504,7 +504,7 @@ static Widget window_game_bottom_toolbar_widgets[] =
+ 1; + 1;
// Reposition left widgets in accordance with line height... depending on whether there is money in play. // Reposition left widgets in accordance with line height... depending on whether there is money in play.
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
widgets[WIDX_MONEY].type = WindowWidgetType::Empty; widgets[WIDX_MONEY].type = WindowWidgetType::Empty;
widgets[WIDX_GUESTS].top = 1; widgets[WIDX_GUESTS].top = 1;

View File

@ -468,7 +468,7 @@ static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT);
if (!WidgetIsDisabled(*this, WIDX_PICKUP)) if (!WidgetIsDisabled(*this, WIDX_PICKUP))
Invalidate(); Invalidate();
} }
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
newDisabledWidgets |= (1uLL << WIDX_TAB_4); // Disable finance tab if no money newDisabledWidgets |= (1uLL << WIDX_TAB_4); // Disable finance tab if no money
} }

View File

@ -960,8 +960,8 @@ static Widget window_guest_list_widgets[] = {
static GuestItem::CompareFunc GetGuestCompareFunc() static GuestItem::CompareFunc GetGuestCompareFunc()
{ {
return GetGameState().ParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? CompareGuestItem<true> return GetGameState().Park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? CompareGuestItem<true>
: CompareGuestItem<false>; : CompareGuestItem<false>;
} }
}; };

View File

@ -264,7 +264,7 @@ static Widget window_land_widgets[] = {
screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->bottom + 5 }; screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->bottom + 5 };
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
// Draw raise cost amount // Draw raise cost amount
if (gLandToolRaiseCost != kMoney64Undefined && gLandToolRaiseCost != 0) if (gLandToolRaiseCost != kMoney64Undefined && gLandToolRaiseCost != 0)

View File

@ -230,7 +230,7 @@ static Widget window_land_rights_widgets[] = {
// Draw cost amount // Draw cost amount
if (_landRightsCost != kMoney64Undefined && _landRightsCost != 0 if (_landRightsCost != kMoney64Undefined && _landRightsCost != 0
&& !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(_landRightsCost); ft.Add<money64>(_landRightsCost);

View File

@ -343,12 +343,12 @@ static Widget window_loadsave_widgets[] =
case (LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO): case (LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO):
{ {
SetAndSaveConfigPath(gConfigGeneral.LastSaveScenarioDirectory, pathBuffer); SetAndSaveConfigPath(gConfigGeneral.LastSaveScenarioDirectory, pathBuffer);
int32_t parkFlagsBackup = gameState.ParkFlags; int32_t parkFlagsBackup = gameState.Park.Flags;
gameState.ParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED; gameState.Park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED;
gameState.EditorStep = EditorStep::Invalid; gameState.EditorStep = EditorStep::Invalid;
gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer))); gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer)));
int32_t success = ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2); int32_t success = ScenarioSave(gameState, pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2);
gameState.ParkFlags = parkFlagsBackup; gameState.Park.Flags = parkFlagsBackup;
if (success) if (success)
{ {

View File

@ -846,7 +846,7 @@ static Widget window_new_ride_widgets[] = {
widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox;
widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox;
widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WindowWidgetType::FlatBtn; widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WindowWidgetType::FlatBtn;
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::FlatBtn; widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::FlatBtn;
newWidth = 300; newWidth = 300;
@ -954,7 +954,7 @@ static Widget window_new_ride_widgets[] = {
DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ 0, 51 }, designCountStringId, ft); DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ 0, 51 }, designCountStringId, ft);
// Price // Price
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
// Get price of ride // Get price of ride
int32_t startPieceId = GetRideTypeDescriptor(item.Type).StartTrackPiece; int32_t startPieceId = GetRideTypeDescriptor(item.Type).StartTrackPiece;

View File

@ -397,7 +397,7 @@ static constexpr WindowParkAward _parkAwards[] = {
void SetDisabledTabs() void SetDisabledTabs()
{ {
// Disable price tab if money is disabled // Disable price tab if money is disabled
disabled_widgets = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? (1uLL << WIDX_TAB_4) : 0; disabled_widgets = (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) ? (1uLL << WIDX_TAB_4) : 0;
} }
void PrepareWindowTitleText() void PrepareWindowTitleText()
@ -428,10 +428,10 @@ static constexpr WindowParkAward _parkAwards[] = {
break; break;
} }
case WIDX_CLOSE_LIGHT: case WIDX_CLOSE_LIGHT:
ParkSetOpen(false); Park::SetOpen(false);
break; break;
case WIDX_OPEN_LIGHT: case WIDX_OPEN_LIGHT:
ParkSetOpen(true); Park::SetOpen(true);
break; break;
} }
} }
@ -477,11 +477,11 @@ static constexpr WindowParkAward _parkAwards[] = {
if (dropdownIndex != 0) if (dropdownIndex != 0)
{ {
ParkSetOpen(true); Park::SetOpen(true);
} }
else else
{ {
ParkSetOpen(false); Park::SetOpen(false);
} }
} }
} }
@ -532,7 +532,7 @@ static constexpr WindowParkAward _parkAwards[] = {
disabled_widgets &= ~((1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT)); disabled_widgets &= ~((1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT));
// Only allow purchase of land when there is money // Only allow purchase of land when there is money
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::Empty; widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::Empty;
else else
widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::FlatBtn;
@ -620,9 +620,9 @@ static constexpr WindowParkAward _parkAwards[] = {
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
std::optional<Focus> newFocus = std::nullopt; std::optional<Focus> newFocus = std::nullopt;
if (!gameState.ParkEntrances.empty()) if (!gameState.Park.Entrances.empty())
{ {
const auto& entrance = gameState.ParkEntrances[0]; const auto& entrance = gameState.Park.Entrances[0];
newFocus = Focus(CoordsXYZ{ entrance.x + 16, entrance.y + 16, entrance.z + 32 }); newFocus = Focus(CoordsXYZ{ entrance.x + 16, entrance.y + 16, entrance.z + 32 });
} }
@ -701,7 +701,7 @@ static constexpr WindowParkAward _parkAwards[] = {
// Current value // Current value
auto ft = Formatter(); auto ft = Formatter();
ft.Add<uint16_t>(GetGameState().ParkRating); ft.Add<uint16_t>(GetGameState().Park.Rating);
DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, ft); DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, ft);
// Graph border // Graph border
@ -730,7 +730,7 @@ static constexpr WindowParkAward _parkAwards[] = {
// Graph // Graph
screenPos = windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 }; screenPos = windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 };
Graph::Draw(dpi, GetGameState().ParkRatingHistory, kParkRatingHistorySize, screenPos); Graph::Draw(dpi, GetGameState().Park.RatingHistory, kParkRatingHistorySize, screenPos);
} }
#pragma endregion #pragma endregion
@ -836,14 +836,14 @@ static constexpr WindowParkAward _parkAwards[] = {
{ {
case WIDX_INCREASE_PRICE: case WIDX_INCREASE_PRICE:
{ {
const auto newFee = std::min(MAX_ENTRANCE_FEE, gameState.ParkEntranceFee + 1.00_GBP); const auto newFee = std::min(MAX_ENTRANCE_FEE, gameState.Park.EntranceFee + 1.00_GBP);
auto gameAction = ParkSetEntranceFeeAction(newFee); auto gameAction = ParkSetEntranceFeeAction(newFee);
GameActions::Execute(&gameAction); GameActions::Execute(&gameAction);
break; break;
} }
case WIDX_DECREASE_PRICE: case WIDX_DECREASE_PRICE:
{ {
const auto newFee = std::max(0.00_GBP, gameState.ParkEntranceFee - 1.00_GBP); const auto newFee = std::max(0.00_GBP, gameState.Park.EntranceFee - 1.00_GBP);
auto gameAction = ParkSetEntranceFeeAction(newFee); auto gameAction = ParkSetEntranceFeeAction(newFee);
GameActions::Execute(&gameAction); GameActions::Execute(&gameAction);
break; break;
@ -873,14 +873,14 @@ static constexpr WindowParkAward _parkAwards[] = {
widgets[WIDX_PRICE_LABEL].tooltip = STR_NONE; widgets[WIDX_PRICE_LABEL].tooltip = STR_NONE;
widgets[WIDX_PRICE].tooltip = STR_NONE; widgets[WIDX_PRICE].tooltip = STR_NONE;
if (!ParkEntranceFeeUnlocked()) if (!Park::EntranceFeeUnlocked())
{ {
widgets[WIDX_PRICE_LABEL].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP; widgets[WIDX_PRICE_LABEL].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP;
widgets[WIDX_PRICE].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP; widgets[WIDX_PRICE].tooltip = STR_ADMISSION_PRICE_PAY_PER_RIDE_TIP;
} }
// If the entry price is locked at free, disable the widget, unless the unlock_all_prices cheat is active. // If the entry price is locked at free, disable the widget, unless the unlock_all_prices cheat is active.
if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || !ParkEntranceFeeUnlocked()) if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) || !Park::EntranceFeeUnlocked())
{ {
widgets[WIDX_PRICE].type = WindowWidgetType::LabelCentred; widgets[WIDX_PRICE].type = WindowWidgetType::LabelCentred;
widgets[WIDX_INCREASE_PRICE].type = WindowWidgetType::Empty; widgets[WIDX_INCREASE_PRICE].type = WindowWidgetType::Empty;
@ -908,7 +908,7 @@ static constexpr WindowParkAward _parkAwards[] = {
ft.Add<money64>(GetGameState().TotalIncomeFromAdmissions); ft.Add<money64>(GetGameState().TotalIncomeFromAdmissions);
DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, ft); DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, ft);
money64 parkEntranceFee = ParkGetEntranceFee(); money64 parkEntranceFee = Park::GetEntranceFee();
auto stringId = parkEntranceFee == 0 ? STR_FREE : STR_BOTTOM_TOOLBAR_CASH; auto stringId = parkEntranceFee == 0 ? STR_FREE : STR_BOTTOM_TOOLBAR_CASH;
screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PRICE].left + 1, widgets[WIDX_PRICE].top + 1 }; screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PRICE].left + 1, widgets[WIDX_PRICE].top + 1 };
ft = Formatter(); ft = Formatter();
@ -971,7 +971,7 @@ static constexpr WindowParkAward _parkAwards[] = {
auto& gameState = GetGameState(); auto& gameState = GetGameState();
// Draw park size // Draw park size
auto parkSize = gameState.ParkSize * 10; auto parkSize = gameState.Park.Size * 10;
auto stringIndex = STR_PARK_SIZE_METRIC_LABEL; auto stringIndex = STR_PARK_SIZE_METRIC_LABEL;
if (gConfigGeneral.MeasurementFormat == MeasurementFormat::Imperial) if (gConfigGeneral.MeasurementFormat == MeasurementFormat::Imperial)
{ {
@ -1058,7 +1058,7 @@ static constexpr WindowParkAward _parkAwards[] = {
PrepareWindowTitleText(); PrepareWindowTitleText();
// Show name input button on scenario completion. // Show name input button on scenario completion.
if (GetGameState().ParkFlags & PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT) if (GetGameState().Park.Flags & PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT)
{ {
widgets[WIDX_ENTER_NAME].type = WindowWidgetType::Button; widgets[WIDX_ENTER_NAME].type = WindowWidgetType::Button;
widgets[WIDX_ENTER_NAME].top = height - 19; widgets[WIDX_ENTER_NAME].top = height - 19;

View File

@ -83,8 +83,8 @@ static Widget window_ride_refurbish_widgets[] =
auto currentRide = GetRide(rideId); auto currentRide = GetRide(rideId);
if (currentRide != nullptr) if (currentRide != nullptr)
{ {
auto stringId = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) ? STR_REFURBISH_RIDE_ID_NO_MONEY auto stringId = (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) ? STR_REFURBISH_RIDE_ID_NO_MONEY
: STR_REFURBISH_RIDE_ID_MONEY; : STR_REFURBISH_RIDE_ID_MONEY;
auto ft = Formatter(); auto ft = Formatter();
currentRide->FormatNameTo(ft); currentRide->FormatNameTo(ft);
ft.Add<money64>(_demolishRideCost / 2); ft.Add<money64>(_demolishRideCost / 2);

View File

@ -547,7 +547,7 @@ static Widget *window_research_page_widgets[] = {
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING);
if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL) if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) || gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL)
{ {
w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].type = WindowWidgetType::Empty; w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].type = WindowWidgetType::Empty;
w->widgets[WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset].type = WindowWidgetType::Empty; w->widgets[WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset].type = WindowWidgetType::Empty;
@ -591,7 +591,7 @@ static Widget *window_research_page_widgets[] = {
void WindowResearchFundingDraw(WindowBase* w, DrawPixelInfo& dpi) void WindowResearchFundingDraw(WindowBase* w, DrawPixelInfo& dpi)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
return; return;
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();

View File

@ -1281,7 +1281,7 @@ static_assert(std::size(RatingNames) == 6);
} }
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_CASH_MACHINE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_FIRST_AID) if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_CASH_MACHINE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_FIRST_AID)
|| (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0) || (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) != 0)
disabledTabs |= (1uLL << WIDX_TAB_9); // 0x1000 disabledTabs |= (1uLL << WIDX_TAB_9); // 0x1000
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) != 0) if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) != 0)
@ -6070,7 +6070,7 @@ static_assert(std::size(RatingNames) == 6);
auto rideEntry = ride->GetRideEntry(); auto rideEntry = ride->GetRideEntry();
const auto& rtd = ride->GetRideTypeDescriptor(); const auto& rtd = ride->GetRideTypeDescriptor();
return ParkRidePricesUnlocked() || rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET) return Park::RidePricesUnlocked() || rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET)
|| (rideEntry != nullptr && rideEntry->shop_item[0] != ShopItem::None); || (rideEntry != nullptr && rideEntry->shop_item[0] != ShopItem::None);
} }
@ -6245,7 +6245,7 @@ static_assert(std::size(RatingNames) == 6);
// If ride prices are locked, do not allow setting the price, unless we're dealing with a shop or toilet. // If ride prices are locked, do not allow setting the price, unless we're dealing with a shop or toilet.
const auto& rtd = ride->GetRideTypeDescriptor(); const auto& rtd = ride->GetRideTypeDescriptor();
if (!ParkRidePricesUnlocked() && rideEntry->shop_item[0] == ShopItem::None if (!Park::RidePricesUnlocked() && rideEntry->shop_item[0] == ShopItem::None
&& !rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET)) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_TOILET))
{ {
disabled_widgets |= (1uLL << WIDX_PRIMARY_PRICE); disabled_widgets |= (1uLL << WIDX_PRIMARY_PRICE);

View File

@ -1575,7 +1575,7 @@ static Widget _rideConstructionWidgets[] = {
DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE });
screenCoords.y += 11; screenCoords.y += 11;
if (_currentTrackPrice != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (_currentTrackPrice != kMoney64Undefined && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(_currentTrackPrice); ft.Add<money64>(_currentTrackPrice);

View File

@ -301,7 +301,7 @@ static Widget _rideListWidgets[] = {
int32_t selectedIndex = -1; int32_t selectedIndex = -1;
for (int32_t type = INFORMATION_TYPE_STATUS; type <= lastType; type++) for (int32_t type = INFORMATION_TYPE_STATUS; type <= lastType; type++)
{ {
if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
if (ride_info_type_money_mapping[type]) if (ride_info_type_money_mapping[type])
{ {

View File

@ -803,7 +803,7 @@ static Widget WindowSceneryBaseWidgets[] = {
} }
auto [name, price] = GetNameAndPrice(selectedSceneryEntry); auto [name, price] = GetNameAndPrice(selectedSceneryEntry);
if (price != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (price != kMoney64Undefined && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(price); ft.Add<money64>(price);

View File

@ -931,7 +931,7 @@ static Widget _staffOptionsWidgets[] = {
auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_RESIZE].left + 4, widgets[WIDX_RESIZE].top + 4 }; auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_RESIZE].left + 4, widgets[WIDX_RESIZE].top + 4 };
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(GetStaffWage(staff->AssignedStaffType)); ft.Add<money64>(GetStaffWage(staff->AssignedStaffType));

View File

@ -290,7 +290,7 @@ static Widget _staffListWidgets[] = {
DrawWidgets(dpi); DrawWidgets(dpi);
DrawTabImages(dpi); DrawTabImages(dpi);
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<money64>(GetStaffWage(GetSelectedStaffType())); ft.Add<money64>(GetStaffWage(GetSelectedStaffType()));

View File

@ -35,6 +35,7 @@
#include <openrct2/sprites.h> #include <openrct2/sprites.h>
#include <openrct2/windows/TileInspectorGlobals.h> #include <openrct2/windows/TileInspectorGlobals.h>
#include <openrct2/world/Banner.h> #include <openrct2/world/Banner.h>
#include <openrct2/world/Entrance.h>
#include <openrct2/world/Footpath.h> #include <openrct2/world/Footpath.h>
#include <openrct2/world/Park.h> #include <openrct2/world/Park.h>
#include <openrct2/world/Scenery.h> #include <openrct2/world/Scenery.h>

View File

@ -3036,7 +3036,7 @@ static Widget _topToolbarWidgets[] = {
widgets[WIDX_PAUSE].type = WindowWidgetType::Empty; widgets[WIDX_PAUSE].type = WindowWidgetType::Empty;
} }
if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) || !gConfigInterface.ToolbarShowFinances) if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) || !gConfigInterface.ToolbarShowFinances)
widgets[WIDX_FINANCES].type = WindowWidgetType::Empty; widgets[WIDX_FINANCES].type = WindowWidgetType::Empty;
if (gScreenFlags & SCREEN_FLAGS_EDITOR) if (gScreenFlags & SCREEN_FLAGS_EDITOR)

View File

@ -306,7 +306,7 @@ static Widget _trackPlaceWidgets[] = {
} }
// Price // Price
if (_placementCost != kMoney64Undefined && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (_placementCost != kMoney64Undefined && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
ft = Formatter(); ft = Formatter();
ft.Add<money64>(_placementCost); ft.Add<money64>(_placementCost);

View File

@ -156,7 +156,7 @@ static Widget _waterWidgets[] = {
dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE });
} }
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
// Draw raise cost amount // Draw raise cost amount
screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x, widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 }; screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x, widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 };

View File

@ -108,7 +108,7 @@ namespace Editor
gameStateInitAll(gameState, DEFAULT_MAP_SIZE); gameStateInitAll(gameState, DEFAULT_MAP_SIZE);
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gameState.EditorStep = EditorStep::ObjectSelection; gameState.EditorStep = EditorStep::ObjectSelection;
gameState.ParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER;
ViewportInitAll(); ViewportInitAll();
WindowBase* mainWindow = OpenEditorWindows(); WindowBase* mainWindow = OpenEditorWindows();
@ -324,18 +324,18 @@ namespace Editor
gameState.GuestChangeModifier = 0; gameState.GuestChangeModifier = 0;
if (fromSave) if (fromSave)
{ {
gameState.ParkFlags |= PARK_FLAGS_NO_MONEY; gameState.Park.Flags |= PARK_FLAGS_NO_MONEY;
if (gameState.ParkEntranceFee == 0) if (gameState.Park.EntranceFee == 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
} }
gameState.ParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED; gameState.Park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED;
gameState.GuestInitialCash = std::clamp(gameState.GuestInitialCash, 10.00_GBP, MAX_ENTRANCE_FEE); gameState.GuestInitialCash = std::clamp(gameState.GuestInitialCash, 10.00_GBP, MAX_ENTRANCE_FEE);
@ -500,18 +500,18 @@ namespace Editor
ResultWithMessage CheckPark() ResultWithMessage CheckPark()
{ {
auto& gameState = GetGameState(); auto& gameState = GetGameState();
int32_t parkSize = ParkUpdateSize(gameState); int32_t parkSize = Park::UpdateSize(gameState);
if (parkSize == 0) if (parkSize == 0)
{ {
return { false, STR_PARK_MUST_OWN_SOME_LAND }; return { false, STR_PARK_MUST_OWN_SOME_LAND };
} }
if (gameState.ParkEntrances.empty()) if (gameState.Park.Entrances.empty())
{ {
return { false, STR_NO_PARK_ENTRANCES }; return { false, STR_NO_PARK_ENTRANCES };
} }
for (const auto& parkEntrance : gameState.ParkEntrances) for (const auto& parkEntrance : gameState.Park.Entrances)
{ {
int32_t direction = DirectionReverse(parkEntrance.direction); int32_t direction = DirectionReverse(parkEntrance.direction);

View File

@ -70,7 +70,7 @@ namespace OpenRCT2
gameState.CurrentTicks = 0; gameState.CurrentTicks = 0;
MapInit(mapSize); MapInit(mapSize);
ParkInitialise(gameState); Park::Initialise(gameState);
FinanceInit(); FinanceInit();
BannerInit(gameState); BannerInit(gameState);
RideInitAll(); RideInitAll();
@ -344,7 +344,7 @@ namespace OpenRCT2
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
{ {
ParkUpdate(gameState, gameState.Date); Park::Update(gameState, gameState.Date);
} }
ResearchUpdate(); ResearchUpdate();

View File

@ -34,29 +34,18 @@
namespace OpenRCT2 namespace OpenRCT2
{ {
struct Park;
struct GameState_t struct GameState_t
{ {
::OpenRCT2::Park Park{}; ::OpenRCT2::Park::ParkData Park{};
std::string PluginStorage; std::string PluginStorage;
uint32_t CurrentTicks{}; uint32_t CurrentTicks{};
::OpenRCT2::Date Date; ::OpenRCT2::Date Date;
uint64_t ParkFlags;
uint16_t ParkRating;
money64 ParkEntranceFee;
std::vector<CoordsXYZD> ParkEntrances;
uint32_t ParkSize;
int16_t ParkRatingCasualtyPenalty;
money64 ParkValue;
money64 ParkValueHistory[FINANCE_GRAPH_SIZE];
money64 CompanyValue; money64 CompanyValue;
// The total profit for the entire scenario that precedes the current financial table. // The total profit for the entire scenario that precedes the current financial table.
money64 HistoricalProfit; money64 HistoricalProfit;
money64 ConstructionRightsPrice; money64 ConstructionRightsPrice;
money64 CurrentExpenditure; money64 CurrentExpenditure;
money64 CurrentProfit; money64 CurrentProfit;
uint8_t ParkRatingHistory[kParkRatingHistorySize];
uint32_t GuestsInParkHistory[32]; uint32_t GuestsInParkHistory[32];
ClimateType Climate; ClimateType Climate;
ClimateState ClimateCurrent; ClimateState ClimateCurrent;

View File

@ -228,7 +228,7 @@ GameActions::Result CheatSetAction::Execute() const
gameState.ScenarioObjective.Type = OBJECTIVE_HAVE_FUN; gameState.ScenarioObjective.Type = OBJECTIVE_HAVE_FUN;
break; break;
case CheatType::SetForcedParkRating: case CheatType::SetForcedParkRating:
ParkSetForcedRating(_param1); Park::SetForcedRating(_param1);
break; break;
case CheatType::AllowArbitraryRideTypeChanges: case CheatType::AllowArbitraryRideTypeChanges:
GetGameState().Cheats.AllowArbitraryRideTypeChanges = _param1 != 0; GetGameState().Cheats.AllowArbitraryRideTypeChanges = _param1 != 0;
@ -562,11 +562,11 @@ void CheatSetAction::SetScenarioNoMoney(bool enabled) const
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (enabled) if (enabled)
{ {
gameState.ParkFlags |= PARK_FLAGS_NO_MONEY; gameState.Park.Flags |= PARK_FLAGS_NO_MONEY;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_NO_MONEY; gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY;
} }
// Invalidate all windows that have anything to do with finance // Invalidate all windows that have anything to do with finance
@ -609,7 +609,7 @@ void CheatSetAction::GenerateGuests(int32_t count) const
{ {
for (int32_t i = 0; i < count; i++) for (int32_t i = 0; i < count; i++)
{ {
GenerateGuest(); Park::GenerateGuest();
} }
WindowInvalidateByClass(WindowClass::BottomToolbar); WindowInvalidateByClass(WindowClass::BottomToolbar);
} }
@ -766,7 +766,7 @@ void CheatSetAction::OwnAllLand() const
if (destOwnership != OWNERSHIP_UNOWNED) if (destOwnership != OWNERSHIP_UNOWNED)
{ {
surfaceElement->SetOwnership(destOwnership); surfaceElement->SetOwnership(destOwnership);
ParkUpdateFencesAroundTile(coords); Park::UpdateFencesAroundTile(coords);
MapInvalidateTile({ coords, baseZ, baseZ + 16 }); MapInvalidateTile({ coords, baseZ, baseZ + 16 });
} }
} }
@ -779,7 +779,7 @@ void CheatSetAction::OwnAllLand() const
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->SetOwnership(OWNERSHIP_UNOWNED); surfaceElement->SetOwnership(OWNERSHIP_UNOWNED);
ParkUpdateFencesAroundTile(spawn); Park::UpdateFencesAroundTile(spawn);
uint16_t baseZ = surfaceElement->GetBaseZ(); uint16_t baseZ = surfaceElement->GetBaseZ();
MapInvalidateTile({ spawn, baseZ, baseZ + 16 }); MapInvalidateTile({ spawn, baseZ, baseZ + 16 });
} }

View File

@ -143,7 +143,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY&
if (isExecuting) if (isExecuting)
{ {
surfaceElement->SetOwnership(OWNERSHIP_OWNED); surfaceElement->SetOwnership(OWNERSHIP_OWNED);
ParkUpdateFencesAroundTile(loc); Park::UpdateFencesAroundTile(loc);
} }
res.Cost = GetGameState().LandPrice; res.Cost = GetGameState().LandPrice;
return res; return res;

View File

@ -56,7 +56,7 @@ void LandSetHeightAction::Serialise(DataSerialiser& stream)
GameActions::Result LandSetHeightAction::Query() const GameActions::Result LandSetHeightAction::Query() const
{ {
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) if (gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)
{ {
return GameActions::Result(GameActions::Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY, STR_NONE); return GameActions::Result(GameActions::Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY, STR_NONE);
} }
@ -78,7 +78,7 @@ GameActions::Result LandSetHeightAction::Query() const
money64 sceneryRemovalCost = 0; money64 sceneryRemovalCost = 0;
if (!GetGameState().Cheats.DisableClearanceChecks) if (!GetGameState().Cheats.DisableClearanceChecks)
{ {
if (gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) if (gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{ {
// Check for obstructing large trees // Check for obstructing large trees
TileElement* tileElement = CheckTreeObstructions(); TileElement* tileElement = CheckTreeObstructions();

View File

@ -129,7 +129,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY&
{ {
surfaceElement->SetOwnership( surfaceElement->SetOwnership(
surfaceElement->GetOwnership() & ~(OWNERSHIP_OWNED | OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)); surfaceElement->GetOwnership() & ~(OWNERSHIP_OWNED | OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED));
ParkUpdateFencesAroundTile(loc); Park::UpdateFencesAroundTile(loc);
} }
return res; return res;
case LandSetRightSetting::UnownConstructionRights: case LandSetRightSetting::UnownConstructionRights:
@ -199,7 +199,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY&
gameState.PeepSpawns.end()); gameState.PeepSpawns.end());
} }
surfaceElement->SetOwnership(_ownership); surfaceElement->SetOwnership(_ownership);
ParkUpdateFencesAroundTile(loc); Park::UpdateFencesAroundTile(loc);
gMapLandRightsUpdateSuccess = true; gMapLandRightsUpdateSuccess = true;
} }
return res; return res;

View File

@ -97,7 +97,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode) if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{ {
if (sceneryEntry->HasFlag(LARGE_SCENERY_FLAG_IS_TREE)) if (sceneryEntry->HasFlag(LARGE_SCENERY_FLAG_IS_TREE))
{ {

View File

@ -73,7 +73,7 @@ GameActions::Result MapChangeSizeAction::Execute() const
auto* ctx = OpenRCT2::GetContext(); auto* ctx = OpenRCT2::GetContext();
auto uiContext = ctx->GetUiContext(); auto uiContext = ctx->GetUiContext();
auto* windowManager = uiContext->GetWindowManager(); auto* windowManager = uiContext->GetWindowManager();
ParkUpdateSize(gameState); OpenRCT2::Park::UpdateSize(gameState);
windowManager->BroadcastIntent(Intent(INTENT_ACTION_MAP)); windowManager->BroadcastIntent(Intent(INTENT_ACTION_MAP));
GfxInvalidateScreen(); GfxInvalidateScreen();

View File

@ -75,7 +75,7 @@ GameActions::Result ParkEntrancePlaceAction::Query() const
} }
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
if (gameState.ParkEntrances.size() >= OpenRCT2::Limits::MaxParkEntrances) if (gameState.Park.Entrances.size() >= OpenRCT2::Limits::MaxParkEntrances)
{ {
return GameActions::Result( return GameActions::Result(
GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES); GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES);
@ -121,7 +121,7 @@ GameActions::Result ParkEntrancePlaceAction::Execute() const
uint32_t flags = GetFlags(); uint32_t flags = GetFlags();
GetGameState().ParkEntrances.push_back(_loc); GetGameState().Park.Entrances.push_back(_loc);
auto zLow = _loc.z; auto zLow = _loc.z;
auto zHigh = zLow + ParkEntranceHeight; auto zHigh = zLow + ParkEntranceHeight;
@ -170,11 +170,11 @@ GameActions::Result ParkEntrancePlaceAction::Execute() const
FootpathConnectEdges(entranceLoc, entranceElement->as<TileElement>(), GAME_COMMAND_FLAG_APPLY); FootpathConnectEdges(entranceLoc, entranceElement->as<TileElement>(), GAME_COMMAND_FLAG_APPLY);
} }
ParkUpdateFences(entranceLoc); Park::UpdateFences(entranceLoc);
ParkUpdateFences({ entranceLoc.x - COORDS_XY_STEP, entranceLoc.y }); Park::UpdateFences({ entranceLoc.x - COORDS_XY_STEP, entranceLoc.y });
ParkUpdateFences({ entranceLoc.x + COORDS_XY_STEP, entranceLoc.y }); Park::UpdateFences({ entranceLoc.x + COORDS_XY_STEP, entranceLoc.y });
ParkUpdateFences({ entranceLoc.x, entranceLoc.y - COORDS_XY_STEP }); Park::UpdateFences({ entranceLoc.x, entranceLoc.y - COORDS_XY_STEP });
ParkUpdateFences({ entranceLoc.x, entranceLoc.y + COORDS_XY_STEP }); Park::UpdateFences({ entranceLoc.x, entranceLoc.y + COORDS_XY_STEP });
MapInvalidateTile({ entranceLoc, entranceElement->GetBaseZ(), entranceElement->GetClearanceZ() }); MapInvalidateTile({ entranceLoc, entranceElement->GetBaseZ(), entranceElement->GetClearanceZ() });

View File

@ -78,7 +78,7 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const
} }
auto& gameState = GetGameState(); auto& gameState = GetGameState();
auto direction = (gameState.ParkEntrances[entranceIndex].direction - 1) & 3; auto direction = (gameState.Park.Entrances[entranceIndex].direction - 1) & 3;
// Centre (sign) // Centre (sign)
ParkEntranceRemoveSegment(_loc); ParkEntranceRemoveSegment(_loc);
@ -91,7 +91,7 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const
ParkEntranceRemoveSegment( ParkEntranceRemoveSegment(
{ _loc.x - CoordsDirectionDelta[direction].x, _loc.y - CoordsDirectionDelta[direction].y, _loc.z }); { _loc.x - CoordsDirectionDelta[direction].x, _loc.y - CoordsDirectionDelta[direction].y, _loc.z });
gameState.ParkEntrances.erase(gameState.ParkEntrances.begin() + entranceIndex); gameState.Park.Entrances.erase(gameState.Park.Entrances.begin() + entranceIndex);
return res; return res;
} }
@ -105,5 +105,5 @@ void ParkEntranceRemoveAction::ParkEntranceRemoveSegment(const CoordsXYZ& loc) c
MapInvalidateTile({ loc, entranceElement->GetBaseZ(), entranceElement->GetClearanceZ() }); MapInvalidateTile({ loc, entranceElement->GetBaseZ(), entranceElement->GetClearanceZ() });
entranceElement->Remove(); entranceElement->Remove();
ParkUpdateFences({ loc.x, loc.y }); Park::UpdateFences({ loc.x, loc.y });
} }

View File

@ -56,7 +56,7 @@ GameActions::Result ParkMarketingAction::Query() const
return GameActions::Result( return GameActions::Result(
GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_ERR_VALUE_OUT_OF_RANGE); GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_ERR_VALUE_OUT_OF_RANGE);
} }
if (GetGameState().ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN)
{ {
return GameActions::Result( return GameActions::Result(
GameActions::Status::Disallowed, STR_CANT_START_MARKETING_CAMPAIGN, GameActions::Status::Disallowed, STR_CANT_START_MARKETING_CAMPAIGN,

View File

@ -42,12 +42,12 @@ void ParkSetEntranceFeeAction::Serialise(DataSerialiser& stream)
GameActions::Result ParkSetEntranceFeeAction::Query() const GameActions::Result ParkSetEntranceFeeAction::Query() const
{ {
if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0) if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) != 0)
{ {
LOG_ERROR("Can't set park entrance fee because the park has no money"); LOG_ERROR("Can't set park entrance fee because the park has no money");
return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE); return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE);
} }
else if (!ParkEntranceFeeUnlocked()) else if (!Park::EntranceFeeUnlocked())
{ {
LOG_ERROR("Park entrance fee is locked"); LOG_ERROR("Park entrance fee is locked");
return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE); return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE);
@ -64,7 +64,7 @@ GameActions::Result ParkSetEntranceFeeAction::Query() const
GameActions::Result ParkSetEntranceFeeAction::Execute() const GameActions::Result ParkSetEntranceFeeAction::Execute() const
{ {
GetGameState().ParkEntranceFee = _fee; GetGameState().Park.EntranceFee = _fee;
WindowInvalidateByClass(WindowClass::ParkInformation); WindowInvalidateByClass(WindowClass::ParkInformation);
return GameActions::Result(); return GameActions::Result();
} }

View File

@ -60,16 +60,16 @@ GameActions::Result ParkSetParameterAction::Execute() const
switch (_parameter) switch (_parameter)
{ {
case ParkParameter::Close: case ParkParameter::Close:
if (gameState.ParkFlags & PARK_FLAGS_PARK_OPEN) if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN)
{ {
gameState.ParkFlags &= ~PARK_FLAGS_PARK_OPEN; gameState.Park.Flags &= ~PARK_FLAGS_PARK_OPEN;
WindowInvalidateByClass(WindowClass::ParkInformation); WindowInvalidateByClass(WindowClass::ParkInformation);
} }
break; break;
case ParkParameter::Open: case ParkParameter::Open:
if (!(gameState.ParkFlags & PARK_FLAGS_PARK_OPEN)) if (!(gameState.Park.Flags & PARK_FLAGS_PARK_OPEN))
{ {
gameState.ParkFlags |= PARK_FLAGS_PARK_OPEN; gameState.Park.Flags |= PARK_FLAGS_PARK_OPEN;
WindowInvalidateByClass(WindowClass::ParkInformation); WindowInvalidateByClass(WindowClass::ParkInformation);
} }
break; break;

View File

@ -207,7 +207,7 @@ GameActions::Result RideCreateAction::Execute() const
ride->excitement = kRideRatingUndefined; ride->excitement = kRideRatingUndefined;
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
for (auto i = 0; i < RCT2::ObjectLimits::MaxShopItemsPerRideEntry; i++) for (auto i = 0; i < RCT2::ObjectLimits::MaxShopItemsPerRideEntry; i++)
{ {
@ -216,7 +216,7 @@ GameActions::Result RideCreateAction::Execute() const
if (rideEntry->shop_item[0] == ShopItem::None) if (rideEntry->shop_item[0] == ShopItem::None)
{ {
if (!ParkRidePricesUnlocked() || gameState.ParkEntranceFee > 0) if (!Park::RidePricesUnlocked() || gameState.Park.EntranceFee > 0)
{ {
ride->price[0] = 0; ride->price[0] = 0;
} }

View File

@ -156,7 +156,7 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride& ride) const
} }
ride.Delete(); ride.Delete();
GetGameState().ParkValue = CalculateParkValue(); GetGameState().Park.Value = Park::CalculateParkValue();
// Close windows related to the demolished ride // Close windows related to the demolished ride
WindowCloseByNumber(WindowClass::RideConstruction, rideId.ToUnderlying()); WindowCloseByNumber(WindowClass::RideConstruction, rideId.ToUnderlying());

View File

@ -57,22 +57,22 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
{ {
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_NO_MONEY; gameState.Park.Flags |= PARK_FLAGS_NO_MONEY;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_NO_MONEY; gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY;
} }
} }
else else
{ {
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_NO_MONEY; gameState.Park.Flags |= PARK_FLAGS_NO_MONEY;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_NO_MONEY; gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY;
} }
// Invalidate all windows that have anything to do with finance // Invalidate all windows that have anything to do with finance
WindowInvalidateByClass(WindowClass::Ride); WindowInvalidateByClass(WindowClass::Ride);
@ -106,11 +106,11 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
case ScenarioSetSetting::ForbidMarketingCampaigns: case ScenarioSetSetting::ForbidMarketingCampaigns:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN; gameState.Park.Flags |= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_FORBID_MARKETING_CAMPAIGN; gameState.Park.Flags &= ~PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
} }
break; break;
case ScenarioSetSetting::AverageCashPerGuest: case ScenarioSetSetting::AverageCashPerGuest:
@ -128,21 +128,21 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
case ScenarioSetSetting::GuestsPreferLessIntenseRides: case ScenarioSetSetting::GuestsPreferLessIntenseRides:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_PREF_LESS_INTENSE_RIDES; gameState.Park.Flags |= PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_PREF_LESS_INTENSE_RIDES; gameState.Park.Flags &= ~PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
} }
break; break;
case ScenarioSetSetting::GuestsPreferMoreIntenseRides: case ScenarioSetSetting::GuestsPreferMoreIntenseRides:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_PREF_MORE_INTENSE_RIDES; gameState.Park.Flags |= PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_PREF_MORE_INTENSE_RIDES; gameState.Park.Flags &= ~PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
} }
break; break;
case ScenarioSetSetting::CostToBuyLand: case ScenarioSetSetting::CostToBuyLand:
@ -156,96 +156,96 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
{ {
if (_value == 0) if (_value == 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY;
gameState.ParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
gameState.ParkEntranceFee = 0.00_GBP; gameState.Park.EntranceFee = 0.00_GBP;
} }
else if (_value == 1) else if (_value == 1)
{ {
gameState.ParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
gameState.ParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
gameState.ParkEntranceFee = 10.00_GBP; gameState.Park.EntranceFee = 10.00_GBP;
} }
else else
{ {
gameState.ParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY;
gameState.ParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
gameState.ParkEntranceFee = 10.00_GBP; gameState.Park.EntranceFee = 10.00_GBP;
} }
} }
else else
{ {
if (_value == 0) if (_value == 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY;
gameState.ParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
} }
else if (_value == 1) else if (_value == 1)
{ {
gameState.ParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
gameState.ParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
} }
else else
{ {
gameState.ParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY;
gameState.ParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
} }
WindowInvalidateByClass(WindowClass::ParkInformation); WindowInvalidateByClass(WindowClass::ParkInformation);
WindowInvalidateByClass(WindowClass::Ride); WindowInvalidateByClass(WindowClass::Ride);
} }
break; break;
case ScenarioSetSetting::ParkChargeEntryFee: case ScenarioSetSetting::ParkChargeEntryFee:
gameState.ParkEntranceFee = std::clamp<money64>(_value, 0.00_GBP, MAX_ENTRANCE_FEE); gameState.Park.EntranceFee = std::clamp<money64>(_value, 0.00_GBP, MAX_ENTRANCE_FEE);
WindowInvalidateByClass(WindowClass::ParkInformation); WindowInvalidateByClass(WindowClass::ParkInformation);
break; break;
case ScenarioSetSetting::ForbidTreeRemoval: case ScenarioSetSetting::ForbidTreeRemoval:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_FORBID_TREE_REMOVAL; gameState.Park.Flags |= PARK_FLAGS_FORBID_TREE_REMOVAL;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_FORBID_TREE_REMOVAL; gameState.Park.Flags &= ~PARK_FLAGS_FORBID_TREE_REMOVAL;
} }
break; break;
case ScenarioSetSetting::ForbidLandscapeChanges: case ScenarioSetSetting::ForbidLandscapeChanges:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES; gameState.Park.Flags |= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_FORBID_LANDSCAPE_CHANGES; gameState.Park.Flags &= ~PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
} }
break; break;
case ScenarioSetSetting::ForbidHighConstruction: case ScenarioSetSetting::ForbidHighConstruction:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; gameState.Park.Flags |= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; gameState.Park.Flags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
} }
break; break;
case ScenarioSetSetting::ParkRatingHigherDifficultyLevel: case ScenarioSetSetting::ParkRatingHigherDifficultyLevel:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_DIFFICULT_PARK_RATING; gameState.Park.Flags |= PARK_FLAGS_DIFFICULT_PARK_RATING;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_DIFFICULT_PARK_RATING; gameState.Park.Flags &= ~PARK_FLAGS_DIFFICULT_PARK_RATING;
} }
break; break;
case ScenarioSetSetting::GuestGenerationHigherDifficultyLevel: case ScenarioSetSetting::GuestGenerationHigherDifficultyLevel:
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_DIFFICULT_GUEST_GENERATION; gameState.Park.Flags |= PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_DIFFICULT_GUEST_GENERATION; gameState.Park.Flags &= ~PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
} }
break; break;
case ScenarioSetSetting::AllowEarlyCompletion: case ScenarioSetSetting::AllowEarlyCompletion:
@ -255,11 +255,11 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
{ {
if (_value != 0) if (_value != 0)
{ {
gameState.ParkFlags |= PARK_FLAGS_RCT1_INTEREST; gameState.Park.Flags |= PARK_FLAGS_RCT1_INTEREST;
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_RCT1_INTEREST; gameState.Park.Flags &= ~PARK_FLAGS_RCT1_INTEREST;
} }
break; break;
} }

View File

@ -79,7 +79,7 @@ GameActions::Result SmallSceneryRemoveAction::Query() const
&& !GetGameState().Cheats.SandboxMode) && !GetGameState().Cheats.SandboxMode)
{ {
// Check if allowed to remove item // Check if allowed to remove item
if (GetGameState().ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{ {
if (entry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE)) if (entry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE))
{ {

View File

@ -288,10 +288,10 @@ void StaffHireNewAction::AutoPositionNewStaff(Peep* newPeep) const
{ {
// No walking guests; pick random park entrance // No walking guests; pick random park entrance
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
if (!gameState.ParkEntrances.empty()) if (!gameState.Park.Entrances.empty())
{ {
auto rand = ScenarioRandMax(static_cast<uint32_t>(gameState.ParkEntrances.size())); auto rand = ScenarioRandMax(static_cast<uint32_t>(gameState.Park.Entrances.size()));
const auto& entrance = gameState.ParkEntrances[rand]; const auto& entrance = gameState.Park.Entrances[rand];
auto dir = entrance.direction; auto dir = entrance.direction;
newLocation = entrance; newLocation = entrance;
// TODO: Replace with CoordsDirectionDelta // TODO: Replace with CoordsDirectionDelta

View File

@ -86,7 +86,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const
// Do nothing if not in editor, sandbox mode or landscaping is forbidden // Do nothing if not in editor, sandbox mode or landscaping is forbidden
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode
&& (GetGameState().ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)) && (GetGameState().Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES))
{ {
return GameActions::Result( return GameActions::Result(
GameActions::Status::Disallowed, STR_CANT_CHANGE_LAND_TYPE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY); GameActions::Status::Disallowed, STR_CANT_CHANGE_LAND_TYPE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);

View File

@ -49,7 +49,7 @@ GameActions::Result WaterSetHeightAction::Query() const
res.Position = { _coords, _height * COORDS_Z_STEP }; res.Position = { _coords, _height * COORDS_Z_STEP };
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.SandboxMode
&& GetGameState().ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) && GetGameState().Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)
{ {
return GameActions::Result(GameActions::Status::Disallowed, STR_NONE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY); return GameActions::Result(GameActions::Status::Disallowed, STR_NONE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
} }

View File

@ -1075,7 +1075,7 @@ void Guest::Tick128UpdateGuest(uint32_t index)
possible_thoughts[num_thoughts++] = PeepThoughtType::Toilet; possible_thoughts[num_thoughts++] = PeepThoughtType::Toilet;
} }
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) && CashInPocket <= 9.00_GBP && Happiness >= 105 if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) && CashInPocket <= 9.00_GBP && Happiness >= 105
&& Energy >= 70) && Energy >= 70)
{ {
/* The energy check was originally a second check on happiness. /* The energy check was originally a second check on happiness.
@ -1539,7 +1539,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price)
if (!hasVoucher) if (!hasVoucher)
{ {
if (price != 0 && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (price != 0 && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
if (CashInPocket == 0) if (CashInPocket == 0)
{ {
@ -1586,7 +1586,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price)
itemValue -= price; itemValue -= price;
itemValue = std::max(0.80_GBP, itemValue); itemValue = std::max(0.80_GBP, itemValue);
if (!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
if (itemValue >= static_cast<money64>(ScenarioRand() & 0x07)) if (itemValue >= static_cast<money64>(ScenarioRand() & 0x07))
{ {
@ -1694,7 +1694,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price)
expenditure = ExpenditureType::FoodDrinkStock; expenditure = ExpenditureType::FoodDrinkStock;
} }
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
FinancePayment(shopItemDescriptor.Cost, expenditure); FinancePayment(shopItemDescriptor.Cost, expenditure);
// Sets the expenditure type to *_FOODDRINK_SALES or *_SHOP_SALES appropriately. // Sets the expenditure type to *_FOODDRINK_SALES or *_SHOP_SALES appropriately.
@ -1704,7 +1704,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price)
RemoveItem(ShopItem::Voucher); RemoveItem(ShopItem::Voucher);
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY; WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
} }
else if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) else if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
SpendMoney(*expend_type, price, expenditure); SpendMoney(*expend_type, price, expenditure);
} }
@ -2006,7 +2006,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b
auto& gameState = GetGameState(); auto& gameState = GetGameState();
// Basic price checks // Basic price checks
if (ridePrice != 0 && !PeepHasVoucherForFreeRide(this, ride) && !(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) if (ridePrice != 0 && !PeepHasVoucherForFreeRide(this, ride) && !(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
if (ridePrice > CashInPocket) if (ridePrice > CashInPocket)
{ {
@ -2155,7 +2155,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b
// If the value of the ride hasn't yet been calculated, peeps will be willing to pay any amount for the ride. // If the value of the ride hasn't yet been calculated, peeps will be willing to pay any amount for the ride.
if (value != RIDE_VALUE_UNDEFINED && !PeepHasVoucherForFreeRide(this, ride) if (value != RIDE_VALUE_UNDEFINED && !PeepHasVoucherForFreeRide(this, ride)
&& !(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) && !(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
// The amount peeps are willing to pay is decreased by 75% if they had to pay to enter the park. // The amount peeps are willing to pay is decreased by 75% if they had to pay to enter the park.
if (PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY) if (PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY)
@ -2181,7 +2181,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b
// A ride is good value if the price is 50% or less of the ride value and the peep didn't pay to enter the park. // A ride is good value if the price is 50% or less of the ride value and the peep didn't pay to enter the park.
if (ridePrice <= (value / 2) && peepAtRide) if (ridePrice <= (value / 2) && peepAtRide)
{ {
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
if (!(PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY)) if (!(PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY))
{ {
@ -2300,7 +2300,7 @@ void Guest::SpendMoney(money64 amount, ExpenditureType expenditure)
*/ */
void Guest::SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureType expenditure) void Guest::SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureType expenditure)
{ {
assert(!(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)); assert(!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY));
CashInPocket = std::max(0.00_GBP, static_cast<money64>(CashInPocket) - amount); CashInPocket = std::max(0.00_GBP, static_cast<money64>(CashInPocket) - amount);
CashSpent += amount; CashSpent += amount;
@ -2615,7 +2615,7 @@ static bool PeepCheckRidePriceAtEntrance(Guest* peep, const Ride& ride, money64
&& peep->VoucherRideId == peep->CurrentRide) && peep->VoucherRideId == peep->CurrentRide)
return true; return true;
if (peep->CashInPocket <= 0 && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (peep->CashInPocket <= 0 && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
peep->InsertNewThought(PeepThoughtType::SpentMoney); peep->InsertNewThought(PeepThoughtType::SpentMoney);
PeepUpdateRideAtEntranceTryLeave(peep); PeepUpdateRideAtEntranceTryLeave(peep);
@ -2709,7 +2709,7 @@ static void PeepUpdateFavouriteRide(Guest* peep, const Ride& ride)
/* rct2: 0x00695555 */ /* rct2: 0x00695555 */
static int16_t PeepCalculateRideValueSatisfaction(Guest* peep, const Ride& ride) static int16_t PeepCalculateRideValueSatisfaction(Guest* peep, const Ride& ride)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
return -30; return -30;
} }
@ -2883,7 +2883,7 @@ static bool PeepShouldGoOnRideAgain(Guest* peep, const Ride& ride)
static bool PeepShouldPreferredIntensityIncrease(Guest* peep) static bool PeepShouldPreferredIntensityIncrease(Guest* peep)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) if (GetGameState().Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES)
return false; return false;
if (peep->Happiness < 200) if (peep->Happiness < 200)
return false; return false;
@ -3068,7 +3068,7 @@ static void PeepDecideWhetherToLeavePark(Guest* peep)
* in the park. */ * in the park. */
if (!(peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK)) if (!(peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK))
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
if (peep->Energy >= 70 && peep->Happiness >= 60) if (peep->Energy >= 70 && peep->Happiness >= 60)
{ {
@ -3298,7 +3298,7 @@ void Guest::StopPurchaseThought(ride_type_t rideType)
*/ */
static bool PeepShouldUseCashMachine(Guest* peep, RideId rideIndex) static bool PeepShouldUseCashMachine(Guest* peep, RideId rideIndex)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
return false; return false;
if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK)
return false; return false;
@ -7141,9 +7141,9 @@ Guest* Guest::Generate(const CoordsXYZ& coords)
/* Check which intensity boxes are enabled /* Check which intensity boxes are enabled
* and apply the appropriate intensity settings. */ * and apply the appropriate intensity settings. */
if (gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) if (gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES)
{ {
if (gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) if (gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES)
{ {
intensityLowest = 0; intensityLowest = 0;
intensityHighest = 15; intensityHighest = 15;
@ -7154,7 +7154,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords)
intensityHighest = 4; intensityHighest = 4;
} }
} }
else if (gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) else if (gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES)
{ {
intensityLowest = 9; intensityLowest = 9;
intensityHighest = 15; intensityHighest = 15;
@ -7163,7 +7163,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords)
peep->Intensity = IntensityRange(intensityLowest, intensityHighest); peep->Intensity = IntensityRange(intensityLowest, intensityHighest);
uint8_t nauseaTolerance = ScenarioRand() & 0x7; uint8_t nauseaTolerance = ScenarioRand() & 0x7;
if (gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) if (gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES)
{ {
nauseaTolerance += 4; nauseaTolerance += 4;
} }
@ -7220,7 +7220,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords)
cash = 500; cash = 500;
} }
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
cash = 0; cash = 0;
} }

View File

@ -718,7 +718,7 @@ void Peep::UpdateFalling()
} }
auto& gameState = GetGameState(); auto& gameState = GetGameState();
gameState.ParkRatingCasualtyPenalty = std::min(gameState.ParkRatingCasualtyPenalty + 25, 1000); gameState.Park.RatingCasualtyPenalty = std::min(gameState.Park.RatingCasualtyPenalty + 25, 1000);
Remove(); Remove();
return; return;
} }
@ -1538,7 +1538,7 @@ void Peep::FormatNameTo(Formatter& ft) const
ft.Add<StringId>(_staffNames[staffNameIndex]); ft.Add<StringId>(_staffNames[staffNameIndex]);
ft.Add<uint32_t>(PeepId); ft.Add<uint32_t>(PeepId);
} }
else if (GetGameState().ParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) else if (GetGameState().Park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
{ {
auto realNameStringId = GetRealNameStringIDFromPeepID(PeepId); auto realNameStringId = GetRealNameStringIDFromPeepID(PeepId);
ft.Add<StringId>(realNameStringId); ft.Add<StringId>(realNameStringId);
@ -1805,7 +1805,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
if (!(guest->PeepFlags & PEEP_FLAGS_LEAVING_PARK)) if (!(guest->PeepFlags & PEEP_FLAGS_LEAVING_PARK))
{ {
// If the park is open and leaving flag isn't set return to centre // If the park is open and leaving flag isn't set return to centre
if (gameState.ParkFlags & PARK_FLAGS_PARK_OPEN) if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN)
{ {
PeepReturnToCentreOfTile(guest); PeepReturnToCentreOfTile(guest);
return true; return true;
@ -1838,7 +1838,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
return true; return true;
} }
if (!(gameState.ParkFlags & PARK_FLAGS_PARK_OPEN)) if (!(gameState.Park.Flags & PARK_FLAGS_PARK_OPEN))
{ {
guest->State = PeepState::LeavingPark; guest->State = PeepState::LeavingPark;
guest->Var37 = 1; guest->Var37 = 1;
@ -1849,10 +1849,10 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
} }
bool found = false; bool found = false;
auto entrance = std::find_if(gameState.ParkEntrances.begin(), gameState.ParkEntrances.end(), [coords](const auto& e) { auto entrance = std::find_if(gameState.Park.Entrances.begin(), gameState.Park.Entrances.end(), [coords](const auto& e) {
return coords.ToTileStart() == e; return coords.ToTileStart() == e;
}); });
if (entrance != gameState.ParkEntrances.end()) if (entrance != gameState.Park.Entrances.end())
{ {
int16_t z = entrance->z / 8; int16_t z = entrance->z / 8;
entranceDirection = entrance->direction; entranceDirection = entrance->direction;
@ -1911,7 +1911,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
return true; return true;
} }
auto entranceFee = ParkGetEntranceFee(); auto entranceFee = Park::GetEntranceFee();
if (entranceFee != 0) if (entranceFee != 0)
{ {
if (guest->HasItem(ShopItem::Voucher)) if (guest->HasItem(ShopItem::Voucher))
@ -2287,7 +2287,7 @@ static bool PeepInteractWithShop(Peep* peep, const CoordsXYE& coords)
} }
auto cost = ride->price[0]; auto cost = ride->price[0];
if (cost != 0 && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (cost != 0 && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
ride->total_profit += cost; ride->total_profit += cost;
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME;
@ -2552,7 +2552,7 @@ int32_t PeepCompare(const EntityId sprite_index_a, const EntityId sprite_index_b
if (peep_a->Name == nullptr && peep_b->Name == nullptr) if (peep_a->Name == nullptr && peep_b->Name == nullptr)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) if (GetGameState().Park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
{ {
// Potentially could find a more optional way of sorting dynamic real names // Potentially could find a more optional way of sorting dynamic real names
} }
@ -2585,12 +2585,12 @@ void PeepUpdateNames(bool realNames)
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (realNames) if (realNames)
{ {
gameState.ParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
// Peep names are now dynamic // Peep names are now dynamic
} }
else else
{ {
gameState.ParkFlags &= ~PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.Park.Flags &= ~PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
// Peep names are now dynamic // Peep names are now dynamic
} }

View File

@ -557,11 +557,11 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
{ {
if (argv[0] == "park_rating") if (argv[0] == "park_rating")
{ {
console.WriteFormatLine("park_rating %d", gameState.ParkRating); console.WriteFormatLine("park_rating %d", gameState.Park.Rating);
} }
else if (argv[0] == "park_value") else if (argv[0] == "park_value")
{ {
console.WriteFormatLine("park_value %d", gameState.ParkValue / 10); console.WriteFormatLine("park_value %d", gameState.Park.Value / 10);
} }
else if (argv[0] == "company_value") else if (argv[0] == "company_value")
{ {
@ -597,7 +597,7 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
{ {
console.WriteFormatLine("guest_initial_happiness %d%% (%d)", 15, gameState.GuestInitialHappiness); console.WriteFormatLine("guest_initial_happiness %d%% (%d)", 15, gameState.GuestInitialHappiness);
} }
else if (current_happiness == CalculateGuestInitialHappiness(i)) else if (current_happiness == Park::CalculateGuestInitialHappiness(i))
{ {
console.WriteFormatLine("guest_initial_happiness %d%% (%d)", i, gameState.GuestInitialHappiness); console.WriteFormatLine("guest_initial_happiness %d%% (%d)", i, gameState.GuestInitialHappiness);
break; break;
@ -619,52 +619,52 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
else if (argv[0] == "guest_prefer_less_intense_rides") else if (argv[0] == "guest_prefer_less_intense_rides")
{ {
console.WriteFormatLine( console.WriteFormatLine(
"guest_prefer_less_intense_rides %d", (gameState.ParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) != 0); "guest_prefer_less_intense_rides %d", (gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) != 0);
} }
else if (argv[0] == "guest_prefer_more_intense_rides") else if (argv[0] == "guest_prefer_more_intense_rides")
{ {
console.WriteFormatLine( console.WriteFormatLine(
"guest_prefer_more_intense_rides %d", (gameState.ParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) != 0); "guest_prefer_more_intense_rides %d", (gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) != 0);
} }
else if (argv[0] == "forbid_marketing_campaigns") else if (argv[0] == "forbid_marketing_campaigns")
{ {
console.WriteFormatLine( console.WriteFormatLine(
"forbid_marketing_campaigns %d", (gameState.ParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) != 0); "forbid_marketing_campaigns %d", (gameState.Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) != 0);
} }
else if (argv[0] == "forbid_landscape_changes") else if (argv[0] == "forbid_landscape_changes")
{ {
console.WriteFormatLine( console.WriteFormatLine(
"forbid_landscape_changes %d", (gameState.ParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) != 0); "forbid_landscape_changes %d", (gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) != 0);
} }
else if (argv[0] == "forbid_tree_removal") else if (argv[0] == "forbid_tree_removal")
{ {
console.WriteFormatLine("forbid_tree_removal %d", (gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) != 0); console.WriteFormatLine("forbid_tree_removal %d", (gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) != 0);
} }
else if (argv[0] == "forbid_high_construction") else if (argv[0] == "forbid_high_construction")
{ {
console.WriteFormatLine( console.WriteFormatLine(
"forbid_high_construction %d", (gameState.ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION) != 0); "forbid_high_construction %d", (gameState.Park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION) != 0);
} }
else if (argv[0] == "pay_for_rides") else if (argv[0] == "pay_for_rides")
{ {
console.WriteFormatLine("pay_for_rides %d", (gameState.ParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) != 0); console.WriteFormatLine("pay_for_rides %d", (gameState.Park.Flags & PARK_FLAGS_PARK_FREE_ENTRY) != 0);
} }
else if (argv[0] == "no_money") else if (argv[0] == "no_money")
{ {
console.WriteFormatLine("no_money %d", (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) != 0); console.WriteFormatLine("no_money %d", (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) != 0);
} }
else if (argv[0] == "difficult_park_rating") else if (argv[0] == "difficult_park_rating")
{ {
console.WriteFormatLine("difficult_park_rating %d", (gameState.ParkFlags & PARK_FLAGS_DIFFICULT_PARK_RATING) != 0); console.WriteFormatLine("difficult_park_rating %d", (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING) != 0);
} }
else if (argv[0] == "difficult_guest_generation") else if (argv[0] == "difficult_guest_generation")
{ {
console.WriteFormatLine( console.WriteFormatLine(
"difficult_guest_generation %d", (gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0); "difficult_guest_generation %d", (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0);
} }
else if (argv[0] == "park_open") else if (argv[0] == "park_open")
{ {
console.WriteFormatLine("park_open %d", (gameState.ParkFlags & PARK_FLAGS_PARK_OPEN) != 0); console.WriteFormatLine("park_open %d", (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) != 0);
} }
else if (argv[0] == "land_rights_cost") else if (argv[0] == "land_rights_cost")
{ {
@ -850,7 +850,8 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t&
else if (argv[0] == "guest_initial_happiness" && InvalidArguments(&invalidArgs, int_valid[0])) else if (argv[0] == "guest_initial_happiness" && InvalidArguments(&invalidArgs, int_valid[0]))
{ {
auto scenarioSetSetting = ScenarioSetSettingAction( auto scenarioSetSetting = ScenarioSetSettingAction(
ScenarioSetSetting::GuestInitialHappiness, CalculateGuestInitialHappiness(static_cast<uint8_t>(int_val[0]))); ScenarioSetSetting::GuestInitialHappiness,
Park::CalculateGuestInitialHappiness(static_cast<uint8_t>(int_val[0])));
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) { scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
if (res->Error != GameActions::Status::Ok) if (res->Error != GameActions::Status::Ok)
console.WriteLineError("set guest_initial_happiness command failed, likely due to permissions."); console.WriteLineError("set guest_initial_happiness command failed, likely due to permissions.");
@ -951,7 +952,7 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t&
} }
else if (argv[0] == "pay_for_rides" && InvalidArguments(&invalidArgs, int_valid[0])) else if (argv[0] == "pay_for_rides" && InvalidArguments(&invalidArgs, int_valid[0]))
{ {
SET_FLAG(gameState.ParkFlags, PARK_FLAGS_PARK_FREE_ENTRY, int_val[0]); SET_FLAG(gameState.Park.Flags, PARK_FLAGS_PARK_FREE_ENTRY, int_val[0]);
console.Execute("get pay_for_rides"); console.Execute("get pay_for_rides");
} }
else if (argv[0] == "no_money" && InvalidArguments(&invalidArgs, int_valid[0])) else if (argv[0] == "no_money" && InvalidArguments(&invalidArgs, int_valid[0]))

View File

@ -176,13 +176,13 @@ static bool AwardIsDeservedBestValue(int32_t activeAwardTypes)
if (activeAwardTypes & EnumToFlag(AwardType::MostDisappointing)) if (activeAwardTypes & EnumToFlag(AwardType::MostDisappointing))
return false; return false;
if ((gameState.ParkFlags & PARK_FLAGS_NO_MONEY) || !ParkEntranceFeeUnlocked()) if ((gameState.Park.Flags & PARK_FLAGS_NO_MONEY) || !Park::EntranceFeeUnlocked())
return false; return false;
if (gameState.TotalRideValueForMoney < 10.00_GBP) if (gameState.TotalRideValueForMoney < 10.00_GBP)
return false; return false;
if (ParkGetEntranceFee() + 0.10_GBP >= gameState.TotalRideValueForMoney / 2) if (Park::GetEntranceFee() + 0.10_GBP >= gameState.TotalRideValueForMoney / 2)
return false; return false;
return true; return true;
@ -228,10 +228,10 @@ static bool AwardIsDeservedWorstValue(int32_t activeAwardTypes)
if (activeAwardTypes & EnumToFlag(AwardType::BestValue)) if (activeAwardTypes & EnumToFlag(AwardType::BestValue))
return false; return false;
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
return false; return false;
const auto parkEntranceFee = ParkGetEntranceFee(); const auto parkEntranceFee = Park::GetEntranceFee();
if (parkEntranceFee == 0.00_GBP) if (parkEntranceFee == 0.00_GBP)
return false; return false;
if (parkEntranceFee <= gameState.TotalRideValueForMoney) if (parkEntranceFee <= gameState.TotalRideValueForMoney)
@ -407,7 +407,7 @@ static bool AwardIsDeservedMostDisappointing(int32_t activeAwardTypes)
{ {
if (activeAwardTypes & EnumToFlag(AwardType::BestValue)) if (activeAwardTypes & EnumToFlag(AwardType::BestValue))
return false; return false;
if (GetGameState().ParkRating > 650) if (GetGameState().Park.Rating > 650)
return false; return false;
// Count the number of disappointing rides // Count the number of disappointing rides
@ -622,7 +622,7 @@ void AwardUpdateAll()
} }
// Only add new awards if park is open // Only add new awards if park is open
if (GetGameState().ParkFlags & PARK_FLAGS_PARK_OPEN) if (GetGameState().Park.Flags & PARK_FLAGS_PARK_OPEN)
{ {
// Set active award types as flags // Set active award types as flags
int32_t activeAwardTypes = 0; int32_t activeAwardTypes = 0;

View File

@ -47,7 +47,7 @@ static constexpr int32_t dword_988E60[EnumValue(ExpenditureType::Count)] = {
*/ */
bool FinanceCheckMoneyRequired(uint32_t flags) bool FinanceCheckMoneyRequired(uint32_t flags)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
return false; return false;
if (gScreenFlags & SCREEN_FLAGS_EDITOR) if (gScreenFlags & SCREEN_FLAGS_EDITOR)
return false; return false;
@ -99,7 +99,7 @@ void FinancePayWages()
{ {
PROFILED_FUNCTION(); PROFILED_FUNCTION();
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
return; return;
} }
@ -117,7 +117,7 @@ void FinancePayWages()
void FinancePayResearch() void FinancePayResearch()
{ {
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
return; return;
} }
@ -134,7 +134,7 @@ void FinancePayInterest()
{ {
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
return; return;
} }
@ -143,7 +143,7 @@ void FinancePayInterest()
// that will overflow money64 if the loan is greater than (1 << 31) / (5 * current_interest_rate) // that will overflow money64 if the loan is greater than (1 << 31) / (5 * current_interest_rate)
const money64 current_loan = gameState.BankLoan; const money64 current_loan = gameState.BankLoan;
const auto current_interest_rate = gameState.BankLoanInterestRate; const auto current_interest_rate = gameState.BankLoanInterestRate;
const money64 interest_to_pay = (gameState.ParkFlags & PARK_FLAGS_RCT1_INTEREST) const money64 interest_to_pay = (gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST)
? (current_loan / 2400) ? (current_loan / 2400)
: (current_loan * 5 * current_interest_rate) >> 14; : (current_loan * 5 * current_interest_rate) >> 14;
@ -165,7 +165,7 @@ void FinancePayRideUpkeep()
ride.Renew(); ride.Renew();
} }
if (ride.status != RideStatus::Closed && !(GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY)) if (ride.status != RideStatus::Closed && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
auto upkeep = ride.upkeep_cost; auto upkeep = ride.upkeep_cost;
if (upkeep != kMoney64Undefined) if (upkeep != kMoney64Undefined)
@ -190,7 +190,7 @@ void FinanceResetHistory()
{ {
gameState.CashHistory[i] = kMoney64Undefined; gameState.CashHistory[i] = kMoney64Undefined;
gameState.WeeklyProfitHistory[i] = kMoney64Undefined; gameState.WeeklyProfitHistory[i] = kMoney64Undefined;
gameState.ParkValueHistory[i] = kMoney64Undefined; gameState.Park.ValueHistory[i] = kMoney64Undefined;
} }
for (uint32_t i = 0; i < EXPENDITURE_TABLE_MONTH_COUNT; ++i) for (uint32_t i = 0; i < EXPENDITURE_TABLE_MONTH_COUNT; ++i)
@ -229,7 +229,7 @@ void FinanceInit()
gameState.MaxBankLoan = 20000.00_GBP; gameState.MaxBankLoan = 20000.00_GBP;
gameState.BankLoanInterestRate = 10; gameState.BankLoanInterestRate = 10;
gameState.ParkValue = 0; gameState.Park.Value = 0;
gameState.CompanyValue = 0; gameState.CompanyValue = 0;
gameState.HistoricalProfit = 0; gameState.HistoricalProfit = 0;
gameState.ScenarioCompletedCompanyValue = kMoney64Undefined; gameState.ScenarioCompletedCompanyValue = kMoney64Undefined;
@ -252,7 +252,7 @@ void FinanceUpdateDailyProfit()
money64 current_profit = 0; money64 current_profit = 0;
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
// Staff costs // Staff costs
for (auto peep : EntityList<Staff>()) for (auto peep : EntityList<Staff>())
@ -372,4 +372,4 @@ money64 FinanceGetLastMonthShopProfit()
profit += lastMonthExpenditure[EnumValue(ExpenditureType::FoodDrinkStock)]; profit += lastMonthExpenditure[EnumValue(ExpenditureType::FoodDrinkStock)];
} }
return profit; return profit;
} }

View File

@ -53,11 +53,11 @@ uint16_t MarketingGetCampaignGuestGenerationProbability(int32_t campaignType)
switch (campaign->Type) switch (campaign->Type)
{ {
case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE: case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE:
if (ParkGetEntranceFee() < 4.00_GBP) if (Park::GetEntranceFee() < 4.00_GBP)
probability /= 8; probability /= 8;
break; break;
case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE:
if (ParkGetEntranceFee() < 6.00_GBP) if (Park::GetEntranceFee() < 6.00_GBP)
probability /= 8; probability /= 8;
break; break;
case ADVERTISING_CAMPAIGN_RIDE_FREE: case ADVERTISING_CAMPAIGN_RIDE_FREE:
@ -177,12 +177,12 @@ bool MarketingIsCampaignTypeApplicable(int32_t campaignType)
{ {
case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE: case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE:
case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE:
if (!ParkEntranceFeeUnlocked()) if (!Park::EntranceFeeUnlocked())
return false; return false;
return true; return true;
case ADVERTISING_CAMPAIGN_RIDE_FREE: case ADVERTISING_CAMPAIGN_RIDE_FREE:
if (!ParkRidePricesUnlocked()) if (!Park::RidePricesUnlocked())
return false; return false;
// fall-through // fall-through

View File

@ -315,7 +315,7 @@ void ResearchUpdate()
return; return;
} }
if ((gameState.ParkFlags & PARK_FLAGS_NO_MONEY) && gameState.ResearchFundingLevel == RESEARCH_FUNDING_NONE) if ((gameState.Park.Flags & PARK_FLAGS_NO_MONEY) && gameState.ResearchFundingLevel == RESEARCH_FUNDING_NONE)
{ {
researchLevel = RESEARCH_FUNDING_NORMAL; researchLevel = RESEARCH_FUNDING_NORMAL;
} }

View File

@ -309,10 +309,10 @@ private:
{ "day", date.GetMonthTicks() }, { "day", date.GetMonthTicks() },
{ "month", date.GetMonthsElapsed() }, { "month", date.GetMonthsElapsed() },
{ "guests", gameState.NumGuestsInPark }, { "guests", gameState.NumGuestsInPark },
{ "parkValue", gameState.ParkValue }, { "parkValue", gameState.Park.Value },
}; };
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY)) if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
{ {
gameInfo["cash"] = gameState.Cash; gameInfo["cash"] = gameState.Cash;
} }

View File

@ -220,7 +220,7 @@ static void PaintParkEntranceScrollingText(
return; return;
auto ft = Formatter(); auto ft = Formatter();
if (GetGameState().ParkFlags & PARK_FLAGS_PARK_OPEN) if (GetGameState().Park.Flags & PARK_FLAGS_PARK_OPEN)
{ {
const auto& park = OpenRCT2::GetGameState().Park; const auto& park = OpenRCT2::GetGameState().Park;
auto name = park.Name.c_str(); auto name = park.Name.c_str();

View File

@ -798,16 +798,16 @@ namespace OpenRCT2
cs.ReadWrite(gameState.BankLoan); cs.ReadWrite(gameState.BankLoan);
cs.ReadWrite(gameState.MaxBankLoan); cs.ReadWrite(gameState.MaxBankLoan);
cs.ReadWrite(gameState.BankLoanInterestRate); cs.ReadWrite(gameState.BankLoanInterestRate);
cs.ReadWrite(gameState.ParkFlags); cs.ReadWrite(gameState.Park.Flags);
if (version <= 18) if (version <= 18)
{ {
money16 tempParkEntranceFee{}; money16 tempParkEntranceFee{};
cs.ReadWrite(tempParkEntranceFee); cs.ReadWrite(tempParkEntranceFee);
gameState.ParkEntranceFee = ToMoney64(tempParkEntranceFee); gameState.Park.EntranceFee = ToMoney64(tempParkEntranceFee);
} }
else else
{ {
cs.ReadWrite(gameState.ParkEntranceFee); cs.ReadWrite(gameState.Park.EntranceFee);
} }
cs.ReadWrite(gameState.StaffHandymanColour); cs.ReadWrite(gameState.StaffHandymanColour);
@ -877,13 +877,13 @@ namespace OpenRCT2
cs.ReadWrite(award.Type); cs.ReadWrite(award.Type);
}); });
} }
cs.ReadWrite(gameState.ParkValue); cs.ReadWrite(gameState.Park.Value);
cs.ReadWrite(gameState.CompanyValue); cs.ReadWrite(gameState.CompanyValue);
cs.ReadWrite(gameState.ParkSize); cs.ReadWrite(gameState.Park.Size);
cs.ReadWrite(gameState.NumGuestsInPark); cs.ReadWrite(gameState.NumGuestsInPark);
cs.ReadWrite(gameState.NumGuestsHeadingForPark); cs.ReadWrite(gameState.NumGuestsHeadingForPark);
cs.ReadWrite(gameState.ParkRating); cs.ReadWrite(gameState.Park.Rating);
cs.ReadWrite(gameState.ParkRatingCasualtyPenalty); cs.ReadWrite(gameState.Park.RatingCasualtyPenalty);
cs.ReadWrite(gameState.CurrentExpenditure); cs.ReadWrite(gameState.CurrentExpenditure);
cs.ReadWrite(gameState.CurrentProfit); cs.ReadWrite(gameState.CurrentProfit);
cs.ReadWrite(gameState.WeeklyProfitAverageDividend); cs.ReadWrite(gameState.WeeklyProfitAverageDividend);
@ -910,7 +910,7 @@ namespace OpenRCT2
return true; return true;
}); });
cs.ReadWriteArray(gameState.ParkRatingHistory, [&cs](uint8_t& value) { cs.ReadWriteArray(gameState.Park.RatingHistory, [&cs](uint8_t& value) {
cs.ReadWrite(value); cs.ReadWrite(value);
return true; return true;
}); });
@ -928,7 +928,7 @@ namespace OpenRCT2
cs.ReadWrite(value); cs.ReadWrite(value);
return true; return true;
}); });
cs.ReadWriteArray(gameState.ParkValueHistory, [&cs](money64& value) { cs.ReadWriteArray(gameState.Park.ValueHistory, [&cs](money64& value) {
cs.ReadWrite(value); cs.ReadWrite(value);
return true; return true;
}); });

View File

@ -1548,7 +1548,7 @@ namespace OpenRCT2::PathFinding
{ {
std::optional<CoordsXYZ> chosenEntrance = std::nullopt; std::optional<CoordsXYZ> chosenEntrance = std::nullopt;
uint16_t nearestDist = 0xFFFF; uint16_t nearestDist = 0xFFFF;
for (const auto& parkEntrance : GetGameState().ParkEntrances) for (const auto& parkEntrance : GetGameState().Park.Entrances)
{ {
auto dist = abs(parkEntrance.x - loc.x) + abs(parkEntrance.y - loc.y); auto dist = abs(parkEntrance.x - loc.x) + abs(parkEntrance.y - loc.y);
if (dist < nearestDist) if (dist < nearestDist)

View File

@ -275,7 +275,7 @@ namespace RCT1
{ {
// Use the ratio between the old and new park value to calcute the ratio to // Use the ratio between the old and new park value to calcute the ratio to
// use for the park value history and the goal. // use for the park value history and the goal.
_parkValueConversionFactor = (CalculateParkValue() * 10) / _s4.ParkValue; _parkValueConversionFactor = (Park::CalculateParkValue() * 10) / _s4.ParkValue;
} }
else else
{ {
@ -327,7 +327,7 @@ namespace RCT1
// Do map initialisation, same kind of stuff done when loading scenario editor // Do map initialisation, same kind of stuff done when loading scenario editor
gameStateInitAll(gameState, { mapSize, mapSize }); gameStateInitAll(gameState, { mapSize, mapSize });
gameState.EditorStep = EditorStep::ObjectSelection; gameState.EditorStep = EditorStep::ObjectSelection;
gameState.ParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER;
} }
@ -1423,7 +1423,7 @@ namespace RCT1
void ImportFinance(GameState_t& gameState) void ImportFinance(GameState_t& gameState)
{ {
gameState.ParkEntranceFee = _s4.ParkEntranceFee; gameState.Park.EntranceFee = _s4.ParkEntranceFee;
gameState.LandPrice = ToMoney64(_s4.LandPrice); gameState.LandPrice = ToMoney64(_s4.LandPrice);
gameState.ConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice); gameState.ConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice);
@ -1435,13 +1435,13 @@ namespace RCT1
gameState.InitialCash = ToMoney64(_s4.Cash); gameState.InitialCash = ToMoney64(_s4.Cash);
gameState.CompanyValue = ToMoney64(_s4.CompanyValue); gameState.CompanyValue = ToMoney64(_s4.CompanyValue);
gameState.ParkValue = CorrectRCT1ParkValue(_s4.ParkValue); gameState.Park.Value = CorrectRCT1ParkValue(_s4.ParkValue);
gameState.CurrentProfit = ToMoney64(_s4.Profit); gameState.CurrentProfit = ToMoney64(_s4.Profit);
for (size_t i = 0; i < Limits::FinanceGraphSize; i++) for (size_t i = 0; i < Limits::FinanceGraphSize; i++)
{ {
gameState.CashHistory[i] = ToMoney64(_s4.CashHistory[i]); gameState.CashHistory[i] = ToMoney64(_s4.CashHistory[i]);
gameState.ParkValueHistory[i] = CorrectRCT1ParkValue(_s4.ParkValueHistory[i]); gameState.Park.ValueHistory[i] = CorrectRCT1ParkValue(_s4.ParkValueHistory[i]);
gameState.WeeklyProfitHistory[i] = ToMoney64(_s4.WeeklyProfitHistory[i]); gameState.WeeklyProfitHistory[i] = ToMoney64(_s4.WeeklyProfitHistory[i]);
} }
@ -2146,10 +2146,10 @@ namespace RCT1
gameState.Date = Date{ _s4.Month, _s4.Day }; gameState.Date = Date{ _s4.Month, _s4.Day };
// Park rating // Park rating
gameState.ParkRating = _s4.ParkRating; gameState.Park.Rating = _s4.ParkRating;
ResetParkHistories(gameState); Park::ResetHistories(gameState);
std::copy(std::begin(_s4.ParkRatingHistory), std::end(_s4.ParkRatingHistory), gameState.ParkRatingHistory); std::copy(std::begin(_s4.ParkRatingHistory), std::end(_s4.ParkRatingHistory), gameState.Park.RatingHistory);
for (size_t i = 0; i < std::size(_s4.GuestsInParkHistory); i++) for (size_t i = 0; i < std::size(_s4.GuestsInParkHistory); i++)
{ {
if (_s4.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined) if (_s4.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined)
@ -2222,17 +2222,17 @@ namespace RCT1
gameState.StaffSecurityColour = RCT1::GetColour(_s4.SecurityGuardColour); gameState.StaffSecurityColour = RCT1::GetColour(_s4.SecurityGuardColour);
// Flags // Flags
gameState.ParkFlags = _s4.ParkFlags; gameState.Park.Flags = _s4.ParkFlags;
gameState.ParkFlags &= ~PARK_FLAGS_ANTI_CHEAT_DEPRECATED; gameState.Park.Flags &= ~PARK_FLAGS_ANTI_CHEAT_DEPRECATED;
gameState.ParkFlags |= PARK_FLAGS_RCT1_INTEREST; gameState.Park.Flags |= PARK_FLAGS_RCT1_INTEREST;
// Loopy Landscape parks can set a flag to lock the entry price to free. // Loopy Landscape parks can set a flag to lock the entry price to free.
// If this flag is not set, the player can ask money for both rides and entry. // If this flag is not set, the player can ask money for both rides and entry.
if (!(_s4.ParkFlags & RCT1_PARK_FLAGS_PARK_ENTRY_LOCKED_AT_FREE)) if (!(_s4.ParkFlags & RCT1_PARK_FLAGS_PARK_ENTRY_LOCKED_AT_FREE))
{ {
gameState.ParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
} }
gameState.ParkSize = _s4.ParkSize; gameState.Park.Size = _s4.ParkSize;
gameState.TotalRideValueForMoney = _s4.TotalRideValueForMoney; gameState.TotalRideValueForMoney = _s4.TotalRideValueForMoney;
gameState.SamePriceThroughoutPark = 0; gameState.SamePriceThroughoutPark = 0;
if (_gameVersion == FILE_VERSION_RCT1_LL) if (_gameVersion == FILE_VERSION_RCT1_LL)
@ -2444,10 +2444,10 @@ namespace RCT1
void FixEntrancePositions() void FixEntrancePositions()
{ {
auto& gameState = GetGameState(); auto& gameState = GetGameState();
gameState.ParkEntrances.clear(); gameState.Park.Entrances.clear();
TileElementIterator it; TileElementIterator it;
TileElementIteratorBegin(&it); TileElementIteratorBegin(&it);
while (TileElementIteratorNext(&it) && gameState.ParkEntrances.size() < Limits::MaxParkEntrances) while (TileElementIteratorNext(&it) && gameState.Park.Entrances.size() < Limits::MaxParkEntrances)
{ {
TileElement* element = it.element; TileElement* element = it.element;
@ -2459,7 +2459,7 @@ namespace RCT1
continue; continue;
CoordsXYZD entrance = { TileCoordsXY(it.x, it.y).ToCoordsXY(), element->GetBaseZ(), element->GetDirection() }; CoordsXYZD entrance = { TileCoordsXY(it.x, it.y).ToCoordsXY(), element->GetBaseZ(), element->GetDirection() };
gameState.ParkEntrances.push_back(entrance); gameState.Park.Entrances.push_back(entrance);
} }
} }

View File

@ -263,18 +263,18 @@ namespace RCT2
gameState.InitialCash = ToMoney64(_s6.InitialCash); gameState.InitialCash = ToMoney64(_s6.InitialCash);
gameState.BankLoan = ToMoney64(_s6.CurrentLoan); gameState.BankLoan = ToMoney64(_s6.CurrentLoan);
gameState.ParkFlags = _s6.ParkFlags & ~PARK_FLAGS_NO_MONEY_SCENARIO; gameState.Park.Flags = _s6.ParkFlags & ~PARK_FLAGS_NO_MONEY_SCENARIO;
// RCT2 used a different flag for `no money` when the park is a scenario // RCT2 used a different flag for `no money` when the park is a scenario
if (_s6.Header.Type == S6_TYPE_SCENARIO) if (_s6.Header.Type == S6_TYPE_SCENARIO)
{ {
if (_s6.ParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) if (_s6.ParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO)
gameState.ParkFlags |= PARK_FLAGS_NO_MONEY; gameState.Park.Flags |= PARK_FLAGS_NO_MONEY;
else else
gameState.ParkFlags &= ~PARK_FLAGS_NO_MONEY; gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY;
} }
gameState.ParkEntranceFee = _s6.ParkEntranceFee; gameState.Park.EntranceFee = _s6.ParkEntranceFee;
// rct1_park_entranceX // rct1_park_entranceX
// rct1_park_entrance_y // rct1_park_entrance_y
// Pad013573EE // Pad013573EE
@ -305,10 +305,10 @@ namespace RCT2
gameState.StaffMechanicColour = _s6.MechanicColour; gameState.StaffMechanicColour = _s6.MechanicColour;
gameState.StaffSecurityColour = _s6.SecurityColour; gameState.StaffSecurityColour = _s6.SecurityColour;
gameState.ParkRating = _s6.ParkRating; gameState.Park.Rating = _s6.ParkRating;
ResetParkHistories(gameState); Park::ResetHistories(gameState);
std::copy(std::begin(_s6.ParkRatingHistory), std::end(_s6.ParkRatingHistory), gameState.ParkRatingHistory); std::copy(std::begin(_s6.ParkRatingHistory), std::end(_s6.ParkRatingHistory), gameState.Park.RatingHistory);
for (size_t i = 0; i < std::size(_s6.GuestsInParkHistory); i++) for (size_t i = 0; i < std::size(_s6.GuestsInParkHistory); i++)
{ {
if (_s6.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined) if (_s6.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined)
@ -336,7 +336,7 @@ namespace RCT2
gameState.ResearchExpectedDay = _s6.NextResearchExpectedDay; gameState.ResearchExpectedDay = _s6.NextResearchExpectedDay;
gameState.ResearchExpectedMonth = _s6.NextResearchExpectedMonth; gameState.ResearchExpectedMonth = _s6.NextResearchExpectedMonth;
gameState.GuestInitialHappiness = _s6.GuestInitialHappiness; gameState.GuestInitialHappiness = _s6.GuestInitialHappiness;
gameState.ParkSize = _s6.ParkSize; gameState.Park.Size = _s6.ParkSize;
gameState.GuestGenerationProbability = _s6.GuestGenerationProbability; gameState.GuestGenerationProbability = _s6.GuestGenerationProbability;
gameState.TotalRideValueForMoney = _s6.TotalRideValueForMoney; gameState.TotalRideValueForMoney = _s6.TotalRideValueForMoney;
gameState.MaxBankLoan = ToMoney64(_s6.MaximumLoan); gameState.MaxBankLoan = ToMoney64(_s6.MaximumLoan);
@ -361,13 +361,13 @@ namespace RCT2
gameState.WeeklyProfitAverageDivisor = _s6.WeeklyProfitAverageDivisor; gameState.WeeklyProfitAverageDivisor = _s6.WeeklyProfitAverageDivisor;
// Pad0135833A // Pad0135833A
gameState.ParkValue = ToMoney64(_s6.ParkValue); gameState.Park.Value = ToMoney64(_s6.ParkValue);
for (size_t i = 0; i < Limits::FinanceGraphSize; i++) for (size_t i = 0; i < Limits::FinanceGraphSize; i++)
{ {
gameState.CashHistory[i] = ToMoney64(_s6.BalanceHistory[i]); gameState.CashHistory[i] = ToMoney64(_s6.BalanceHistory[i]);
gameState.WeeklyProfitHistory[i] = ToMoney64(_s6.WeeklyProfitHistory[i]); gameState.WeeklyProfitHistory[i] = ToMoney64(_s6.WeeklyProfitHistory[i]);
gameState.ParkValueHistory[i] = ToMoney64(_s6.ParkValueHistory[i]); gameState.Park.ValueHistory[i] = ToMoney64(_s6.ParkValueHistory[i]);
} }
gameState.ScenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s6.CompletedCompanyValue); gameState.ScenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s6.CompletedCompanyValue);
@ -400,7 +400,7 @@ namespace RCT2
gameState.ScenarioCompletedBy = std::string_view(_s6.ScenarioCompletedName, sizeof(_s6.ScenarioCompletedName)); gameState.ScenarioCompletedBy = std::string_view(_s6.ScenarioCompletedName, sizeof(_s6.ScenarioCompletedName));
gameState.Cash = ToMoney64(DECRYPT_MONEY(_s6.Cash)); gameState.Cash = ToMoney64(DECRYPT_MONEY(_s6.Cash));
// Pad013587FC // Pad013587FC
gameState.ParkRatingCasualtyPenalty = _s6.ParkRatingCasualtyPenalty; gameState.Park.RatingCasualtyPenalty = _s6.ParkRatingCasualtyPenalty;
gameState.MapSize = { _s6.MapSize, _s6.MapSize }; gameState.MapSize = { _s6.MapSize, _s6.MapSize };
gameState.SamePriceThroughoutPark = _s6.SamePriceThroughout gameState.SamePriceThroughoutPark = _s6.SamePriceThroughout
| (static_cast<uint64_t>(_s6.SamePriceThroughoutExtended) << 32); | (static_cast<uint64_t>(_s6.SamePriceThroughoutExtended) << 32);
@ -413,7 +413,7 @@ namespace RCT2
gameState.BankLoanInterestRate = _s6.CurrentInterestRate; gameState.BankLoanInterestRate = _s6.CurrentInterestRate;
// Pad0135934B // Pad0135934B
// Preserve compatibility with vanilla RCT2's save format. // Preserve compatibility with vanilla RCT2's save format.
gameState.ParkEntrances.clear(); gameState.Park.Entrances.clear();
for (uint8_t i = 0; i < Limits::MaxParkEntrances; i++) for (uint8_t i = 0; i < Limits::MaxParkEntrances; i++)
{ {
if (_s6.ParkEntranceX[i] != LOCATION_NULL) if (_s6.ParkEntranceX[i] != LOCATION_NULL)
@ -423,7 +423,7 @@ namespace RCT2
entrance.y = _s6.ParkEntranceY[i]; entrance.y = _s6.ParkEntranceY[i];
entrance.z = _s6.ParkEntranceZ[i]; entrance.z = _s6.ParkEntranceZ[i];
entrance.direction = _s6.ParkEntranceDirection[i]; entrance.direction = _s6.ParkEntranceDirection[i];
gameState.ParkEntrances.push_back(entrance); gameState.Park.Entrances.push_back(entrance);
} }
} }
if (_s6.Header.Type == S6_TYPE_SCENARIO) if (_s6.Header.Type == S6_TYPE_SCENARIO)

View File

@ -5321,11 +5321,11 @@ bool Ride::IsRide() const
money64 RideGetPrice(const Ride& ride) money64 RideGetPrice(const Ride& ride)
{ {
if (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)
return 0; return 0;
if (ride.IsRide()) if (ride.IsRide())
{ {
if (!ParkRidePricesUnlocked()) if (!Park::RidePricesUnlocked())
{ {
return 0; return 0;
} }

View File

@ -1942,8 +1942,8 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon
_trackDesignDrawingPreview = true; _trackDesignDrawingPreview = true;
uint8_t backup_rotation = _currentTrackPieceDirection; uint8_t backup_rotation = _currentTrackPieceDirection;
uint32_t backup_park_flags = gameState.ParkFlags; uint32_t backup_park_flags = gameState.Park.Flags;
gameState.ParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; gameState.Park.Flags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
auto mapSize = TileCoordsXY{ gameState.MapSize.x * 16, gameState.MapSize.y * 16 }; auto mapSize = TileCoordsXY{ gameState.MapSize.x * 16, gameState.MapSize.y * 16 };
_currentTrackPieceDirection = 0; _currentTrackPieceDirection = 0;
@ -1967,7 +1967,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon
auto res = TrackDesignPlaceVirtual( auto res = TrackDesignPlaceVirtual(
tds, td6, PTD_OPERATION_PLACE_TRACK_PREVIEW, placeScenery, *ride, tds, td6, PTD_OPERATION_PLACE_TRACK_PREVIEW, placeScenery, *ride,
{ mapSize.x, mapSize.y, z, _currentTrackPieceDirection }); { mapSize.x, mapSize.y, z, _currentTrackPieceDirection });
gameState.ParkFlags = backup_park_flags; gameState.Park.Flags = backup_park_flags;
if (res.Error == GameActions::Status::Ok) if (res.Error == GameActions::Status::Ok)
{ {

View File

@ -4530,9 +4530,9 @@ static void ride_train_crash(Ride& ride, uint16_t numFatalities)
} }
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkRatingCasualtyPenalty < 500) if (gameState.Park.RatingCasualtyPenalty < 500)
{ {
gameState.ParkRatingCasualtyPenalty += 200; gameState.Park.RatingCasualtyPenalty += 200;
} }
} }
} }

View File

@ -100,9 +100,9 @@ void ScenarioReset(GameState_t& gameState)
ScenerySetDefaultPlacementConfiguration(); ScenerySetDefaultPlacementConfiguration();
News::InitQueue(); News::InitQueue();
gameState.ParkRating = CalculateParkRating(); gameState.Park.Rating = Park::CalculateParkRating();
gameState.ParkValue = CalculateParkValue(); gameState.Park.Value = Park::CalculateParkValue();
gameState.CompanyValue = CalculateCompanyValue(); gameState.CompanyValue = Park::CalculateCompanyValue();
gameState.HistoricalProfit = gameState.InitialCash - gameState.BankLoan; gameState.HistoricalProfit = gameState.InitialCash - gameState.BankLoan;
gameState.Cash = gameState.InitialCash; gameState.Cash = gameState.InitialCash;
@ -140,17 +140,17 @@ void ScenarioReset(GameState_t& gameState)
gameState.TotalAdmissions = 0; gameState.TotalAdmissions = 0;
gameState.TotalIncomeFromAdmissions = 0; gameState.TotalIncomeFromAdmissions = 0;
gameState.ParkFlags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; gameState.Park.Flags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT;
gameState.ScenarioCompletedCompanyValue = kMoney64Undefined; gameState.ScenarioCompletedCompanyValue = kMoney64Undefined;
gameState.ScenarioCompletedBy = "?"; gameState.ScenarioCompletedBy = "?";
ResetParkHistories(gameState); Park::ResetHistories(gameState);
FinanceResetHistory(); FinanceResetHistory();
AwardReset(); AwardReset();
ResetAllRideBuildDates(); ResetAllRideBuildDates();
ResetDate(); ResetDate();
Duck::RemoveAll(); Duck::RemoveAll();
ParkUpdateSize(gameState); Park::UpdateSize(gameState);
MapCountRemainingLandRights(); MapCountRemainingLandRights();
Staff::ResetStats(); Staff::ResetStats();
@ -163,16 +163,16 @@ void ScenarioReset(GameState_t& gameState)
} }
gMarketingCampaigns.clear(); gMarketingCampaigns.clear();
gameState.ParkRatingCasualtyPenalty = 0; gameState.Park.RatingCasualtyPenalty = 0;
// Open park with free entry when there is no money // Open park with free entry when there is no money
if (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY)
{ {
gameState.ParkFlags |= PARK_FLAGS_PARK_OPEN; gameState.Park.Flags |= PARK_FLAGS_PARK_OPEN;
gameState.ParkEntranceFee = 0; gameState.Park.EntranceFee = 0;
} }
gameState.ParkFlags |= PARK_FLAGS_SPRITES_INITIALISED; gameState.Park.Flags |= PARK_FLAGS_SPRITES_INITIALISED;
gGamePaused = false; gGamePaused = false;
} }
@ -208,7 +208,7 @@ void ScenarioSuccess(GameState_t& gameState)
if (ScenarioRepositoryTryRecordHighscore(gScenarioFileName.c_str(), companyValue, nullptr)) if (ScenarioRepositoryTryRecordHighscore(gScenarioFileName.c_str(), companyValue, nullptr))
{ {
// Allow name entry // Allow name entry
GetGameState().ParkFlags |= PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; GetGameState().Park.Flags |= PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT;
gameState.ScenarioCompanyValueRecord = companyValue; gameState.ScenarioCompanyValueRecord = companyValue;
} }
ScenarioEnd(); ScenarioEnd();
@ -224,7 +224,7 @@ void ScenarioSuccessSubmitName(GameState_t& gameState, const char* name)
{ {
gameState.ScenarioCompletedBy = name; gameState.ScenarioCompletedBy = name;
} }
gameState.ParkFlags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; gameState.Park.Flags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT;
} }
/** /**
@ -236,11 +236,11 @@ static void ScenarioCheckEntranceFeeTooHigh()
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
const auto max_fee = AddClamp_money64(gameState.TotalRideValueForMoney, gameState.TotalRideValueForMoney / 2); const auto max_fee = AddClamp_money64(gameState.TotalRideValueForMoney, gameState.TotalRideValueForMoney / 2);
if ((gameState.ParkFlags & PARK_FLAGS_PARK_OPEN) && ParkGetEntranceFee() > max_fee) if ((gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) && Park::GetEntranceFee() > max_fee)
{ {
if (!gameState.ParkEntrances.empty()) if (!gameState.Park.Entrances.empty())
{ {
const auto& entrance = gameState.ParkEntrances[0]; const auto& entrance = gameState.Park.Entrances[0];
auto x = entrance.x + 16; auto x = entrance.x + 16;
auto y = entrance.y + 16; auto y = entrance.y + 16;
@ -308,8 +308,8 @@ static void ScenarioDayUpdate(GameState_t& gameState)
} }
// Lower the casualty penalty // Lower the casualty penalty
uint16_t casualtyPenaltyModifier = (gameState.ParkFlags & PARK_FLAGS_NO_MONEY) ? 40 : 7; uint16_t casualtyPenaltyModifier = (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) ? 40 : 7;
gameState.ParkRatingCasualtyPenalty = std::max(0, gameState.ParkRatingCasualtyPenalty - casualtyPenaltyModifier); gameState.Park.RatingCasualtyPenalty = std::max(0, gameState.Park.RatingCasualtyPenalty - casualtyPenaltyModifier);
auto intent = Intent(INTENT_ACTION_UPDATE_DATE); auto intent = Intent(INTENT_ACTION_UPDATE_DATE);
ContextBroadcastIntent(&intent); ContextBroadcastIntent(&intent);
@ -600,7 +600,7 @@ ResultWithMessage ScenarioPrepareForSave(GameState_t& gameState)
} }
if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING)
GetGameState().ParkFlags |= PARK_FLAGS_PARK_OPEN; GetGameState().Park.Flags |= PARK_FLAGS_PARK_OPEN;
ScenarioReset(gameState); ScenarioReset(gameState);
@ -609,7 +609,7 @@ ResultWithMessage ScenarioPrepareForSave(GameState_t& gameState)
ObjectiveStatus Objective::CheckGuestsBy() const ObjectiveStatus Objective::CheckGuestsBy() const
{ {
auto parkRating = GetGameState().ParkRating; auto parkRating = GetGameState().Park.Rating;
int32_t currentMonthYear = GetDate().GetMonthsElapsed(); int32_t currentMonthYear = GetDate().GetMonthsElapsed();
if (currentMonthYear == MONTH_COUNT * Year || AllowEarlyCompletion()) if (currentMonthYear == MONTH_COUNT * Year || AllowEarlyCompletion())
@ -632,7 +632,7 @@ ObjectiveStatus Objective::CheckParkValueBy() const
{ {
int32_t currentMonthYear = GetDate().GetMonthsElapsed(); int32_t currentMonthYear = GetDate().GetMonthsElapsed();
money64 objectiveParkValue = Currency; money64 objectiveParkValue = Currency;
money64 parkValue = GetGameState().ParkValue; money64 parkValue = GetGameState().Park.Value;
if (currentMonthYear == MONTH_COUNT * Year || AllowEarlyCompletion()) if (currentMonthYear == MONTH_COUNT * Year || AllowEarlyCompletion())
{ {
@ -689,7 +689,7 @@ ObjectiveStatus Objective::Check10RollerCoasters() const
ObjectiveStatus Objective::CheckGuestsAndRating() const ObjectiveStatus Objective::CheckGuestsAndRating() const
{ {
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkRating < 700 && GetDate().GetMonthsElapsed() >= 1) if (gameState.Park.Rating < 700 && GetDate().GetMonthsElapsed() >= 1)
{ {
gameState.ScenarioParkRatingWarningDays++; gameState.ScenarioParkRatingWarningDays++;
if (gameState.ScenarioParkRatingWarningDays == 1) if (gameState.ScenarioParkRatingWarningDays == 1)
@ -723,7 +723,7 @@ ObjectiveStatus Objective::CheckGuestsAndRating() const
else if (gameState.ScenarioParkRatingWarningDays == 29) else if (gameState.ScenarioParkRatingWarningDays == 29)
{ {
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0, {}); News::AddItemToQueue(News::ItemType::Graph, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0, {});
gameState.ParkFlags &= ~PARK_FLAGS_PARK_OPEN; gameState.Park.Flags &= ~PARK_FLAGS_PARK_OPEN;
gameState.GuestInitialHappiness = 50; gameState.GuestInitialHappiness = 50;
return ObjectiveStatus::Failure; return ObjectiveStatus::Failure;
} }
@ -733,7 +733,7 @@ ObjectiveStatus Objective::CheckGuestsAndRating() const
gameState.ScenarioParkRatingWarningDays = 0; gameState.ScenarioParkRatingWarningDays = 0;
} }
if (gameState.ParkRating >= 700) if (gameState.Park.Rating >= 700)
if (gameState.NumGuestsInPark >= NumGuests) if (gameState.NumGuestsInPark >= NumGuests)
return ObjectiveStatus::Success; return ObjectiveStatus::Success;
@ -817,7 +817,7 @@ ObjectiveStatus Objective::CheckFinish5RollerCoasters() const
ObjectiveStatus Objective::CheckRepayLoanAndParkValue() const ObjectiveStatus Objective::CheckRepayLoanAndParkValue() const
{ {
const auto& gameState = GetGameState(); const auto& gameState = GetGameState();
money64 parkValue = gameState.ParkValue; money64 parkValue = gameState.Park.Value;
money64 currentLoan = gameState.BankLoan; money64 currentLoan = gameState.BankLoan;
if (currentLoan <= 0 && parkValue >= Currency) if (currentLoan <= 0 && parkValue >= Currency)

View File

@ -68,7 +68,7 @@ namespace OpenRCT2::Scripting
int32_t ScPark::rating_get() const int32_t ScPark::rating_get() const
{ {
return GetGameState().ParkRating; return GetGameState().Park.Rating;
} }
void ScPark::rating_set(int32_t value) void ScPark::rating_set(int32_t value)
{ {
@ -76,9 +76,9 @@ namespace OpenRCT2::Scripting
auto valueClamped = std::min(std::max(0, value), 999); auto valueClamped = std::min(std::max(0, value), 999);
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkRating != valueClamped) if (gameState.Park.Rating != valueClamped)
{ {
gameState.ParkRating = std::min(std::max(0, value), 999); gameState.Park.Rating = std::min(std::max(0, value), 999);
auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING); auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING);
ContextBroadcastIntent(&intent); ContextBroadcastIntent(&intent);
} }
@ -121,16 +121,16 @@ namespace OpenRCT2::Scripting
money64 ScPark::entranceFee_get() const money64 ScPark::entranceFee_get() const
{ {
return GetGameState().ParkEntranceFee; return GetGameState().Park.EntranceFee;
} }
void ScPark::entranceFee_set(money64 value) void ScPark::entranceFee_set(money64 value)
{ {
ThrowIfGameStateNotMutable(); ThrowIfGameStateNotMutable();
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkEntranceFee != value) if (gameState.Park.EntranceFee != value)
{ {
gameState.ParkEntranceFee = value; gameState.Park.EntranceFee = value;
WindowInvalidateByClass(WindowClass::ParkInformation); WindowInvalidateByClass(WindowClass::ParkInformation);
} }
} }
@ -172,16 +172,16 @@ namespace OpenRCT2::Scripting
money64 ScPark::value_get() const money64 ScPark::value_get() const
{ {
return GetGameState().ParkValue; return GetGameState().Park.Value;
} }
void ScPark::value_set(money64 value) void ScPark::value_set(money64 value)
{ {
ThrowIfGameStateNotMutable(); ThrowIfGameStateNotMutable();
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkValue != value) if (gameState.Park.Value != value)
{ {
gameState.ParkValue = value; gameState.Park.Value = value;
auto intent = Intent(INTENT_ACTION_UPDATE_CASH); auto intent = Intent(INTENT_ACTION_UPDATE_CASH);
ContextBroadcastIntent(&intent); ContextBroadcastIntent(&intent);
} }
@ -263,17 +263,17 @@ namespace OpenRCT2::Scripting
int16_t ScPark::casualtyPenalty_get() const int16_t ScPark::casualtyPenalty_get() const
{ {
return GetGameState().ParkRatingCasualtyPenalty; return GetGameState().Park.RatingCasualtyPenalty;
} }
void ScPark::casualtyPenalty_set(int16_t value) void ScPark::casualtyPenalty_set(int16_t value)
{ {
ThrowIfGameStateNotMutable(); ThrowIfGameStateNotMutable();
GetGameState().ParkRatingCasualtyPenalty = value; GetGameState().Park.RatingCasualtyPenalty = value;
} }
uint16_t ScPark::parkSize_get() const uint16_t ScPark::parkSize_get() const
{ {
return GetGameState().ParkSize; return GetGameState().Park.Size;
} }
std::string ScPark::name_get() const std::string ScPark::name_get() const
@ -295,7 +295,7 @@ namespace OpenRCT2::Scripting
bool ScPark::getFlag(const std::string& key) const bool ScPark::getFlag(const std::string& key) const
{ {
auto mask = ParkFlagMap[key]; auto mask = ParkFlagMap[key];
return (GetGameState().ParkFlags & mask) != 0; return (GetGameState().Park.Flags & mask) != 0;
} }
void ScPark::setFlag(const std::string& key, bool value) void ScPark::setFlag(const std::string& key, bool value)
@ -304,9 +304,9 @@ namespace OpenRCT2::Scripting
auto mask = ParkFlagMap[key]; auto mask = ParkFlagMap[key];
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (value) if (value)
gameState.ParkFlags |= mask; gameState.Park.Flags |= mask;
else else
gameState.ParkFlags &= ~mask; gameState.Park.Flags &= ~mask;
GfxInvalidateScreen(); GfxInvalidateScreen();
} }

View File

@ -36,13 +36,13 @@ static int32_t MapPlaceClearFunc(
auto* scenery = (*tile_element)->AsSmallScenery()->GetEntry(); auto* scenery = (*tile_element)->AsSmallScenery()->GetEntry();
auto& gameState = GetGameState(); auto& gameState = GetGameState();
if (gameState.ParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) if (gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{ {
if (scenery != nullptr && scenery->HasFlag(SMALL_SCENERY_FLAG_IS_TREE)) if (scenery != nullptr && scenery->HasFlag(SMALL_SCENERY_FLAG_IS_TREE))
return 1; return 1;
} }
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY) && scenery != nullptr) if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY) && scenery != nullptr)
*price += scenery->removal_price; *price += scenery->removal_price;
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
@ -189,7 +189,7 @@ GameActions::Result MapCanConstructWithClearAt(
} }
} }
if (GetGameState().ParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION && !isTree) if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION && !isTree)
{ {
const auto heightFromGround = pos.clearanceZ - tileElement->GetBaseZ(); const auto heightFromGround = pos.clearanceZ - tileElement->GetBaseZ();

View File

@ -70,7 +70,7 @@ void ParkEntranceRemoveGhost()
int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos) int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos)
{ {
int32_t i = 0; int32_t i = 0;
for (const auto& entrance : GetGameState().ParkEntrances) for (const auto& entrance : GetGameState().Park.Entrances)
{ {
if (entrancePos == entrance) if (entrancePos == entrance)
{ {
@ -83,7 +83,7 @@ int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos)
void ParkEntranceReset() void ParkEntranceReset()
{ {
GetGameState().ParkEntrances.clear(); GetGameState().Park.Entrances.clear();
} }
void RideEntranceExitPlaceProvisionalGhost() void RideEntranceExitPlaceProvisionalGhost()
@ -214,17 +214,17 @@ void ParkEntranceFixLocations(void)
{ {
auto& gameState = GetGameState(); auto& gameState = GetGameState();
// Fix ParkEntrance locations for which the tile_element no longer exists // Fix ParkEntrance locations for which the tile_element no longer exists
gameState.ParkEntrances.erase( gameState.Park.Entrances.erase(
std::remove_if( std::remove_if(
gameState.ParkEntrances.begin(), gameState.ParkEntrances.end(), gameState.Park.Entrances.begin(), gameState.Park.Entrances.end(),
[](const auto& entrance) { return MapGetParkEntranceElementAt(entrance, false) == nullptr; }), [](const auto& entrance) { return MapGetParkEntranceElementAt(entrance, false) == nullptr; }),
gameState.ParkEntrances.end()); gameState.Park.Entrances.end());
} }
void ParkEntranceUpdateLocations() void ParkEntranceUpdateLocations()
{ {
auto& gameState = GetGameState(); auto& gameState = GetGameState();
gameState.ParkEntrances.clear(); gameState.Park.Entrances.clear();
TileElementIterator it; TileElementIterator it;
TileElementIteratorBegin(&it); TileElementIteratorBegin(&it);
while (TileElementIteratorNext(&it)) while (TileElementIteratorNext(&it))
@ -234,7 +234,7 @@ void ParkEntranceUpdateLocations()
&& entranceElement->GetSequenceIndex() == 0 && !entranceElement->IsGhost()) && entranceElement->GetSequenceIndex() == 0 && !entranceElement->IsGhost())
{ {
auto entrance = TileCoordsXYZD(it.x, it.y, it.element->BaseHeight, it.element->GetDirection()).ToCoordsXYZD(); auto entrance = TileCoordsXYZD(it.x, it.y, it.element->BaseHeight, it.element->GetDirection()).ToCoordsXYZD();
gameState.ParkEntrances.push_back(entrance); gameState.Park.Entrances.push_back(entrance);
} }
} }
} }

View File

@ -41,6 +41,7 @@ extern CoordsXYZD gRideEntranceExitGhostPosition;
extern StationIndex gRideEntranceExitGhostStationIndex; extern StationIndex gRideEntranceExitGhostStationIndex;
void ParkEntranceRemoveGhost(); void ParkEntranceRemoveGhost();
int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos);
void ParkEntranceReset(); void ParkEntranceReset();
void MazeEntranceHedgeReplacement(const CoordsXYE& entrance); void MazeEntranceHedgeReplacement(const CoordsXYE& entrance);

View File

@ -1366,7 +1366,7 @@ void MapRemoveOutOfRangeElements()
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->SetOwnership(OWNERSHIP_UNOWNED); surfaceElement->SetOwnership(OWNERSHIP_UNOWNED);
ParkUpdateFencesAroundTile({ x, y }); Park::UpdateFencesAroundTile({ x, y });
} }
ClearElementsAt({ x, y }); ClearElementsAt({ x, y });
} }
@ -1430,7 +1430,7 @@ void MapExtendBoundarySurfaceY()
MapExtendBoundarySurfaceExtendTile(*existingTileElement, *newTileElement); MapExtendBoundarySurfaceExtendTile(*existingTileElement, *newTileElement);
} }
ParkUpdateFences({ x << 5, y << 5 }); Park::UpdateFences({ x << 5, y << 5 });
} }
} }
@ -1448,7 +1448,7 @@ void MapExtendBoundarySurfaceX()
{ {
MapExtendBoundarySurfaceExtendTile(*existingTileElement, *newTileElement); MapExtendBoundarySurfaceExtendTile(*existingTileElement, *newTileElement);
} }
ParkUpdateFences({ x << 5, y << 5 }); Park::UpdateFences({ x << 5, y << 5 });
} }
} }
@ -2229,7 +2229,7 @@ void FixLandOwnershipTilesWithOwnership(std::initializer_list<TileCoordsXY> tile
continue; continue;
surfaceElement->SetOwnership(ownership); surfaceElement->SetOwnership(ownership);
ParkUpdateFencesAroundTile({ (*tile).x * 32, (*tile).y * 32 }); Park::UpdateFencesAroundTile({ (*tile).x * 32, (*tile).y * 32 });
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
#pragma once #pragma once
#include "../common.h" #include "../common.h"
#include "../management/Finance.h"
#include "Map.h" #include "Map.h"
constexpr auto MAX_ENTRANCE_FEE = 999.00_GBP; constexpr auto MAX_ENTRANCE_FEE = 999.00_GBP;
@ -52,39 +53,51 @@ namespace OpenRCT2
{ {
struct Date; struct Date;
struct Park final namespace Park
{ {
std::string Name; struct ParkData final
{
std::string Name;
uint64_t Flags;
uint16_t Rating;
uint8_t RatingHistory[kParkRatingHistorySize];
int16_t RatingCasualtyPenalty;
money64 EntranceFee;
std::vector<CoordsXYZD> Entrances;
uint32_t Size;
money64 Value;
money64 ValueHistory[FINANCE_GRAPH_SIZE];
bool IsOpen() const;
};
void Initialise(OpenRCT2::GameState_t& gameState);
void Update(OpenRCT2::GameState_t& gameState, const OpenRCT2::Date& date);
uint32_t CalculateParkSize();
int32_t CalculateParkRating();
money64 CalculateParkValue();
money64 CalculateCompanyValue();
Guest* GenerateGuest();
void ResetHistories(OpenRCT2::GameState_t& gameState);
void UpdateHistories(OpenRCT2::GameState_t& gameState);
void SetForcedRating(int32_t rating);
int32_t GetForcedRating();
uint32_t UpdateSize(OpenRCT2::GameState_t& gameState);
void UpdateFences(const CoordsXY& coords);
void UpdateFencesAroundTile(const CoordsXY& coords);
uint8_t CalculateGuestInitialHappiness(uint8_t percentage);
void SetOpen(bool open);
money64 GetEntranceFee();
bool RidePricesUnlocked();
bool EntranceFeeUnlocked();
} // namespace Park
bool IsOpen() const;
};
} // namespace OpenRCT2 } // namespace OpenRCT2
void ParkInitialise(OpenRCT2::GameState_t& gameState);
void ParkUpdate(OpenRCT2::GameState_t& gameState, const OpenRCT2::Date& date);
uint32_t CalculateParkSize();
int32_t CalculateParkRating();
money64 CalculateParkValue();
money64 CalculateCompanyValue();
Guest* GenerateGuest();
void ResetParkHistories(OpenRCT2::GameState_t& gameState);
void UpdateParkHistories(OpenRCT2::GameState_t& gameState);
void ParkSetForcedRating(int32_t rating);
int32_t ParkGetForcedRating();
uint32_t ParkUpdateSize(OpenRCT2::GameState_t& gameState);
void ParkUpdateFences(const CoordsXY& coords);
void ParkUpdateFencesAroundTile(const CoordsXY& coords);
uint8_t CalculateGuestInitialHappiness(uint8_t percentage);
void ParkSetOpen(bool open);
int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos);
money64 ParkGetEntranceFee();
bool ParkRidePricesUnlocked();
bool ParkEntranceFeeUnlocked();

View File

@ -503,7 +503,7 @@ namespace OpenRCT2::TileInspector
if (!showFences) if (!showFences)
surfaceelement->SetParkFences(0); surfaceelement->SetParkFences(0);
else else
ParkUpdateFences(loc); Park::UpdateFences(loc);
} }
return GameActions::Result(); return GameActions::Result();

View File

@ -101,7 +101,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds)
// Open park for free but charging for rides // Open park for free but charging for rides
execute<ParkSetParameterAction>(ParkParameter::Open); execute<ParkSetParameterAction>(ParkParameter::Open);
execute<ParkSetEntranceFeeAction>(0); execute<ParkSetEntranceFeeAction>(0);
gameState.ParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
// Find ferris wheel // Find ferris wheel
auto rideManager = GetRideManager(); auto rideManager = GetRideManager();
@ -118,7 +118,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds)
gameState.Cheats.IgnoreRideIntensity = true; gameState.Cheats.IgnoreRideIntensity = true;
// Insert a rich guest // Insert a rich guest
auto richGuest = gameState.Park.GenerateGuest(); auto richGuest = Park::GenerateGuest();
richGuest->CashInPocket = 3000; richGuest->CashInPocket = 3000;
// Wait for rich guest to get in queue // Wait for rich guest to get in queue
@ -126,7 +126,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds)
ASSERT_TRUE(matched); ASSERT_TRUE(matched);
// Insert poor guest // Insert poor guest
auto poorGuest = gameState.Park.GenerateGuest(); auto poorGuest = Park::GenerateGuest();
poorGuest->CashInPocket = 5; poorGuest->CashInPocket = 5;
// Wait for poor guest to get in queue // Wait for poor guest to get in queue
@ -161,7 +161,7 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests)
// Open park for free but charging for rides // Open park for free but charging for rides
execute<ParkSetParameterAction>(ParkParameter::Open); execute<ParkSetParameterAction>(ParkParameter::Open);
execute<ParkSetEntranceFeeAction>(0); execute<ParkSetEntranceFeeAction>(0);
gameState.ParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES; gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
// Find car ride // Find car ride
auto rideManager = GetRideManager(); auto rideManager = GetRideManager();
@ -180,7 +180,7 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests)
std::vector<Peep*> guests; std::vector<Peep*> guests;
for (int i = 0; i < 25; i++) for (int i = 0; i < 25; i++)
{ {
guests.push_back(gameState.Park.GenerateGuest()); guests.push_back(Park::GenerateGuest());
} }
// Wait until one of them is riding // Wait until one of them is riding