From 4badffcdb6536442b362fa384ab34f9d140de3a4 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 20 Mar 2025 19:47:53 +0100 Subject: [PATCH] Change GameState_t members to lowerCamelCase --- src/openrct2-ui/WindowManager.cpp | 2 +- src/openrct2-ui/input/Shortcuts.cpp | 22 +- src/openrct2-ui/interface/FileBrowser.cpp | 30 +-- .../interface/ViewportInteraction.cpp | 12 +- src/openrct2-ui/interface/Window.cpp | 2 +- src/openrct2-ui/ride/Construction.cpp | 2 +- src/openrct2-ui/ride/VehicleSounds.cpp | 4 +- src/openrct2-ui/scripting/ScTitleSequence.hpp | 2 +- src/openrct2-ui/title/TitleSequencePlayer.cpp | 8 +- src/openrct2-ui/windows/Cheats.cpp | 140 +++++----- src/openrct2-ui/windows/ClearScenery.cpp | 2 +- .../windows/DemolishRidePrompt.cpp | 2 +- src/openrct2-ui/windows/Dropdown.cpp | 2 +- .../windows/EditorBottomToolbar.cpp | 40 +-- .../windows/EditorInventionsList.cpp | 22 +- .../windows/EditorObjectSelection.cpp | 2 +- .../windows/EditorObjectiveOptions.cpp | 154 +++++------ .../windows/EditorScenarioOptions.cpp | 184 +++++++------- src/openrct2-ui/windows/Finances.cpp | 60 ++--- src/openrct2-ui/windows/Footpath.cpp | 14 +- src/openrct2-ui/windows/GameBottomToolbar.cpp | 36 +-- src/openrct2-ui/windows/Guest.cpp | 8 +- src/openrct2-ui/windows/GuestList.cpp | 6 +- src/openrct2-ui/windows/Land.cpp | 2 +- src/openrct2-ui/windows/LandRights.cpp | 4 +- src/openrct2-ui/windows/Map.cpp | 24 +- src/openrct2-ui/windows/NewRide.cpp | 8 +- src/openrct2-ui/windows/News.cpp | 12 +- src/openrct2-ui/windows/Park.cpp | 80 +++--- .../windows/RefurbishRidePrompt.cpp | 2 +- src/openrct2-ui/windows/Research.cpp | 84 +++--- src/openrct2-ui/windows/Ride.cpp | 74 +++--- src/openrct2-ui/windows/RideConstruction.cpp | 38 +-- src/openrct2-ui/windows/RideList.cpp | 2 +- src/openrct2-ui/windows/SavePrompt.cpp | 2 +- src/openrct2-ui/windows/Scenery.cpp | 6 +- src/openrct2-ui/windows/Staff.cpp | 2 +- src/openrct2-ui/windows/StaffList.cpp | 10 +- src/openrct2-ui/windows/TopToolbar.cpp | 38 +-- src/openrct2-ui/windows/TrackDesignPlace.cpp | 4 +- src/openrct2-ui/windows/Transparency.cpp | 2 +- src/openrct2-ui/windows/Water.cpp | 2 +- src/openrct2/Cheats.cpp | 172 ++++++------- src/openrct2/Context.cpp | 2 +- src/openrct2/Date.cpp | 14 +- src/openrct2/Editor.cpp | 76 +++--- src/openrct2/EditorObjectSelectionSession.cpp | 12 +- src/openrct2/Game.cpp | 28 +- src/openrct2/GameState.cpp | 24 +- src/openrct2/GameState.h | 172 ++++++------- src/openrct2/ReplayManager.cpp | 30 +-- src/openrct2/actions/CheatSetAction.cpp | 80 +++--- src/openrct2/actions/ClearAction.cpp | 8 +- .../actions/FootpathAdditionPlaceAction.cpp | 2 +- .../actions/FootpathAdditionRemoveAction.cpp | 2 +- .../actions/FootpathLayoutPlaceAction.cpp | 4 +- src/openrct2/actions/FootpathPlaceAction.cpp | 14 +- src/openrct2/actions/FootpathRemoveAction.cpp | 10 +- src/openrct2/actions/GameAction.cpp | 10 +- src/openrct2/actions/LandBuyRightsAction.cpp | 4 +- src/openrct2/actions/LandLowerAction.cpp | 2 +- src/openrct2/actions/LandRaiseAction.cpp | 2 +- src/openrct2/actions/LandSetHeightAction.cpp | 16 +- src/openrct2/actions/LandSetRightsAction.cpp | 18 +- .../actions/LargeSceneryPlaceAction.cpp | 8 +- .../actions/LargeSceneryRemoveAction.cpp | 6 +- .../actions/LargeScenerySetColourAction.cpp | 2 +- src/openrct2/actions/MapChangeSizeAction.cpp | 14 +- src/openrct2/actions/MazePlaceTrackAction.cpp | 6 +- src/openrct2/actions/MazeSetTrackAction.cpp | 6 +- .../actions/ParkEntrancePlaceAction.cpp | 8 +- .../actions/ParkEntranceRemoveAction.cpp | 8 +- src/openrct2/actions/ParkMarketingAction.cpp | 2 +- src/openrct2/actions/ParkSetDateAction.cpp | 4 +- .../actions/ParkSetEntranceFeeAction.cpp | 4 +- src/openrct2/actions/ParkSetLoanAction.cpp | 18 +- src/openrct2/actions/ParkSetNameAction.cpp | 2 +- .../actions/ParkSetParameterAction.cpp | 12 +- .../actions/ParkSetResearchFundingAction.cpp | 6 +- src/openrct2/actions/PeepSpawnPlaceAction.cpp | 20 +- src/openrct2/actions/RideCreateAction.cpp | 10 +- src/openrct2/actions/RideDemolishAction.cpp | 10 +- .../actions/RideEntranceExitPlaceAction.cpp | 6 +- src/openrct2/actions/RideSetSettingAction.cpp | 14 +- src/openrct2/actions/RideSetVehicleAction.cpp | 10 +- .../actions/ScenarioSetSettingAction.cpp | 104 ++++---- .../actions/SmallSceneryPlaceAction.cpp | 14 +- .../actions/SmallSceneryRemoveAction.cpp | 4 +- .../actions/SmallScenerySetColourAction.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.cpp | 10 +- .../actions/SurfaceSetStyleAction.cpp | 10 +- src/openrct2/actions/TrackDesignAction.cpp | 14 +- src/openrct2/actions/TrackPlaceAction.cpp | 26 +- src/openrct2/actions/TrackRemoveAction.cpp | 2 +- src/openrct2/actions/WallPlaceAction.cpp | 22 +- src/openrct2/actions/WallRemoveAction.cpp | 2 +- src/openrct2/actions/WallSetColourAction.cpp | 2 +- src/openrct2/actions/WaterLowerAction.cpp | 4 +- src/openrct2/actions/WaterRaiseAction.cpp | 4 +- src/openrct2/actions/WaterSetHeightAction.cpp | 10 +- src/openrct2/command_line/ConvertCommand.cpp | 2 +- src/openrct2/drawing/Drawing.cpp | 2 +- src/openrct2/drawing/LightFX.cpp | 14 +- src/openrct2/drawing/Weather.cpp | 10 +- src/openrct2/entity/Duck.cpp | 6 +- src/openrct2/entity/EntityRegistry.cpp | 8 +- src/openrct2/entity/Fountain.cpp | 2 +- src/openrct2/entity/Guest.cpp | 100 ++++---- src/openrct2/entity/Litter.cpp | 8 +- src/openrct2/entity/Peep.cpp | 84 +++--- src/openrct2/entity/Staff.cpp | 18 +- src/openrct2/interface/InteractiveConsole.cpp | 80 +++--- src/openrct2/interface/Screenshot.cpp | 28 +- src/openrct2/interface/Viewport.cpp | 10 +- src/openrct2/management/Award.cpp | 36 +-- src/openrct2/management/Finance.cpp | 122 ++++----- src/openrct2/management/Marketing.cpp | 14 +- src/openrct2/management/NewsItem.cpp | 48 ++-- src/openrct2/management/Research.cpp | 240 +++++++++--------- src/openrct2/network/DiscordService.cpp | 4 +- src/openrct2/network/NetworkBase.cpp | 24 +- .../network/NetworkServerAdvertiser.cpp | 12 +- src/openrct2/paint/Painter.cpp | 2 +- src/openrct2/paint/VirtualFloor.cpp | 2 +- .../paint/tile_element/Paint.Banner.cpp | 2 +- .../paint/tile_element/Paint.Entrance.cpp | 10 +- .../paint/tile_element/Paint.LargeScenery.cpp | 2 +- .../paint/tile_element/Paint.Path.cpp | 2 +- .../paint/tile_element/Paint.SmallScenery.cpp | 2 +- .../paint/tile_element/Paint.Surface.cpp | 6 +- .../paint/tile_element/Paint.Wall.cpp | 4 +- .../paint/track/water/RiverRapids.cpp | 6 +- src/openrct2/paint/vehicle/VehiclePaint.cpp | 10 +- src/openrct2/park/ParkFile.cpp | 220 ++++++++-------- src/openrct2/park/ParkPreview.cpp | 28 +- src/openrct2/peep/GuestPathfinding.cpp | 8 +- src/openrct2/platform/Crash.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 164 ++++++------ src/openrct2/rct2/S6Importer.cpp | 200 +++++++-------- src/openrct2/ride/Ride.cpp | 90 +++---- src/openrct2/ride/RideConstruction.cpp | 12 +- src/openrct2/ride/RideData.cpp | 6 +- src/openrct2/ride/RideManager.cpp | 12 +- src/openrct2/ride/RideRatings.cpp | 14 +- src/openrct2/ride/ShopItem.cpp | 2 +- src/openrct2/ride/Station.cpp | 2 +- src/openrct2/ride/TrackDesign.cpp | 22 +- src/openrct2/ride/TrackPaint.cpp | 2 +- src/openrct2/ride/Vehicle.cpp | 16 +- src/openrct2/scenario/Scenario.cpp | 160 ++++++------ src/openrct2/scenario/ScenarioRepository.cpp | 2 +- src/openrct2/scenes/Scene.cpp | 4 +- src/openrct2/scenes/Scene.h | 4 +- .../scenes/preloader/PreloaderScene.cpp | 2 +- src/openrct2/scenes/title/TitleScene.cpp | 4 +- .../scripting/bindings/entity/ScGuest.cpp | 6 +- .../scripting/bindings/game/ScCheats.hpp | 96 +++---- .../scripting/bindings/world/ScClimate.hpp | 12 +- .../scripting/bindings/world/ScDate.hpp | 12 +- .../scripting/bindings/world/ScMap.cpp | 2 +- .../scripting/bindings/world/ScPark.cpp | 134 +++++----- .../bindings/world/ScParkMessage.cpp | 2 +- .../scripting/bindings/world/ScResearch.cpp | 48 ++-- .../scripting/bindings/world/ScScenario.hpp | 140 +++++----- src/openrct2/world/Banner.cpp | 58 ++--- src/openrct2/world/Climate.cpp | 94 +++---- src/openrct2/world/ConstructionClearance.cpp | 10 +- src/openrct2/world/Entrance.cpp | 18 +- src/openrct2/world/Footpath.cpp | 8 +- src/openrct2/world/Map.cpp | 144 +++++------ src/openrct2/world/MapAnimation.cpp | 4 +- src/openrct2/world/Park.cpp | 214 ++++++++-------- src/openrct2/world/Scenery.cpp | 38 +-- src/openrct2/world/map_generator/MapGen.cpp | 6 +- .../world/map_generator/TreePlacement.cpp | 10 +- .../world/tile_element/TrackElement.cpp | 2 +- test/tests/MultiLaunch.cpp | 2 +- test/tests/PlayTests.cpp | 14 +- test/tests/S6ImportExportTests.cpp | 8 +- 179 files changed, 2619 insertions(+), 2619 deletions(-) diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index ab7807573d..2ad556eb31 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -1034,7 +1034,7 @@ public: if (gLegacyScene == LegacyScene::scenarioEditor) { - if (GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (getGameState().editorStep != EditorStep::LandscapeEditor) return; } diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index f289401dc9..df53ad6828 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -197,7 +197,7 @@ static void ShortcutAdjustLand() if (gLegacyScene == LegacyScene::titleSequence) return; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep != EditorStep::LandscapeEditor) return; if (isInTrackDesignerOrManager()) @@ -211,7 +211,7 @@ static void ShortcutAdjustWater() if (gLegacyScene == LegacyScene::titleSequence) return; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep != EditorStep::LandscapeEditor) return; if (isInTrackDesignerOrManager()) @@ -225,7 +225,7 @@ static void ShortcutBuildScenery() if (gLegacyScene == LegacyScene::titleSequence) return; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep != EditorStep::LandscapeEditor) return; if (isInTrackDesignerOrManager()) @@ -239,7 +239,7 @@ static void ShortcutBuildPaths() if (gLegacyScene == LegacyScene::titleSequence) return; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep != EditorStep::LandscapeEditor) return; if (isInTrackDesignerOrManager()) @@ -268,7 +268,7 @@ static void ShortcutShowFinancialInformation() return; if (!(isInTrackDesignerOrManager())) - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) ContextOpenWindow(WindowClass::Finances); } @@ -341,7 +341,7 @@ static void ShortcutShowMap() if (gLegacyScene == LegacyScene::titleSequence) return; - if (gLegacyScene != LegacyScene::scenarioEditor || GetGameState().EditorStep == EditorStep::LandscapeEditor) + if (gLegacyScene != LegacyScene::scenarioEditor || getGameState().editorStep == EditorStep::LandscapeEditor) if (!(isInTrackDesignerOrManager())) ContextOpenWindow(WindowClass::Map); } @@ -398,7 +398,7 @@ static void ShortcutClearScenery() if (gLegacyScene == LegacyScene::titleSequence) return; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep != EditorStep::LandscapeEditor) return; if (isInTrackDesignerOrManager()) @@ -420,7 +420,7 @@ static void ShortcutQuickSaveGame() auto intent = Intent(WindowClass::Loadsave); intent.PutEnumExtra(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save); intent.PutEnumExtra(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::landscape); - intent.PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName); + intent.PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioName); ContextOpenIntent(&intent); } } @@ -438,7 +438,7 @@ static void ShortcutOpenSceneryPicker() { if ((gLegacyScene == LegacyScene::titleSequence || gLegacyScene == LegacyScene::trackDesigner || gLegacyScene == LegacyScene::trackDesignsManager) - || (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor)) + || (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep != EditorStep::LandscapeEditor)) return; auto* windowMgr = GetWindowManager(); @@ -610,7 +610,7 @@ static void ShortcutDecreaseElementHeight() static void ShortcutToggleClearanceChecks() { auto cheatSetAction = CheatSetAction( - CheatType::DisableClearanceChecks, GetGameState().Cheats.disableClearanceChecks ? 0 : 1); + CheatType::DisableClearanceChecks, getGameState().cheats.disableClearanceChecks ? 0 : 1); GameActions::Execute(&cheatSetAction); } @@ -758,7 +758,7 @@ void ShortcutManager::RegisterDefaultShortcuts() { windowMgr->CloseAll(); } - else if (GetGameState().EditorStep == EditorStep::LandscapeEditor) + else if (getGameState().editorStep == EditorStep::LandscapeEditor) { windowMgr->CloseTop(); } diff --git a/src/openrct2-ui/interface/FileBrowser.cpp b/src/openrct2-ui/interface/FileBrowser.cpp index 671001e229..79bfd8f213 100644 --- a/src/openrct2-ui/interface/FileBrowser.cpp +++ b/src/openrct2-ui/interface/FileBrowser.cpp @@ -226,7 +226,7 @@ namespace OpenRCT2::Ui::FileBrowser windowMgr->CloseByClass(WindowClass::RideConstruction); windowMgr->CloseAllExceptClass(WindowClass::Loadsave); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (action) { @@ -275,12 +275,12 @@ namespace OpenRCT2::Ui::FileBrowser case (LoadSaveType::scenario): { SetAndSaveConfigPath(Config::Get().general.LastSaveScenarioDirectory, pathBuffer); - int32_t parkFlagsBackup = gameState.Park.Flags; - gameState.Park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED; - gameState.EditorStep = EditorStep::Invalid; - gameState.ScenarioFileName = std::string(String::toStringView(pathBuffer, std::size(pathBuffer))); + int32_t parkFlagsBackup = gameState.park.Flags; + gameState.park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED; + gameState.editorStep = EditorStep::Invalid; + gameState.scenarioFileName = std::string(String::toStringView(pathBuffer, std::size(pathBuffer))); int32_t success = ScenarioSave(gameState, pathBuffer, Config::Get().general.SavePluginData ? 3 : 2); - gameState.Park.Flags = parkFlagsBackup; + gameState.park.Flags = parkFlagsBackup; if (success) { @@ -293,7 +293,7 @@ namespace OpenRCT2::Ui::FileBrowser else { ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {}); - gameState.EditorStep = EditorStep::ObjectiveSelection; + gameState.editorStep = EditorStep::ObjectiveSelection; InvokeCallback(ModalResult::fail, pathBuffer); } break; @@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::FileBrowser case LoadSaveType::landscape: { SetAndSaveConfigPath(Config::Get().general.LastSaveLandscapeDirectory, pathBuffer); - gameState.ScenarioFileName = std::string(String::toStringView(pathBuffer, std::size(pathBuffer))); + gameState.scenarioFileName = std::string(String::toStringView(pathBuffer, std::size(pathBuffer))); if (ScenarioSave(gameState, pathBuffer, Config::Get().general.SavePluginData ? 3 : 2)) { gCurrentLoadedPath = pathBuffer; @@ -364,12 +364,12 @@ namespace OpenRCT2::Ui::FileBrowser case LoadSaveType::scenario: { SetAndSaveConfigPath(Config::Get().general.LastSaveScenarioDirectory, pathBuffer); - int32_t parkFlagsBackup = gameState.Park.Flags; - gameState.Park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED; - gameState.EditorStep = EditorStep::Invalid; - gameState.ScenarioFileName = std::string(String::toStringView(pathBuffer, std::size(pathBuffer))); + int32_t parkFlagsBackup = gameState.park.Flags; + gameState.park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED; + gameState.editorStep = EditorStep::Invalid; + gameState.scenarioFileName = std::string(String::toStringView(pathBuffer, std::size(pathBuffer))); int32_t success = ScenarioSave(gameState, pathBuffer, Config::Get().general.SavePluginData ? 3 : 2); - gameState.Park.Flags = parkFlagsBackup; + gameState.park.Flags = parkFlagsBackup; if (success) { @@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::FileBrowser else { ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {}); - gameState.EditorStep = EditorStep::ObjectiveSelection; + gameState.editorStep = EditorStep::ObjectiveSelection; InvokeCallback(ModalResult::fail, pathBuffer); } break; @@ -503,7 +503,7 @@ namespace OpenRCT2::Ui::FileBrowser } else { - auto buffer = GetGameState().Park.Name; + auto buffer = getGameState().park.Name; if (buffer.empty()) { buffer = LanguageGetString(STR_UNNAMED_PARK); diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 47cda3fdfe..81e8cb811b 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -86,7 +86,7 @@ namespace OpenRCT2::Ui return info; // - if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && getGameState().editorStep != EditorStep::RollercoasterDesigner) return info; info = GetMapCoordinatesFromPos( @@ -146,8 +146,8 @@ namespace OpenRCT2::Ui break; case ViewportInteractionItem::ParkEntrance: { - auto& gameState = GetGameState(); - auto parkName = gameState.Park.Name.c_str(); + auto& gameState = getGameState(); + auto parkName = gameState.park.Name.c_str(); auto ft = Formatter(); ft.Add(STR_STRING); @@ -273,7 +273,7 @@ namespace OpenRCT2::Ui return info; // - if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && getGameState().editorStep != EditorStep::RollercoasterDesigner) return info; constexpr auto flags = static_cast( @@ -377,7 +377,7 @@ namespace OpenRCT2::Ui else { // FIXME: Why does it *2 the value? - if (!GetGameState().Cheats.sandboxMode && !MapIsLocationOwned({ info.Loc, tileElement->GetBaseZ() * 2 })) + if (!getGameState().cheats.sandboxMode && !MapIsLocationOwned({ info.Loc, tileElement->GetBaseZ() * 2 })) { info.interactionType = ViewportInteractionItem::None; return info; @@ -509,7 +509,7 @@ namespace OpenRCT2::Ui return info; } case ViewportInteractionItem::ParkEntrance: - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) break; if (tileElement->GetType() != TileElementType::Entrance) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 0a2ce19c1a..b5ede76681 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -1124,7 +1124,7 @@ namespace OpenRCT2::Ui::Windows if (gLegacyScene == LegacyScene::titleSequence) return; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep != EditorStep::LandscapeEditor) return; if (gLegacyScene == LegacyScene::trackDesignsManager) diff --git a/src/openrct2-ui/ride/Construction.cpp b/src/openrct2-ui/ride/Construction.cpp index 281910c752..b6561fcd79 100644 --- a/src/openrct2-ui/ride/Construction.cpp +++ b/src/openrct2-ui/ride/Construction.cpp @@ -230,7 +230,7 @@ namespace OpenRCT2 int32_t colour2 = RideGetUnusedPresetVehicleColour(rideEntryIndex); auto gameAction = RideCreateAction( - listItem.Type, listItem.EntryIndex, colour1, colour2, GetGameState().LastEntranceStyle); + listItem.Type, listItem.EntryIndex, colour1, colour2, getGameState().lastEntranceStyle); gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { if (result->Error != GameActions::Status::Ok) diff --git a/src/openrct2-ui/ride/VehicleSounds.cpp b/src/openrct2-ui/ride/VehicleSounds.cpp index 0491a63473..8618ce407a 100644 --- a/src/openrct2-ui/ride/VehicleSounds.cpp +++ b/src/openrct2-ui/ride/VehicleSounds.cpp @@ -108,7 +108,7 @@ namespace OpenRCT2::Audio if (gLegacyScene == LegacyScene::scenarioEditor) return false; - if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && getGameState().editorStep != EditorStep::RollercoasterDesigner) return false; if (vehicle.sound1_id == SoundId::Null && vehicle.sound2_id == SoundId::Null) @@ -516,7 +516,7 @@ namespace OpenRCT2::Audio sound.Pan = sound_params->pan_x; sound.Channel->SetPan(DStoMixerPan(sound_params->pan_x)); } - if (!(GetGameState().CurrentTicks & 3) && sound_params->frequency != sound.Frequency) + if (!(getGameState().currentTicks & 3) && sound_params->frequency != sound.Frequency) { sound.Frequency = sound_params->frequency; if (ShouldUpdateChannelRate(id)) diff --git a/src/openrct2-ui/scripting/ScTitleSequence.hpp b/src/openrct2-ui/scripting/ScTitleSequence.hpp index ec28ee06d2..ec061e35df 100644 --- a/src/openrct2-ui/scripting/ScTitleSequence.hpp +++ b/src/openrct2-ui/scripting/ScTitleSequence.hpp @@ -259,7 +259,7 @@ namespace OpenRCT2::Scripting objectMgr.LoadObjects(result.RequiredObjects); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); parkImporter->Import(gameState); auto old = gLoadKeepWindowsOpen; diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index b66aa5b4fa..cd465138a1 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -324,7 +324,7 @@ namespace OpenRCT2::Title ReportProgress(90); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); parkImporter->Import(gameState); ReportProgress(100); @@ -380,7 +380,7 @@ namespace OpenRCT2::Title ReportProgress(70); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); parkImporter->Import(gameState); ReportProgress(100); @@ -431,8 +431,8 @@ namespace OpenRCT2::Title void PrepareParkForPlayback() { auto windowManager = Ui::GetWindowManager(); - auto& gameState = GetGameState(); - windowManager->SetMainView(gameState.SavedView, gameState.SavedViewZoom, gameState.SavedViewRotation); + auto& gameState = getGameState(); + windowManager->SetMainView(gameState.savedView, gameState.savedViewZoom, gameState.savedViewRotation); ResetEntitySpatialIndices(); ResetAllSpriteQuadrantPlacements(); auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 713814a71a..1a4740d66a 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -514,12 +514,12 @@ static StringId window_cheats_page_titles[] = { // Set title widgets[WIDX_TITLE].text = window_cheats_page_titles[page]; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (page) { case WINDOW_CHEATS_PAGE_MONEY: { - auto moneyDisabled = (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) != 0; + auto moneyDisabled = (gameState.park.Flags & PARK_FLAGS_NO_MONEY) != 0; SetCheckboxValue(WIDX_NO_MONEY, moneyDisabled); SetWidgetDisabled(WIDX_ADD_SET_MONEY_GROUP, moneyDisabled); SetWidgetDisabled(WIDX_MONEY_SPINNER, moneyDisabled); @@ -534,57 +534,57 @@ static StringId window_cheats_page_titles[] = { { auto ft = Formatter::Common(); ft.Add(1000.00_GBP); - SetCheckboxValue(WIDX_GUEST_IGNORE_RIDE_INTENSITY, gameState.Cheats.ignoreRideIntensity); - SetCheckboxValue(WIDX_GUEST_IGNORE_PRICE, gameState.Cheats.ignorePrice); - SetCheckboxValue(WIDX_DISABLE_VANDALISM, gameState.Cheats.disableVandalism); - SetCheckboxValue(WIDX_DISABLE_LITTERING, gameState.Cheats.disableLittering); + SetCheckboxValue(WIDX_GUEST_IGNORE_RIDE_INTENSITY, gameState.cheats.ignoreRideIntensity); + SetCheckboxValue(WIDX_GUEST_IGNORE_PRICE, gameState.cheats.ignorePrice); + SetCheckboxValue(WIDX_DISABLE_VANDALISM, gameState.cheats.disableVandalism); + SetCheckboxValue(WIDX_DISABLE_LITTERING, gameState.cheats.disableLittering); break; } case WINDOW_CHEATS_PAGE_PARK: widgets[WIDX_OPEN_CLOSE_PARK].text = STR_CHEAT_OPEN_PARK; - if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) + if (gameState.park.Flags & PARK_FLAGS_PARK_OPEN) widgets[WIDX_OPEN_CLOSE_PARK].text = STR_CHEAT_CLOSE_PARK; SetCheckboxValue(WIDX_FORCE_PARK_RATING, Park::GetForcedRating() >= 0); - SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.Cheats.neverendingMarketing); - SetCheckboxValue(WIDX_ALLOW_BUILD_IN_PAUSE_MODE, gameState.Cheats.buildInPauseMode); - SetCheckboxValue(WIDX_ALLOW_REGULAR_PATH_AS_QUEUE, gameState.Cheats.allowRegularPathAsQueue); - SetCheckboxValue(WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES, gameState.Cheats.allowSpecialColourSchemes); + SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.cheats.neverendingMarketing); + SetCheckboxValue(WIDX_ALLOW_BUILD_IN_PAUSE_MODE, gameState.cheats.buildInPauseMode); + SetCheckboxValue(WIDX_ALLOW_REGULAR_PATH_AS_QUEUE, gameState.cheats.allowRegularPathAsQueue); + SetCheckboxValue(WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES, gameState.cheats.allowSpecialColourSchemes); break; case WINDOW_CHEATS_PAGE_RIDES: - SetCheckboxValue(WIDX_UNLOCK_OPERATING_LIMITS, gameState.Cheats.unlockOperatingLimits); - SetCheckboxValue(WIDX_DISABLE_BRAKES_FAILURE, gameState.Cheats.disableBrakesFailure); - SetCheckboxValue(WIDX_DISABLE_ALL_BREAKDOWNS, gameState.Cheats.disableAllBreakdowns); - SetCheckboxValue(WIDX_SHOW_ALL_OPERATING_MODES, gameState.Cheats.showAllOperatingModes); + SetCheckboxValue(WIDX_UNLOCK_OPERATING_LIMITS, gameState.cheats.unlockOperatingLimits); + SetCheckboxValue(WIDX_DISABLE_BRAKES_FAILURE, gameState.cheats.disableBrakesFailure); + SetCheckboxValue(WIDX_DISABLE_ALL_BREAKDOWNS, gameState.cheats.disableAllBreakdowns); + SetCheckboxValue(WIDX_SHOW_ALL_OPERATING_MODES, gameState.cheats.showAllOperatingModes); SetCheckboxValue( - WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES, gameState.Cheats.showVehiclesFromOtherTrackTypes); - SetCheckboxValue(WIDX_DISABLE_TRAIN_LENGTH_LIMITS, gameState.Cheats.disableTrainLengthLimit); - SetCheckboxValue(WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, gameState.Cheats.enableChainLiftOnAllTrack); - SetCheckboxValue(WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES, gameState.Cheats.allowArbitraryRideTypeChanges); - SetCheckboxValue(WIDX_DISABLE_RIDE_VALUE_AGING, gameState.Cheats.disableRideValueAging); - SetCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gameState.Cheats.ignoreResearchStatus); - SetCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gameState.Cheats.enableAllDrawableTrackPieces); - SetCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gameState.Cheats.allowTrackPlaceInvalidHeights); - SetCheckboxValue(WIDX_MAKE_DESTRUCTIBLE, gameState.Cheats.makeAllDestructible); + WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES, gameState.cheats.showVehiclesFromOtherTrackTypes); + SetCheckboxValue(WIDX_DISABLE_TRAIN_LENGTH_LIMITS, gameState.cheats.disableTrainLengthLimit); + SetCheckboxValue(WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, gameState.cheats.enableChainLiftOnAllTrack); + SetCheckboxValue(WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES, gameState.cheats.allowArbitraryRideTypeChanges); + SetCheckboxValue(WIDX_DISABLE_RIDE_VALUE_AGING, gameState.cheats.disableRideValueAging); + SetCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gameState.cheats.ignoreResearchStatus); + SetCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gameState.cheats.enableAllDrawableTrackPieces); + SetCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gameState.cheats.allowTrackPlaceInvalidHeights); + SetCheckboxValue(WIDX_MAKE_DESTRUCTIBLE, gameState.cheats.makeAllDestructible); break; case WINDOW_CHEATS_PAGE_STAFF: - SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gameState.Cheats.disablePlantAging); + SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gameState.cheats.disablePlantAging); break; case WINDOW_CHEATS_PAGE_WEATHER: - SetCheckboxValue(WIDX_FREEZE_WEATHER, gameState.Cheats.freezeWeather); + SetCheckboxValue(WIDX_FREEZE_WEATHER, gameState.cheats.freezeWeather); break; } // Current weather if (page == WINDOW_CHEATS_PAGE_WEATHER) { - widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.WeatherCurrent.weatherType)]; + widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.weatherCurrent.weatherType)]; } // Staff speed if (page == WINDOW_CHEATS_PAGE_STAFF) { - widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(gameState.Cheats.selectedStaffSpeed)]; + widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(gameState.cheats.selectedStaffSpeed)]; } if (isInEditorMode()) @@ -940,7 +940,7 @@ static StringId window_cheats_page_titles[] = { switch (widgetIndex) { case WIDX_NO_MONEY: - CheatsSet(CheatType::NoMoney, GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY ? 0 : 1); + CheatsSet(CheatType::NoMoney, getGameState().park.Flags & PARK_FLAGS_NO_MONEY ? 0 : 1); break; case WIDX_MONEY_SPINNER: MoneyToString(_moneySpinnerValue, _moneySpinnerText, kMoneyStringMaxlength, false); @@ -984,7 +984,7 @@ static StringId window_cheats_page_titles[] = { void OnMouseDownStaff(WidgetIndex widgetIndex) { auto* widget = &widgets[widgetIndex]; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_STAFF_SPEED_DROPDOWN_BUTTON: @@ -1002,7 +1002,7 @@ static StringId window_cheats_page_titles[] = { WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); - Dropdown::SetChecked(EnumValue(gameState.Cheats.selectedStaffSpeed), true); + Dropdown::SetChecked(EnumValue(gameState.cheats.selectedStaffSpeed), true); } } } @@ -1010,7 +1010,7 @@ static StringId window_cheats_page_titles[] = { void OnMouseDownWeather(WidgetIndex widgetIndex) { auto* widget = &widgets[widgetIndex]; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_WEATHER_DROPDOWN_BUTTON: @@ -1026,7 +1026,7 @@ static StringId window_cheats_page_titles[] = { { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 3); - auto currentWeather = gameState.WeatherCurrent.weatherType; + auto currentWeather = gameState.weatherCurrent.weatherType; Dropdown::SetChecked(EnumValue(currentWeather), true); break; @@ -1036,7 +1036,7 @@ static StringId window_cheats_page_titles[] = { void OnMouseUpPark(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_OWN_ALL_LAND: @@ -1055,7 +1055,7 @@ static StringId window_cheats_page_titles[] = { CheatsSet(CheatType::HaveFun); break; case WIDX_NEVERENDING_MARKETING: - CheatsSet(CheatType::NeverendingMarketing, !gameState.Cheats.neverendingMarketing); + CheatsSet(CheatType::NeverendingMarketing, !gameState.cheats.neverendingMarketing); break; case WIDX_FORCE_PARK_RATING: if (Park::GetForcedRating() >= 0) @@ -1068,20 +1068,20 @@ static StringId window_cheats_page_titles[] = { } break; case WIDX_ALLOW_BUILD_IN_PAUSE_MODE: - CheatsSet(CheatType::BuildInPauseMode, !gameState.Cheats.buildInPauseMode); + CheatsSet(CheatType::BuildInPauseMode, !gameState.cheats.buildInPauseMode); break; case WIDX_ALLOW_REGULAR_PATH_AS_QUEUE: - CheatsSet(CheatType::AllowRegularPathAsQueue, !gameState.Cheats.allowRegularPathAsQueue); + CheatsSet(CheatType::AllowRegularPathAsQueue, !gameState.cheats.allowRegularPathAsQueue); break; case WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES: - CheatsSet(CheatType::AllowSpecialColourSchemes, !gameState.Cheats.allowSpecialColourSchemes); + CheatsSet(CheatType::AllowSpecialColourSchemes, !gameState.cheats.allowSpecialColourSchemes); break; } } void OnMouseUpStaff(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_CLEAR_GRASS: @@ -1100,18 +1100,18 @@ static StringId window_cheats_page_titles[] = { CheatsSet(CheatType::RemoveLitter); break; case WIDX_DISABLE_PLANT_AGING: - CheatsSet(CheatType::DisablePlantAging, !gameState.Cheats.disablePlantAging); + CheatsSet(CheatType::DisablePlantAging, !gameState.cheats.disablePlantAging); break; } } void OnMouseUpWeather(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_FREEZE_WEATHER: - CheatsSet(CheatType::FreezeWeather, !gameState.Cheats.freezeWeather); + CheatsSet(CheatType::FreezeWeather, !gameState.cheats.freezeWeather); break; case WIDX_CREATE_DUCKS: CheatsSet(CheatType::CreateDucks, kCheatsDuckIncrement); @@ -1132,21 +1132,21 @@ static StringId window_cheats_page_titles[] = { if (widgetIndex == WIDX_STAFF_SPEED_DROPDOWN_BUTTON) { int32_t speed = kCheatsStaffNormalSpeed; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (dropdownIndex) { case 0: - gameState.Cheats.selectedStaffSpeed = StaffSpeedCheat::None; + gameState.cheats.selectedStaffSpeed = StaffSpeedCheat::None; speed = kCheatsStaffNormalSpeed; break; case 1: - gameState.Cheats.selectedStaffSpeed = StaffSpeedCheat::Frozen; + gameState.cheats.selectedStaffSpeed = StaffSpeedCheat::Frozen; speed = kCheatsStaffFreezeSpeed; break; case 2: - gameState.Cheats.selectedStaffSpeed = StaffSpeedCheat::Fast; + gameState.cheats.selectedStaffSpeed = StaffSpeedCheat::Fast; speed = kCheatsStaffFastSpeed; } CheatsSet(CheatType::SetStaffSpeed, speed); @@ -1168,7 +1168,7 @@ static StringId window_cheats_page_titles[] = { void OnMouseUpGuests(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_GUEST_HAPPINESS_MAX: @@ -1240,42 +1240,42 @@ static StringId window_cheats_page_titles[] = { CheatsSet(CheatType::GiveAllGuests, OBJECT_UMBRELLA); break; case WIDX_GUEST_IGNORE_RIDE_INTENSITY: - CheatsSet(CheatType::IgnoreRideIntensity, !gameState.Cheats.ignoreRideIntensity); + CheatsSet(CheatType::IgnoreRideIntensity, !gameState.cheats.ignoreRideIntensity); break; case WIDX_GUEST_IGNORE_PRICE: - CheatsSet(CheatType::IgnorePrice, !gameState.Cheats.ignorePrice); + CheatsSet(CheatType::IgnorePrice, !gameState.cheats.ignorePrice); break; case WIDX_DISABLE_VANDALISM: - CheatsSet(CheatType::DisableVandalism, !gameState.Cheats.disableVandalism); + CheatsSet(CheatType::DisableVandalism, !gameState.cheats.disableVandalism); break; case WIDX_DISABLE_LITTERING: - CheatsSet(CheatType::DisableLittering, !gameState.Cheats.disableLittering); + CheatsSet(CheatType::DisableLittering, !gameState.cheats.disableLittering); break; } } void OnMouseUpRides(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_RENEW_RIDES: CheatsSet(CheatType::RenewRides); break; case WIDX_MAKE_DESTRUCTIBLE: - CheatsSet(CheatType::MakeDestructible, !gameState.Cheats.makeAllDestructible); + CheatsSet(CheatType::MakeDestructible, !gameState.cheats.makeAllDestructible); break; case WIDX_FIX_ALL: CheatsSet(CheatType::FixRides); break; case WIDX_UNLOCK_OPERATING_LIMITS: - CheatsSet(CheatType::FastLiftHill, !gameState.Cheats.unlockOperatingLimits); + CheatsSet(CheatType::FastLiftHill, !gameState.cheats.unlockOperatingLimits); break; case WIDX_DISABLE_BRAKES_FAILURE: - CheatsSet(CheatType::DisableBrakesFailure, !gameState.Cheats.disableBrakesFailure); + CheatsSet(CheatType::DisableBrakesFailure, !gameState.cheats.disableBrakesFailure); break; case WIDX_DISABLE_ALL_BREAKDOWNS: - CheatsSet(CheatType::DisableAllBreakdowns, !gameState.Cheats.disableAllBreakdowns); + CheatsSet(CheatType::DisableAllBreakdowns, !gameState.cheats.disableAllBreakdowns); break; case WIDX_RESET_CRASH_STATUS: CheatsSet(CheatType::ResetCrashStatus); @@ -1285,59 +1285,59 @@ static StringId window_cheats_page_titles[] = { break; case WIDX_SHOW_ALL_OPERATING_MODES: { - if (!gameState.Cheats.showAllOperatingModes) + if (!gameState.cheats.showAllOperatingModes) { ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } - CheatsSet(CheatType::ShowAllOperatingModes, !gameState.Cheats.showAllOperatingModes); + CheatsSet(CheatType::ShowAllOperatingModes, !gameState.cheats.showAllOperatingModes); } break; case WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES: { - if (!gameState.Cheats.showVehiclesFromOtherTrackTypes) + if (!gameState.cheats.showVehiclesFromOtherTrackTypes) { ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } - CheatsSet(CheatType::ShowVehiclesFromOtherTrackTypes, !gameState.Cheats.showVehiclesFromOtherTrackTypes); + CheatsSet(CheatType::ShowVehiclesFromOtherTrackTypes, !gameState.cheats.showVehiclesFromOtherTrackTypes); } break; case WIDX_DISABLE_TRAIN_LENGTH_LIMITS: { - if (!gameState.Cheats.disableTrainLengthLimit) + if (!gameState.cheats.disableTrainLengthLimit) { ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } - CheatsSet(CheatType::DisableTrainLengthLimit, !gameState.Cheats.disableTrainLengthLimit); + CheatsSet(CheatType::DisableTrainLengthLimit, !gameState.cheats.disableTrainLengthLimit); } break; case WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK: - CheatsSet(CheatType::EnableChainLiftOnAllTrack, !gameState.Cheats.enableChainLiftOnAllTrack); + CheatsSet(CheatType::EnableChainLiftOnAllTrack, !gameState.cheats.enableChainLiftOnAllTrack); break; case WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES: { - if (!gameState.Cheats.allowArbitraryRideTypeChanges) + if (!gameState.cheats.allowArbitraryRideTypeChanges) { ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } - CheatsSet(CheatType::AllowArbitraryRideTypeChanges, !gameState.Cheats.allowArbitraryRideTypeChanges); + CheatsSet(CheatType::AllowArbitraryRideTypeChanges, !gameState.cheats.allowArbitraryRideTypeChanges); } break; case WIDX_DISABLE_RIDE_VALUE_AGING: - CheatsSet(CheatType::DisableRideValueAging, !gameState.Cheats.disableRideValueAging); + CheatsSet(CheatType::DisableRideValueAging, !gameState.cheats.disableRideValueAging); break; case WIDX_IGNORE_RESEARCH_STATUS: - CheatsSet(CheatType::IgnoreResearchStatus, !gameState.Cheats.ignoreResearchStatus); + CheatsSet(CheatType::IgnoreResearchStatus, !gameState.cheats.ignoreResearchStatus); break; case WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES: - CheatsSet(CheatType::EnableAllDrawableTrackPieces, !gameState.Cheats.enableAllDrawableTrackPieces); + CheatsSet(CheatType::EnableAllDrawableTrackPieces, !gameState.cheats.enableAllDrawableTrackPieces); break; case WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS: { - if (!gameState.Cheats.allowTrackPlaceInvalidHeights) + if (!gameState.cheats.allowTrackPlaceInvalidHeights) { ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } - CheatsSet(CheatType::AllowTrackPlaceInvalidHeights, !gameState.Cheats.allowTrackPlaceInvalidHeights); + CheatsSet(CheatType::AllowTrackPlaceInvalidHeights, !gameState.cheats.allowTrackPlaceInvalidHeights); } break; } diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index c3d236d605..1f6795b31d 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -197,7 +197,7 @@ namespace OpenRCT2::Ui::Windows // Draw cost amount if (_clearSceneryCost != kMoney64Undefined && _clearSceneryCost != 0 - && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_clearSceneryCost); diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 4aaa0e87cb..bad78bbfab 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -82,7 +82,7 @@ namespace OpenRCT2::Ui::Windows auto currentRide = GetRide(rideId); if (currentRide != nullptr) { - auto stringId = (GetGameState().Park.Flags & 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; auto ft = Formatter(); currentRide->formatNameTo(ft); diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 0a7c0a65ae..ecdc24dc01 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -505,7 +505,7 @@ namespace OpenRCT2::Ui::Windows { int32_t defaultIndex = -1; - const bool specialColoursEnabled = !alwaysHideSpecialColours && GetGameState().Cheats.allowSpecialColourSchemes; + const bool specialColoursEnabled = !alwaysHideSpecialColours && getGameState().cheats.allowSpecialColourSchemes; auto numColours = specialColoursEnabled ? static_cast(COLOUR_COUNT) : kColourNumNormal; // Set items for (uint64_t i = 0; i < numColours; i++) diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 7271bb8715..f7db8c0b32 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -93,19 +93,19 @@ namespace OpenRCT2::Ui::Windows } else { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.EditorStep == EditorStep::ObjectSelection) + if (gameState.editorStep == EditorStep::ObjectSelection) { HidePreviousStepButton(); } - else if (gameState.EditorStep == EditorStep::RollercoasterDesigner) + else if (gameState.editorStep == EditorStep::RollercoasterDesigner) { HideNextStepButton(); } else if (gLegacyScene != LegacyScene::trackDesigner) { - if (GetNumFreeEntities() != kMaxEntities || GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED) + if (GetNumFreeEntities() != kMaxEntities || getGameState().park.Flags & PARK_FLAGS_SPRITES_INITIALISED) { HidePreviousStepButton(); } @@ -137,18 +137,18 @@ namespace OpenRCT2::Ui::Windows void OnMouseUp(WidgetIndex widgetIndex) override { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON) { if (gLegacyScene == LegacyScene::trackDesigner - || (GetNumFreeEntities() == kMaxEntities && !(gameState.Park.Flags & PARK_FLAGS_SPRITES_INITIALISED))) + || (GetNumFreeEntities() == kMaxEntities && !(gameState.park.Flags & PARK_FLAGS_SPRITES_INITIALISED))) { - ((this)->*(kPreviousButtonMouseUp[EnumValue(gameState.EditorStep)]))(); + ((this)->*(kPreviousButtonMouseUp[EnumValue(gameState.editorStep)]))(); } } else if (widgetIndex == WIDX_NEXT_STEP_BUTTON) { - ((this)->*(kNextButtonMouseUp[EnumValue(gameState.EditorStep)]))(); + ((this)->*(kNextButtonMouseUp[EnumValue(gameState.editorStep)]))(); } } @@ -158,7 +158,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseAll(); - GetGameState().EditorStep = EditorStep::ObjectSelection; + getGameState().editorStep = EditorStep::ObjectSelection; GfxInvalidateScreen(); } @@ -169,7 +169,7 @@ namespace OpenRCT2::Ui::Windows SetAllSceneryItemsInvented(); WindowScenerySetDefaultPlacementConfiguration(); - GetGameState().EditorStep = EditorStep::LandscapeEditor; + getGameState().editorStep = EditorStep::LandscapeEditor; ContextOpenWindow(WindowClass::Map); GfxInvalidateScreen(); } @@ -180,7 +180,7 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseAll(); ContextOpenWindow(WindowClass::EditorInventionList); - GetGameState().EditorStep = EditorStep::InventionsListSetUp; + getGameState().editorStep = EditorStep::InventionsListSetUp; GfxInvalidateScreen(); } @@ -190,7 +190,7 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseAll(); ContextOpenWindow(WindowClass::EditorScenarioOptions); - GetGameState().EditorStep = EditorStep::OptionsSelection; + getGameState().editorStep = EditorStep::OptionsSelection; GfxInvalidateScreen(); } @@ -222,7 +222,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseAll(); ContextOpenWindow(WindowClass::EditorInventionList); - GetGameState().EditorStep = EditorStep::InventionsListSetUp; + getGameState().editorStep = EditorStep::InventionsListSetUp; } else { @@ -238,7 +238,7 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseAll(); ContextOpenWindow(WindowClass::EditorScenarioOptions); - GetGameState().EditorStep = EditorStep::OptionsSelection; + getGameState().editorStep = EditorStep::OptionsSelection; GfxInvalidateScreen(); } @@ -248,13 +248,13 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseAll(); ContextOpenWindow(WindowClass::EditorObjectiveOptions); - GetGameState().EditorStep = EditorStep::ObjectiveSelection; + getGameState().editorStep = EditorStep::ObjectiveSelection; GfxInvalidateScreen(); } void JumpForwardToSaveScenario() const { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto savePrepareResult = ScenarioPrepareForSave(gameState); if (!savePrepareResult.Successful) { @@ -268,7 +268,7 @@ namespace OpenRCT2::Ui::Windows auto intent = Intent(WindowClass::Loadsave); intent.PutEnumExtra(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save); intent.PutEnumExtra(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::scenario); - intent.PutExtra(INTENT_EXTRA_PATH, gameState.ScenarioName); + intent.PutExtra(INTENT_EXTRA_PATH, gameState.scenarioName); ContextOpenIntent(&intent); } @@ -314,7 +314,7 @@ namespace OpenRCT2::Ui::Windows int16_t textX = (widgets[WIDX_PREVIOUS_IMAGE].left + 30 + widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + windowPos.x; int16_t textY = widgets[WIDX_PREVIOUS_IMAGE].top + 6 + windowPos.y; - StringId stringId = kEditorStepNames[EnumValue(GetGameState().EditorStep) - 1]; + StringId stringId = kEditorStepNames[EnumValue(getGameState().editorStep) - 1]; if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; @@ -353,7 +353,7 @@ namespace OpenRCT2::Ui::Windows int16_t textX = (widgets[WIDX_NEXT_IMAGE].left + widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + windowPos.x; int16_t textY = widgets[WIDX_NEXT_IMAGE].top + 6 + windowPos.y; - StringId stringId = kEditorStepNames[EnumValue(GetGameState().EditorStep) + 1]; + StringId stringId = kEditorStepNames[EnumValue(getGameState().editorStep) + 1]; if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; @@ -367,7 +367,7 @@ namespace OpenRCT2::Ui::Windows int16_t stateY = height - 0x0C + windowPos.y; auto colour = colours[2].withFlag(ColourFlag::translucent, false).withFlag(ColourFlag::withOutline, true); DrawTextBasic( - dpi, { stateX, stateY }, kEditorStepNames[EnumValue(GetGameState().EditorStep)], {}, + dpi, { stateX, stateY }, kEditorStepNames[EnumValue(getGameState().editorStep)], {}, { colour, TextAlignment::CENTRE }); } diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 0017d5598d..d0fb68ea01 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -224,15 +224,15 @@ namespace OpenRCT2::Ui::Windows ScreenSize OnScrollGetSize(int32_t scrollIndex) override { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); ScreenSize size{}; if (scrollIndex == 0) { - size.height = static_cast(gameState.ResearchItemsInvented.size()) * kScrollableRowHeight; + size.height = static_cast(gameState.researchItemsInvented.size()) * kScrollableRowHeight; } else { - size.height = static_cast(gameState.ResearchItemsUninvented.size()) * kScrollableRowHeight; + size.height = static_cast(gameState.researchItemsUninvented.size()) * kScrollableRowHeight; } return size; } @@ -270,7 +270,7 @@ namespace OpenRCT2::Ui::Windows void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); // Draw background uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light; @@ -280,7 +280,7 @@ namespace OpenRCT2::Ui::Windows int32_t itemY = -kScrollableRowHeight; auto* dragItem = WindowEditorInventionsListDragGetItem(); - const auto& researchList = scrollIndex == 0 ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + const auto& researchList = scrollIndex == 0 ? gameState.researchItemsInvented : gameState.researchItemsUninvented; for (const auto& researchItem : researchList) { itemY += kScrollableRowHeight; @@ -522,7 +522,7 @@ namespace OpenRCT2::Ui::Windows void MoveResearchItem(const ResearchItem& item, ResearchItem* beforeItem, bool isInvented) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); _selectedResearchItem = nullptr; Invalidate(); @@ -535,7 +535,7 @@ namespace OpenRCT2::Ui::Windows ResearchRemove(item); - auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + auto& researchList = isInvented ? gameState.researchItemsInvented : gameState.researchItemsUninvented; if (beforeItem != nullptr) { for (size_t i = 0; i < researchList.size(); i++) @@ -555,8 +555,8 @@ namespace OpenRCT2::Ui::Windows private: ResearchItem* GetItemFromScrollY(bool isInvented, int32_t y) const { - auto& gameState = GetGameState(); - auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + auto& gameState = getGameState(); + auto& researchList = isInvented ? gameState.researchItemsInvented : gameState.researchItemsUninvented; for (auto& researchItem : researchList) { y -= kScrollableRowHeight; @@ -571,8 +571,8 @@ namespace OpenRCT2::Ui::Windows ResearchItem* GetItemFromScrollYIncludeSeps(bool isInvented, int32_t y) const { - auto& gameState = GetGameState(); - auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented; + auto& gameState = getGameState(); + auto& researchList = isInvented ? gameState.researchItemsInvented : gameState.researchItemsUninvented; for (auto& researchItem : researchList) { y -= kScrollableRowHeight; diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index a77227f326..05ce2a82e2 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -1598,7 +1598,7 @@ namespace OpenRCT2::Ui::Windows SetEveryRideTypeInvented(); SetEveryRideEntryInvented(); - GetGameState().EditorStep = EditorStep::DesignsManager; + getGameState().editorStep = EditorStep::DesignsManager; int32_t entry_index = 0; for (; ObjectEntryGetChunk(ObjectType::ride, entry_index) == nullptr; entry_index++) diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 18af756612..a4ffdd701a 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -385,8 +385,8 @@ namespace OpenRCT2::Ui::Windows */ void SetObjective(int32_t objective) { - auto& gameState = GetGameState(); - gameState.ScenarioObjective.Type = objective; + auto& gameState = getGameState(); + gameState.scenarioObjective.Type = objective; Invalidate(); // Set default objective arguments @@ -398,37 +398,37 @@ namespace OpenRCT2::Ui::Windows case OBJECTIVE_10_ROLLERCOASTERS: break; case OBJECTIVE_GUESTS_BY: - gameState.ScenarioObjective.Year = 3; - gameState.ScenarioObjective.NumGuests = 1500; + gameState.scenarioObjective.Year = 3; + gameState.scenarioObjective.NumGuests = 1500; break; case OBJECTIVE_PARK_VALUE_BY: - gameState.ScenarioObjective.Year = 3; - gameState.ScenarioObjective.Currency = 50000.00_GBP; + gameState.scenarioObjective.Year = 3; + gameState.scenarioObjective.Currency = 50000.00_GBP; break; case OBJECTIVE_GUESTS_AND_RATING: - gameState.ScenarioObjective.NumGuests = 2000; + gameState.scenarioObjective.NumGuests = 2000; break; case OBJECTIVE_MONTHLY_RIDE_INCOME: - gameState.ScenarioObjective.Currency = 10000.00_GBP; + gameState.scenarioObjective.Currency = 10000.00_GBP; break; case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - gameState.ScenarioObjective.MinimumLength = 1200; + gameState.scenarioObjective.MinimumLength = 1200; break; case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - gameState.ScenarioObjective.MinimumExcitement = MakeRideRating(6, 70); + gameState.scenarioObjective.MinimumExcitement = MakeRideRating(6, 70); break; case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - gameState.ScenarioObjective.Currency = 50000.00_GBP; + gameState.scenarioObjective.Currency = 50000.00_GBP; break; case OBJECTIVE_MONTHLY_FOOD_INCOME: - gameState.ScenarioObjective.Currency = 1000.00_GBP; + gameState.scenarioObjective.Currency = 1000.00_GBP; break; } } void ShowObjectiveDropdown() { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); int32_t numItems = 0, objectiveType; Widget* dropdownWidget; @@ -439,7 +439,7 @@ namespace OpenRCT2::Ui::Windows if (i == OBJECTIVE_NONE || i == OBJECTIVE_BUILD_THE_BEST) continue; - const bool objectiveAllowedByMoneyUsage = !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + const bool objectiveAllowedByMoneyUsage = !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY) || !ObjectiveNeedsMoney(i); // This objective can only work if the player can ask money for rides. const bool objectiveAllowedByPaymentSettings = (i != OBJECTIVE_MONTHLY_RIDE_INCOME) @@ -456,7 +456,7 @@ namespace OpenRCT2::Ui::Windows { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3); - objectiveType = gameState.ScenarioObjective.Type; + objectiveType = gameState.scenarioObjective.Type; for (int32_t j = 0; j < numItems; j++) { if (gDropdownItems[j].Args - STR_OBJECTIVE_DROPDOWN_NONE == objectiveType) @@ -482,68 +482,68 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 3); - Dropdown::SetChecked(GetGameState().ScenarioCategory, true); + Dropdown::SetChecked(getGameState().scenarioCategory, true); } void Arg1Increase() { - auto& gameState = GetGameState(); - switch (gameState.ScenarioObjective.Type) + auto& gameState = getGameState(); + switch (gameState.scenarioObjective.Type) { case OBJECTIVE_PARK_VALUE_BY: case OBJECTIVE_MONTHLY_RIDE_INCOME: case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - if (gameState.ScenarioObjective.Currency >= kObjectiveCurrencyLoanAndValueMax) + if (gameState.scenarioObjective.Currency >= kObjectiveCurrencyLoanAndValueMax) { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.Currency += kObjectiveCurrencyLoanAndValueAdjustment; + gameState.scenarioObjective.Currency += kObjectiveCurrencyLoanAndValueAdjustment; Invalidate(); } break; case OBJECTIVE_MONTHLY_FOOD_INCOME: - if (gameState.ScenarioObjective.Currency >= kObjectiveCurrencyFoodMax) + if (gameState.scenarioObjective.Currency >= kObjectiveCurrencyFoodMax) { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.Currency += kObjectiveCurrencyFoodAdjustment; + gameState.scenarioObjective.Currency += kObjectiveCurrencyFoodAdjustment; Invalidate(); } break; case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - if (gameState.ScenarioObjective.MinimumLength >= kObjectiveLengthMax) + if (gameState.scenarioObjective.MinimumLength >= kObjectiveLengthMax) { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.MinimumLength += kObjectiveLengthAdjustment; + gameState.scenarioObjective.MinimumLength += kObjectiveLengthAdjustment; Invalidate(); } break; case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - if (gameState.ScenarioObjective.MinimumExcitement >= kObjectiveExcitementMax) + if (gameState.scenarioObjective.MinimumExcitement >= kObjectiveExcitementMax) { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.MinimumExcitement += kObjectiveExcitementAdjustment; + gameState.scenarioObjective.MinimumExcitement += kObjectiveExcitementAdjustment; Invalidate(); } break; default: - if (gameState.ScenarioObjective.NumGuests >= kObjectiveGuestsMax) + if (gameState.scenarioObjective.NumGuests >= kObjectiveGuestsMax) { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.NumGuests += kObjectiveGuestsAdjustment; + gameState.scenarioObjective.NumGuests += kObjectiveGuestsAdjustment; Invalidate(); } break; @@ -552,63 +552,63 @@ namespace OpenRCT2::Ui::Windows void Arg1Decrease() { - auto& gameState = GetGameState(); - switch (gameState.ScenarioObjective.Type) + auto& gameState = getGameState(); + switch (gameState.scenarioObjective.Type) { case OBJECTIVE_PARK_VALUE_BY: case OBJECTIVE_MONTHLY_RIDE_INCOME: case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - if (gameState.ScenarioObjective.Currency <= kObjectiveCurrencyLoanAndValueMin) + if (gameState.scenarioObjective.Currency <= kObjectiveCurrencyLoanAndValueMin) { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.Currency -= kObjectiveCurrencyLoanAndValueAdjustment; + gameState.scenarioObjective.Currency -= kObjectiveCurrencyLoanAndValueAdjustment; Invalidate(); } break; case OBJECTIVE_MONTHLY_FOOD_INCOME: - if (gameState.ScenarioObjective.Currency <= kObjectiveCurrencyFoodMin) + if (gameState.scenarioObjective.Currency <= kObjectiveCurrencyFoodMin) { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.Currency -= kObjectiveCurrencyFoodAdjustment; + gameState.scenarioObjective.Currency -= kObjectiveCurrencyFoodAdjustment; Invalidate(); } break; case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: - if (gameState.ScenarioObjective.MinimumLength <= kObjectiveLengthMin) + if (gameState.scenarioObjective.MinimumLength <= kObjectiveLengthMin) { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.MinimumLength -= kObjectiveLengthAdjustment; + gameState.scenarioObjective.MinimumLength -= kObjectiveLengthAdjustment; Invalidate(); } break; case OBJECTIVE_FINISH_5_ROLLERCOASTERS: - if (gameState.ScenarioObjective.MinimumExcitement <= kObjectiveExcitementMin) + if (gameState.scenarioObjective.MinimumExcitement <= kObjectiveExcitementMin) { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.MinimumExcitement -= kObjectiveExcitementAdjustment; + gameState.scenarioObjective.MinimumExcitement -= kObjectiveExcitementAdjustment; Invalidate(); } break; default: - if (gameState.ScenarioObjective.NumGuests <= kObjectiveGuestsMin) + if (gameState.scenarioObjective.NumGuests <= kObjectiveGuestsMin) { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.NumGuests -= kObjectiveGuestsAdjustment; + gameState.scenarioObjective.NumGuests -= kObjectiveGuestsAdjustment; Invalidate(); } break; @@ -617,28 +617,28 @@ namespace OpenRCT2::Ui::Windows void Arg2Increase() { - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Year >= kObjectiveYearMax) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Year >= kObjectiveYearMax) { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.Year += kObjectiveYearAdjustment; + gameState.scenarioObjective.Year += kObjectiveYearAdjustment; Invalidate(); } } void Arg2Decrease() { - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Year <= kObjectiveYearMin) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Year <= kObjectiveYearMin) { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } else { - gameState.ScenarioObjective.Year -= kObjectiveYearAdjustment; + gameState.scenarioObjective.Year -= kObjectiveYearAdjustment; Invalidate(); } } @@ -651,25 +651,25 @@ namespace OpenRCT2::Ui::Windows */ void OnMouseUpMain(WidgetIndex widgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_PARK_NAME: { WindowTextInputRawOpen( - this, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, {}, gameState.Park.Name.c_str(), + this, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, {}, gameState.park.Name.c_str(), kParkNameMaxLength); break; } case WIDX_SCENARIO_NAME: WindowTextInputRawOpen( this, WIDX_SCENARIO_NAME, STR_SCENARIO_NAME, STR_ENTER_SCENARIO_NAME, {}, - gameState.ScenarioName.c_str(), kScenarioNameMaxLength); + gameState.scenarioName.c_str(), kScenarioNameMaxLength); break; case WIDX_DETAILS: WindowTextInputRawOpen( this, WIDX_DETAILS, STR_PARK_SCENARIO_DETAILS, STR_ENTER_SCENARIO_DESCRIPTION, {}, - gameState.ScenarioDetails.c_str(), kScenarioDetailsNameMaxLength); + gameState.scenarioDetails.c_str(), kScenarioDetailsNameMaxLength); break; } } @@ -718,7 +718,7 @@ namespace OpenRCT2::Ui::Windows */ void OnDropdownMain(WidgetIndex widgetIndex, int32_t dropdownIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); uint8_t newObjectiveType; if (dropdownIndex == -1) @@ -729,13 +729,13 @@ namespace OpenRCT2::Ui::Windows case WIDX_OBJECTIVE_DROPDOWN: // TODO: Don't rely on string ID order newObjectiveType = static_cast(gDropdownItems[dropdownIndex].Args - STR_OBJECTIVE_DROPDOWN_NONE); - if (gameState.ScenarioObjective.Type != newObjectiveType) + if (gameState.scenarioObjective.Type != newObjectiveType) SetObjective(newObjectiveType); break; case WIDX_CATEGORY_DROPDOWN: - if (gameState.ScenarioCategory != static_cast(dropdownIndex)) + if (gameState.scenarioCategory != static_cast(dropdownIndex)) { - gameState.ScenarioCategory = static_cast(dropdownIndex); + gameState.scenarioCategory = static_cast(dropdownIndex); Invalidate(); } break; @@ -754,10 +754,10 @@ namespace OpenRCT2::Ui::Windows OnPrepareDraw(); InvalidateWidget(WIDX_TAB_1); - objectiveType = GetGameState().ScenarioObjective.Type; + objectiveType = getGameState().scenarioObjective.Type; // Check if objective is allowed by money and pay-per-ride settings. - const bool objectiveAllowedByMoneyUsage = !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + const bool objectiveAllowedByMoneyUsage = !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY) || !ObjectiveNeedsMoney(objectiveType); // This objective can only work if the player can ask money for rides. const bool objectiveAllowedByPaymentSettings = (objectiveType != OBJECTIVE_MONTHLY_RIDE_INCOME) @@ -778,7 +778,7 @@ namespace OpenRCT2::Ui::Windows if (text.empty()) return; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_PARK_NAME: @@ -786,18 +786,18 @@ namespace OpenRCT2::Ui::Windows auto action = ParkSetNameAction(std::string(text)); GameActions::Execute(&action); - if (gameState.ScenarioName.empty()) + if (gameState.scenarioName.empty()) { - gameState.ScenarioName = gameState.Park.Name; + gameState.scenarioName = gameState.park.Name; } break; } case WIDX_SCENARIO_NAME: - gameState.ScenarioName = text; + gameState.scenarioName = text; Invalidate(); break; case WIDX_DETAILS: - gameState.ScenarioDetails = text; + gameState.scenarioDetails = text; Invalidate(); break; } @@ -809,11 +809,11 @@ namespace OpenRCT2::Ui::Windows */ void OnPrepareDrawMain() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); SetPressedTab(); - switch (gameState.ScenarioObjective.Type) + switch (gameState.scenarioObjective.Type) { case OBJECTIVE_GUESTS_BY: case OBJECTIVE_PARK_VALUE_BY: @@ -859,7 +859,7 @@ namespace OpenRCT2::Ui::Windows */ void OnDrawMain(DrawPixelInfo& dpi) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); int32_t widthToSet; StringId stringId; @@ -873,14 +873,14 @@ namespace OpenRCT2::Ui::Windows // Objective value screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE].left + 1, widgets[WIDX_OBJECTIVE].top }; auto ft = Formatter(); - ft.Add(ObjectiveDropdownOptionNames[gameState.ScenarioObjective.Type]); + ft.Add(ObjectiveDropdownOptionNames[gameState.scenarioObjective.Type]); DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); if (widgets[WIDX_OBJECTIVE_ARG_1].type != WindowWidgetType::Empty) { // Objective argument 1 label screenCoords = windowPos + ScreenCoordsXY{ 28, widgets[WIDX_OBJECTIVE_ARG_1].top }; - switch (gameState.ScenarioObjective.Type) + switch (gameState.scenarioObjective.Type) { case OBJECTIVE_GUESTS_BY: case OBJECTIVE_GUESTS_AND_RATING: @@ -909,31 +909,31 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_1].left + 1, widgets[WIDX_OBJECTIVE_ARG_1].top }; ft = Formatter(); - switch (gameState.ScenarioObjective.Type) + switch (gameState.scenarioObjective.Type) { case OBJECTIVE_GUESTS_BY: case OBJECTIVE_GUESTS_AND_RATING: stringId = STR_WINDOW_COLOUR_2_COMMA32; - ft.Add(gameState.ScenarioObjective.NumGuests); + ft.Add(gameState.scenarioObjective.NumGuests); break; case OBJECTIVE_PARK_VALUE_BY: case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: case OBJECTIVE_MONTHLY_RIDE_INCOME: case OBJECTIVE_MONTHLY_FOOD_INCOME: stringId = STR_CURRENCY_FORMAT_LABEL; - ft.Add(gameState.ScenarioObjective.Currency); + ft.Add(gameState.scenarioObjective.Currency); break; case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: stringId = STR_WINDOW_COLOUR_2_LENGTH; - ft.Add(gameState.ScenarioObjective.MinimumLength); + ft.Add(gameState.scenarioObjective.MinimumLength); break; case OBJECTIVE_FINISH_5_ROLLERCOASTERS: stringId = STR_WINDOW_COLOUR_2_COMMA2DP32; - ft.Add(gameState.ScenarioObjective.MinimumExcitement); + ft.Add(gameState.scenarioObjective.MinimumExcitement); break; default: stringId = STR_WINDOW_COLOUR_2_COMMA2DP32; - ft.Add(gameState.ScenarioObjective.Currency); + ft.Add(gameState.scenarioObjective.Currency); break; } DrawTextBasic(dpi, screenCoords, stringId, ft, { COLOUR_BLACK }); @@ -949,7 +949,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_2].left + 1, widgets[WIDX_OBJECTIVE_ARG_2].top }; ft = Formatter(); - ft.Add((gameState.ScenarioObjective.Year * MONTH_COUNT) - 1); + ft.Add((gameState.scenarioObjective.Year * MONTH_COUNT) - 1); DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_VALUE_DATE, ft); } @@ -958,7 +958,7 @@ namespace OpenRCT2::Ui::Windows widthToSet = widgets[WIDX_PARK_NAME].left - 16; { - auto parkName = GetGameState().Park.Name.c_str(); + auto parkName = getGameState().park.Name.c_str(); ft = Formatter(); ft.Add(STR_STRING); @@ -972,7 +972,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(STR_STRING); - ft.Add(gameState.ScenarioName.c_str()); + ft.Add(gameState.scenarioName.c_str()); DrawTextEllipsised(dpi, screenCoords, widthToSet, STR_WINDOW_SCENARIO_NAME, ft); // Scenario details label @@ -985,7 +985,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(STR_STRING); - ft.Add(gameState.ScenarioDetails.c_str()); + ft.Add(gameState.scenarioDetails.c_str()); DrawTextWrapped(dpi, screenCoords, widthToSet, STR_BLACK_STRING, ft); // Scenario category label @@ -995,7 +995,7 @@ namespace OpenRCT2::Ui::Windows // Scenario category value screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_CATEGORY].left + 1, widgets[WIDX_CATEGORY].top }; ft = Formatter(); - ft.Add(kScenarioCategoryStringIds[gameState.ScenarioCategory]); + ft.Add(kScenarioCategoryStringIds[gameState.scenarioCategory]); DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); } diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 70f9235994..18dfaf22be 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -359,7 +359,7 @@ namespace OpenRCT2::Ui::Windows void FinancialMouseUp(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_CLOSE: @@ -372,7 +372,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_NO_MONEY: { - auto newMoneySetting = (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) ? 0 : 1; + auto newMoneySetting = (gameState.park.Flags & PARK_FLAGS_NO_MONEY) ? 0 : 1; auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::NoMoney, newMoneySetting); GameActions::Execute(&scenarioSetSetting); Invalidate(); @@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::Windows { auto scenarioSetSetting = ScenarioSetSettingAction( ScenarioSetSetting::ForbidMarketingCampaigns, - gameState.Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1); + gameState.park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1); GameActions::Execute(&scenarioSetSetting); Invalidate(); break; @@ -390,7 +390,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_RCT1_INTEREST: { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::UseRCT1Interest, gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1); + ScenarioSetSetting::UseRCT1Interest, gameState.park.Flags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1); GameActions::Execute(&scenarioSetSetting); Invalidate(); break; @@ -405,14 +405,14 @@ namespace OpenRCT2::Ui::Windows void FinancialMouseDown(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_INITIAL_CASH_INCREASE: - if (gameState.InitialCash < 1000000.00_GBP) + if (gameState.initialCash < 1000000.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialCash, gameState.InitialCash + 500.00_GBP); + ScenarioSetSetting::InitialCash, gameState.initialCash + 500.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -422,10 +422,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_INITIAL_CASH_DECREASE: - if (gameState.InitialCash > 0.00_GBP) + if (gameState.initialCash > 0.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialCash, gameState.InitialCash - 500.00_GBP); + ScenarioSetSetting::InitialCash, gameState.initialCash - 500.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -435,10 +435,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_INITIAL_LOAN_INCREASE: - if (gameState.BankLoan < 5000000.00_GBP) + if (gameState.bankLoan < 5000000.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialLoan, gameState.BankLoan + 1000.00_GBP); + ScenarioSetSetting::InitialLoan, gameState.bankLoan + 1000.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -448,10 +448,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_INITIAL_LOAN_DECREASE: - if (gameState.BankLoan > 0.00_GBP) + if (gameState.bankLoan > 0.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::InitialLoan, gameState.BankLoan - 1000.00_GBP); + ScenarioSetSetting::InitialLoan, gameState.bankLoan - 1000.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -461,10 +461,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_MAXIMUM_LOAN_INCREASE: - if (gameState.MaxBankLoan < 5000000.00_GBP) + if (gameState.maxBankLoan < 5000000.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::MaximumLoanSize, gameState.MaxBankLoan + 1000.00_GBP); + ScenarioSetSetting::MaximumLoanSize, gameState.maxBankLoan + 1000.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -474,10 +474,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_MAXIMUM_LOAN_DECREASE: - if (gameState.MaxBankLoan > 0.00_GBP) + if (gameState.maxBankLoan > 0.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::MaximumLoanSize, gameState.MaxBankLoan - 1000.00_GBP); + ScenarioSetSetting::MaximumLoanSize, gameState.maxBankLoan - 1000.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -487,10 +487,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_INTEREST_RATE_INCREASE: - if (gameState.BankLoanInterestRate < MaxBankLoanInterestRate) + if (gameState.bankLoanInterestRate < MaxBankLoanInterestRate) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::AnnualInterestRate, gameState.BankLoanInterestRate + 1); + ScenarioSetSetting::AnnualInterestRate, gameState.bankLoanInterestRate + 1); GameActions::Execute(&scenarioSetSetting); } else @@ -500,9 +500,9 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_INTEREST_RATE_DECREASE: - if (gameState.BankLoanInterestRate > 0) + if (gameState.bankLoanInterestRate > 0) { - auto interest = std::min(MaxBankLoanInterestRate, gameState.BankLoanInterestRate - 1); + auto interest = std::min(MaxBankLoanInterestRate, gameState.bankLoanInterestRate - 1); auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::AnnualInterestRate, interest); GameActions::Execute(&scenarioSetSetting); } @@ -533,8 +533,8 @@ namespace OpenRCT2::Ui::Windows { SetPressedTab(); - auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { SetWidgetPressed(WIDX_NO_MONEY, true); for (int32_t i = WIDX_INITIAL_CASH; i <= WIDX_RCT1_INTEREST; i++) @@ -554,7 +554,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_MAXIMUM_LOAN_DECREASE].type = WindowWidgetType::Button; widgets[WIDX_FORBID_MARKETING].type = WindowWidgetType::Checkbox; - if (gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST) + if (gameState.park.Flags & PARK_FLAGS_RCT1_INTEREST) { widgets[WIDX_INTEREST_RATE].type = WindowWidgetType::Empty; widgets[WIDX_INTEREST_RATE_INCREASE].type = WindowWidgetType::Empty; @@ -571,7 +571,7 @@ namespace OpenRCT2::Ui::Windows } } - SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); + SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty : WindowWidgetType::CloseBox; @@ -586,7 +586,7 @@ namespace OpenRCT2::Ui::Windows WindowDrawWidgets(*this, dpi); DrawTabImages(dpi); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto& initialCashWidget = widgets[WIDX_INITIAL_CASH]; if (initialCashWidget.type != WindowWidgetType::Empty) @@ -596,7 +596,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ initialCashWidget.left + 1, initialCashWidget.top }; auto ft = Formatter(); - ft.Add(GetGameState().InitialCash); + ft.Add(getGameState().initialCash); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } @@ -608,7 +608,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ initialLoanWidget.left + 1, initialLoanWidget.top }; auto ft = Formatter(); - ft.Add(gameState.BankLoan); + ft.Add(gameState.bankLoan); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } @@ -620,7 +620,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ maximumLoanWidget.left + 1, maximumLoanWidget.top }; auto ft = Formatter(); - ft.Add(GetGameState().MaxBankLoan); + ft.Add(getGameState().maxBankLoan); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } @@ -634,7 +634,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add( - std::clamp(static_cast(gameState.BankLoanInterestRate), INT16_MIN, INT16_MAX)); + std::clamp(static_cast(gameState.bankLoanInterestRate), INT16_MIN, INT16_MAX)); DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); } } @@ -665,15 +665,15 @@ namespace OpenRCT2::Ui::Windows void GuestsMouseDown(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_CASH_PER_GUEST_INCREASE: - if (gameState.GuestInitialCash < 1000.00_GBP) + if (gameState.guestInitialCash < 1000.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::AverageCashPerGuest, gameState.GuestInitialCash + 1.00_GBP); + ScenarioSetSetting::AverageCashPerGuest, gameState.guestInitialCash + 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -683,10 +683,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_CASH_PER_GUEST_DECREASE: - if (gameState.GuestInitialCash > 0.00_GBP) + if (gameState.guestInitialCash > 0.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::AverageCashPerGuest, gameState.GuestInitialCash - 1.00_GBP); + ScenarioSetSetting::AverageCashPerGuest, gameState.guestInitialCash - 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -696,10 +696,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_GUEST_INITIAL_HAPPINESS_INCREASE: - if (gameState.GuestInitialHappiness < 250) + if (gameState.guestInitialHappiness < 250) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHappiness, gameState.GuestInitialHappiness + 4); + ScenarioSetSetting::GuestInitialHappiness, gameState.guestInitialHappiness + 4); GameActions::Execute(&scenarioSetSetting); } else @@ -709,10 +709,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_GUEST_INITIAL_HAPPINESS_DECREASE: - if (gameState.GuestInitialHappiness > 40) + if (gameState.guestInitialHappiness > 40) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHappiness, gameState.GuestInitialHappiness - 4); + ScenarioSetSetting::GuestInitialHappiness, gameState.guestInitialHappiness - 4); GameActions::Execute(&scenarioSetSetting); } else @@ -722,10 +722,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_GUEST_INITIAL_HUNGER_INCREASE: - if (gameState.GuestInitialHunger > 40) + if (gameState.guestInitialHunger > 40) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHunger, gameState.GuestInitialHunger - 4); + ScenarioSetSetting::GuestInitialHunger, gameState.guestInitialHunger - 4); GameActions::Execute(&scenarioSetSetting); } else @@ -735,10 +735,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_GUEST_INITIAL_HUNGER_DECREASE: - if (gameState.GuestInitialHunger < 250) + if (gameState.guestInitialHunger < 250) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialHunger, gameState.GuestInitialHunger + 4); + ScenarioSetSetting::GuestInitialHunger, gameState.guestInitialHunger + 4); GameActions::Execute(&scenarioSetSetting); } else @@ -748,10 +748,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_GUEST_INITIAL_THIRST_INCREASE: - if (gameState.GuestInitialThirst > 40) + if (gameState.guestInitialThirst > 40) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialThirst, gameState.GuestInitialThirst - 4); + ScenarioSetSetting::GuestInitialThirst, gameState.guestInitialThirst - 4); GameActions::Execute(&scenarioSetSetting); } else @@ -761,10 +761,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_GUEST_INITIAL_THIRST_DECREASE: - if (gameState.GuestInitialThirst < 250) + if (gameState.guestInitialThirst < 250) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::GuestInitialThirst, gameState.GuestInitialThirst + 4); + ScenarioSetSetting::GuestInitialThirst, gameState.guestInitialThirst + 4); GameActions::Execute(&scenarioSetSetting); } else @@ -792,8 +792,8 @@ namespace OpenRCT2::Ui::Windows { windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() - 1, colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget.width() - 3); - const auto preferLess = gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES; - const auto preferMore = gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES; + const auto preferLess = gameState.park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES; + const auto preferMore = gameState.park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES; auto prefItem = 1; if (preferLess && preferMore) @@ -837,8 +837,8 @@ namespace OpenRCT2::Ui::Windows { SetPressedTab(); - auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { widgets[WIDX_CASH_PER_GUEST].type = WindowWidgetType::Empty; widgets[WIDX_CASH_PER_GUEST_INCREASE].type = WindowWidgetType::Empty; @@ -863,7 +863,7 @@ namespace OpenRCT2::Ui::Windows WindowDrawWidgets(*this, dpi); DrawTabImages(dpi); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto& cashPerGuestWidget = widgets[WIDX_CASH_PER_GUEST]; if (cashPerGuestWidget.type != WindowWidgetType::Empty) @@ -875,7 +875,7 @@ namespace OpenRCT2::Ui::Windows // Cash per guest value screenCoords = windowPos + ScreenCoordsXY{ cashPerGuestWidget.left + 1, cashPerGuestWidget.top }; auto ft = Formatter(); - ft.Add(gameState.GuestInitialCash); + ft.Add(gameState.guestInitialCash); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } @@ -887,7 +887,7 @@ namespace OpenRCT2::Ui::Windows // Guest initial happiness value screenCoords = windowPos + ScreenCoordsXY{ initialHappinessWidget.left + 1, initialHappinessWidget.top }; auto ft = Formatter(); - ft.Add((gameState.GuestInitialHappiness * 100) / 255); + ft.Add((gameState.guestInitialHappiness * 100) / 255); DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); // Guest initial hunger label @@ -898,7 +898,7 @@ namespace OpenRCT2::Ui::Windows // Guest initial hunger value screenCoords = windowPos + ScreenCoordsXY{ initialHungerWidget.left + 1, initialHungerWidget.top }; ft = Formatter(); - ft.Add(((255 - gameState.GuestInitialHunger) * 100) / 255); + ft.Add(((255 - gameState.guestInitialHunger) * 100) / 255); DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); // Guest initial thirst label @@ -909,7 +909,7 @@ namespace OpenRCT2::Ui::Windows // Guest initial thirst value screenCoords = windowPos + ScreenCoordsXY{ initialThirstWidget.left + 1, initialThirstWidget.top }; ft = Formatter(); - ft.Add(((255 - gameState.GuestInitialThirst) * 100) / 255); + ft.Add(((255 - gameState.guestInitialThirst) * 100) / 255); DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft); // Guests' intensity value @@ -917,8 +917,8 @@ namespace OpenRCT2::Ui::Windows const auto& guestsIntensity = widgets[WIDX_GUESTS_INTENSITY_PREFERENCE]; screenCoords = windowPos + ScreenCoordsXY{ guestsIntensity.left + 1, guestsIntensity.top }; - const auto preferLess = gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES; - const auto preferMore = gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES; + const auto preferLess = gameState.park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES; + const auto preferMore = gameState.park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES; StringId prefString = STR_GUESTS_PREFER_INTENSITY_BALANCED; if (preferLess && preferMore) @@ -940,7 +940,7 @@ namespace OpenRCT2::Ui::Windows void ParkMouseUp(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_CLOSE: @@ -954,7 +954,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_FORBID_TREE_REMOVAL: { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ForbidTreeRemoval, gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1); + ScenarioSetSetting::ForbidTreeRemoval, gameState.park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1); GameActions::Execute(&scenarioSetSetting); Invalidate(); break; @@ -963,7 +963,7 @@ namespace OpenRCT2::Ui::Windows { auto scenarioSetSetting = ScenarioSetSettingAction( ScenarioSetSetting::ForbidLandscapeChanges, - gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1); + gameState.park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1); GameActions::Execute(&scenarioSetSetting); Invalidate(); break; @@ -972,7 +972,7 @@ namespace OpenRCT2::Ui::Windows { auto scenarioSetSetting = ScenarioSetSettingAction( ScenarioSetSetting::ForbidHighConstruction, - gameState.Park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1); + gameState.park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1); GameActions::Execute(&scenarioSetSetting); Invalidate(); break; @@ -981,7 +981,7 @@ namespace OpenRCT2::Ui::Windows { auto scenarioSetSetting = ScenarioSetSettingAction( ScenarioSetSetting::ParkRatingHigherDifficultyLevel, - gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1); + gameState.park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1); GameActions::Execute(&scenarioSetSetting); Invalidate(); break; @@ -990,7 +990,7 @@ namespace OpenRCT2::Ui::Windows { auto scenarioSetSetting = ScenarioSetSettingAction( ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, - gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1); + gameState.park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1); GameActions::Execute(&scenarioSetSetting); Invalidate(); break; @@ -1008,14 +1008,14 @@ namespace OpenRCT2::Ui::Windows Widget* dropdownWidget; Widget* widget = &widgets[widgetIndex]; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_LAND_COST_INCREASE: - if (gameState.LandPrice < 200.00_GBP) + if (gameState.landPrice < 200.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyLand, gameState.LandPrice + 1.00_GBP); + ScenarioSetSetting::CostToBuyLand, gameState.landPrice + 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -1025,10 +1025,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_LAND_COST_DECREASE: - if (gameState.LandPrice > 5.00_GBP) + if (gameState.landPrice > 5.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyLand, gameState.LandPrice - 1.00_GBP); + ScenarioSetSetting::CostToBuyLand, gameState.landPrice - 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -1038,10 +1038,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE: - if (gameState.ConstructionRightsPrice < 200.00_GBP) + if (gameState.constructionRightsPrice < 200.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice + 1.00_GBP); + ScenarioSetSetting::CostToBuyConstructionRights, gameState.constructionRightsPrice + 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -1051,10 +1051,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE: - if (gameState.ConstructionRightsPrice > 5.00_GBP) + if (gameState.constructionRightsPrice > 5.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::CostToBuyConstructionRights, gameState.ConstructionRightsPrice - 1.00_GBP); + ScenarioSetSetting::CostToBuyConstructionRights, gameState.constructionRightsPrice - 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -1064,10 +1064,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_ENTRY_PRICE_INCREASE: - if (gameState.Park.EntranceFee < kMaxEntranceFee) + if (gameState.park.EntranceFee < kMaxEntranceFee) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ParkChargeEntryFee, gameState.Park.EntranceFee + 1.00_GBP); + ScenarioSetSetting::ParkChargeEntryFee, gameState.park.EntranceFee + 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -1077,10 +1077,10 @@ namespace OpenRCT2::Ui::Windows Invalidate(); break; case WIDX_ENTRY_PRICE_DECREASE: - if (gameState.Park.EntranceFee > 0.00_GBP) + if (gameState.park.EntranceFee > 0.00_GBP) { auto scenarioSetSetting = ScenarioSetSettingAction( - ScenarioSetSetting::ParkChargeEntryFee, gameState.Park.EntranceFee - 1.00_GBP); + ScenarioSetSetting::ParkChargeEntryFee, gameState.park.EntranceFee - 1.00_GBP); GameActions::Execute(&scenarioSetSetting); } else @@ -1103,9 +1103,9 @@ namespace OpenRCT2::Ui::Windows { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1, colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); - if (gameState.Park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) + if (gameState.park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) Dropdown::SetChecked(2, true); - else if (gameState.Park.Flags & PARK_FLAGS_PARK_FREE_ENTRY) + else if (gameState.park.Flags & PARK_FLAGS_PARK_FREE_ENTRY) Dropdown::SetChecked(0, true); else Dropdown::SetChecked(1, true); @@ -1144,8 +1144,8 @@ namespace OpenRCT2::Ui::Windows { SetPressedTab(); - auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { for (int32_t i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++) widgets[i].type = WindowWidgetType::Empty; @@ -1175,11 +1175,11 @@ namespace OpenRCT2::Ui::Windows } } - SetWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL); - SetWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES); - SetWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.Park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION); - SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING); - SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); + SetWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL); + SetWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES); + SetWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION); + SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING); + SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty : WindowWidgetType::CloseBox; @@ -1194,7 +1194,7 @@ namespace OpenRCT2::Ui::Windows WindowDrawWidgets(*this, dpi); DrawTabImages(dpi); - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); const auto& landCostWidget = widgets[WIDX_LAND_COST]; if (landCostWidget.type != WindowWidgetType::Empty) { @@ -1205,7 +1205,7 @@ namespace OpenRCT2::Ui::Windows // Cost to buy land value screenCoords = windowPos + ScreenCoordsXY{ landCostWidget.left + 1, landCostWidget.top }; auto ft = Formatter(); - ft.Add(gameState.LandPrice); + ft.Add(gameState.landPrice); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } @@ -1220,7 +1220,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ constructionRightsCostWidget.left + 1, constructionRightsCostWidget.top }; auto ft = Formatter(); - ft.Add(gameState.ConstructionRightsPrice); + ft.Add(gameState.constructionRightsPrice); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } @@ -1232,9 +1232,9 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); // Pay for park and/or rides value - if (gameState.Park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) + if (gameState.park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) ft.Add(STR_PAID_ENTRY_PAID_RIDES); - else if (gameState.Park.Flags & PARK_FLAGS_PARK_FREE_ENTRY) + else if (gameState.park.Flags & PARK_FLAGS_PARK_FREE_ENTRY) ft.Add(STR_FREE_PARK_ENTER); else ft.Add(STR_PAY_PARK_ENTER); @@ -1252,7 +1252,7 @@ namespace OpenRCT2::Ui::Windows // Entry price value screenCoords = windowPos + ScreenCoordsXY{ entryPriceWidget.left + 1, entryPriceWidget.top }; auto ft = Formatter(); - ft.Add(gameState.Park.EntranceFee); + ft.Add(gameState.park.EntranceFee); DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft); } } diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 67bb076ed6..5c85a8ac0b 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -230,7 +230,7 @@ namespace OpenRCT2::Ui::Windows void SetDisabledTabs() { - disabled_widgets = (GetGameState().Park.Flags & 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: @@ -333,17 +333,17 @@ namespace OpenRCT2::Ui::Windows case WINDOW_FINANCES_PAGE_VALUE_GRAPH: graphPageWidget = &widgets[WIDX_PAGE_BACKGROUND]; centredGraph = false; - _graphProps.series = GetGameState().Park.ValueHistory; + _graphProps.series = getGameState().park.ValueHistory; break; case WINDOW_FINANCES_PAGE_PROFIT_GRAPH: graphPageWidget = &widgets[WIDX_PAGE_BACKGROUND]; centredGraph = true; - _graphProps.series = GetGameState().WeeklyProfitHistory; + _graphProps.series = getGameState().weeklyProfitHistory; break; case WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH: graphPageWidget = &widgets[WIDX_PAGE_BACKGROUND]; centredGraph = true; - _graphProps.series = GetGameState().CashHistory; + _graphProps.series = getGameState().cashHistory; break; } OnPrepareDrawGraph(graphPageWidget, centredGraph); @@ -361,22 +361,22 @@ namespace OpenRCT2::Ui::Windows break; case WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH: { - auto& gameState = GetGameState(); - const auto cashLessLoan = gameState.Cash - gameState.BankLoan; + auto& gameState = getGameState(); + const auto cashLessLoan = gameState.cash - gameState.bankLoan; const auto fmt = cashLessLoan >= 0 ? STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_POSITIVE : STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_NEGATIVE; OnDrawGraph(dpi, cashLessLoan, fmt); break; } case WINDOW_FINANCES_PAGE_VALUE_GRAPH: - OnDrawGraph(dpi, GetGameState().Park.Value, STR_FINANCES_PARK_VALUE); + OnDrawGraph(dpi, getGameState().park.Value, STR_FINANCES_PARK_VALUE); break; case WINDOW_FINANCES_PAGE_PROFIT_GRAPH: { - auto& gameState = GetGameState(); - const auto fmt = gameState.CurrentProfit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE + auto& gameState = getGameState(); + const auto fmt = gameState.currentProfit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS; - OnDrawGraph(dpi, gameState.CurrentProfit, fmt); + OnDrawGraph(dpi, gameState.currentProfit, fmt); break; } case WINDOW_FINANCES_PAGE_MARKETING: @@ -422,7 +422,7 @@ namespace OpenRCT2::Ui::Windows screenCoords.y += kTableCellHeight; } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Expenditure / Income values for each month auto currentMonthYear = GetDate().GetMonthsElapsed(); for (int32_t i = SummaryMaxAvailableMonth(); i >= 0; i--) @@ -445,7 +445,7 @@ namespace OpenRCT2::Ui::Windows money64 profit = 0; for (int32_t j = 0; j < static_cast(ExpenditureType::Count); j++) { - auto expenditure = gameState.ExpenditureTable[i][j]; + auto expenditure = gameState.expenditureTable[i][j]; if (expenditure != 0) { profit += expenditure; @@ -536,17 +536,17 @@ namespace OpenRCT2::Ui::Windows void OnMouseDownSummary(WidgetIndex widgetIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_LOAN_INCREASE: { // If loan can be increased, do so. // If not, action shows error message. - auto newLoan = gameState.BankLoan + 1000.00_GBP; - if (gameState.BankLoan < gameState.MaxBankLoan) + auto newLoan = gameState.bankLoan + 1000.00_GBP; + if (gameState.bankLoan < gameState.maxBankLoan) { - newLoan = std::min(gameState.MaxBankLoan, newLoan); + newLoan = std::min(gameState.maxBankLoan, newLoan); } auto gameAction = ParkSetLoanAction(newLoan); GameActions::Execute(&gameAction); @@ -557,10 +557,10 @@ namespace OpenRCT2::Ui::Windows // If loan is positive, decrease it. // If loan is negative, action shows error message. // If loan is exactly 0, prevent error message. - if (gameState.BankLoan != 0) + if (gameState.bankLoan != 0) { - auto newLoan = gameState.BankLoan - 1000.00_GBP; - if (gameState.BankLoan > 0) + auto newLoan = gameState.bankLoan - 1000.00_GBP; + if (gameState.bankLoan > 0) { newLoan = std::max(static_cast(0LL), newLoan); } @@ -579,7 +579,7 @@ namespace OpenRCT2::Ui::Windows // drawing has completed. auto ft = Formatter::Common(); ft.Increment(6); - ft.Add(GetGameState().BankLoan); + ft.Add(getGameState().bankLoan); // Keep up with new months being added in the first two years. if (GetDate().GetMonthsElapsed() != _lastPaintedMonth) @@ -590,7 +590,7 @@ namespace OpenRCT2::Ui::Windows { auto titleBarBottom = widgets[WIDX_TITLE].bottom; auto screenCoords = windowPos + ScreenCoordsXY{ 8, titleBarBottom + 37 }; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Expenditure / Income heading DrawTextBasic( @@ -621,22 +621,22 @@ namespace OpenRCT2::Ui::Windows // Loan and interest rate DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_LOAN); - if (!(gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST)) + if (!(gameState.park.Flags & PARK_FLAGS_RCT1_INTEREST)) { auto ft = Formatter(); - ft.Add(gameState.BankLoanInterestRate); + ft.Add(gameState.bankLoanInterestRate); DrawTextBasic( dpi, windowPos + ScreenCoordsXY{ 167, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft); } // Current cash auto ft = Formatter(); - ft.Add(gameState.Cash); - StringId stringId = gameState.Cash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL; + ft.Add(gameState.cash); + StringId stringId = gameState.cash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL; DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 280 }, stringId, ft); // Objective related financial information - if (gameState.ScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME) + if (gameState.scenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME) { auto lastMonthProfit = FinanceGetLastMonthShopProfit(); ft = Formatter(); @@ -649,10 +649,10 @@ namespace OpenRCT2::Ui::Windows { // Park value and company value ft = Formatter(); - ft.Add(gameState.Park.Value); + ft.Add(gameState.park.Value); DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 265 }, STR_PARK_VALUE_LABEL, ft); ft = Formatter(); - ft.Add(gameState.CompanyValue); + ft.Add(gameState.companyValue); DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 280 }, STR_COMPANY_VALUE_LABEL, ft); } } @@ -677,7 +677,7 @@ namespace OpenRCT2::Ui::Windows void OnPrepareDrawMarketing() { // Count number of active campaigns - int32_t numActiveCampaigns = static_cast(GetGameState().MarketingCampaigns.size()); + int32_t numActiveCampaigns = static_cast(getGameState().marketingCampaigns.size()); int32_t y = std::max(1, numActiveCampaigns) * kListRowHeight + 92; // Update group box positions @@ -739,7 +739,7 @@ namespace OpenRCT2::Ui::Windows break; default: { - auto parkName = GetGameState().Park.Name.c_str(); + auto parkName = getGameState().park.Name.c_str(); ft.Add(STR_STRING); ft.Add(parkName); } diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 357a86e9b9..bcb8942639 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -532,7 +532,7 @@ namespace OpenRCT2::Ui::Windows + ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 12 }; if (_windowFootpathCost != kMoney64Undefined) { - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_windowFootpathCost); @@ -670,7 +670,7 @@ namespace OpenRCT2::Ui::Windows uint32_t numPathTypes = 0; // If the game is in sandbox mode, also show paths that are normally restricted to the scenario editor - bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode); _dropdownEntries.clear(); std::optional defaultIndex; @@ -688,14 +688,14 @@ namespace OpenRCT2::Ui::Windows } // If regular paths can be used as queue, only hide the path if we’re _not_ looking at a queue, // but the path surface is one. - if (GetGameState().Cheats.allowRegularPathAsQueue && !showQueues + if (getGameState().cheats.allowRegularPathAsQueue && !showQueues && ((pathType->Flags & FOOTPATH_ENTRY_FLAG_IS_QUEUE) != 0)) { continue; } // If the cheat is disabled, hide queues from the regular path view and vice versa. else if ( - !GetGameState().Cheats.allowRegularPathAsQueue + !getGameState().cheats.allowRegularPathAsQueue && showQueues != ((pathType->Flags & FOOTPATH_ENTRY_FLAG_IS_QUEUE) != 0)) { continue; @@ -821,7 +821,7 @@ namespace OpenRCT2::Ui::Windows auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags); if (info.interactionType != ViewportInteractionItem::None) { - const bool allowInvalidHeights = GetGameState().Cheats.allowTrackPlaceInvalidHeights; + const bool allowInvalidHeights = getGameState().cheats.allowTrackPlaceInvalidHeights; const auto heightStep = kCoordsZStep * (!allowInvalidHeights ? 2 : 1); _footpathPlaceCtrlZ = floor2(info.Element->GetBaseZ(), heightStep); @@ -854,7 +854,7 @@ namespace OpenRCT2::Ui::Windows _footpathPlaceShiftZ = mainWnd->viewport->zoom.ApplyTo(_footpathPlaceShiftZ); } - const bool allowInvalidHeights = GetGameState().Cheats.allowTrackPlaceInvalidHeights; + const bool allowInvalidHeights = getGameState().cheats.allowTrackPlaceInvalidHeights; const auto heightStep = kCoordsZStep * (!allowInvalidHeights ? 2 : 1); _footpathPlaceShiftZ = floor2(_footpathPlaceShiftZ, heightStep); @@ -1592,7 +1592,7 @@ namespace OpenRCT2::Ui::Windows void KeyboardShortcutDemolishCurrent() { if (IsWidgetDisabled(WIDX_REMOVE) || widgets[WIDX_REMOVE].type == WindowWidgetType::Empty - || (!GetGameState().Cheats.buildInPauseMode && GameIsPaused())) + || (!getGameState().cheats.buildInPauseMode && GameIsPaused())) { return; } diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index d7fc3cb961..69aaab1a57 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -97,19 +97,19 @@ namespace OpenRCT2::Ui::Windows // Figure out how much line height we have to work with. uint32_t line_height = FontGetLineHeight(FontStyle::Medium); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Draw money - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { const auto& widget = widgets[WIDX_MONEY]; auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), windowPos.y + widget.midY() - (line_height == 10 ? 5 : 6) }; auto colour = GetHoverWidgetColour(WIDX_MONEY); - StringId stringId = gameState.Cash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; + StringId stringId = gameState.cash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; auto ft = Formatter(); - ft.Add(gameState.Cash); + ft.Add(gameState.cash); DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); } @@ -130,11 +130,11 @@ namespace OpenRCT2::Ui::Windows const auto& widget = widgets[WIDX_GUESTS]; auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), windowPos.y + widget.midY() - 6 }; - StringId stringId = gameState.NumGuestsInPark == 1 ? _guestCountFormatsSingular[gameState.GuestChangeModifier] - : _guestCountFormats[gameState.GuestChangeModifier]; + StringId stringId = gameState.numGuestsInPark == 1 ? _guestCountFormatsSingular[gameState.guestChangeModifier] + : _guestCountFormats[gameState.guestChangeModifier]; auto colour = GetHoverWidgetColour(WIDX_GUESTS); auto ft = Formatter(); - ft.Add(gameState.NumGuestsInPark); + ft.Add(gameState.numGuestsInPark); DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); } @@ -143,7 +143,7 @@ namespace OpenRCT2::Ui::Windows const auto& widget = widgets[WIDX_PARK_RATING]; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 }; - DrawParkRating(dpi, colours[3].colour, screenCoords, std::max(10, ((gameState.Park.Rating / 4) * 263) / 256)); + DrawParkRating(dpi, colours[3].colour, screenCoords, std::max(10, ((gameState.park.Rating / 4) * 263) / 256)); } } @@ -199,7 +199,7 @@ namespace OpenRCT2::Ui::Windows // Temperature screenCoords = { windowPos.x + rightPanelWidget.left + 15, static_cast(screenCoords.y + line_height + 1) }; - int32_t temperature = GetGameState().WeatherCurrent.temperature; + int32_t temperature = getGameState().weatherCurrent.temperature; StringId format = STR_CELSIUS_VALUE; if (Config::Get().general.TemperatureFormat == TemperatureUnit::Fahrenheit) { @@ -212,14 +212,14 @@ namespace OpenRCT2::Ui::Windows screenCoords.x += 30; // Current weather - auto currentWeatherSpriteId = ClimateGetWeatherSpriteId(GetGameState().WeatherCurrent.weatherType); + auto currentWeatherSpriteId = ClimateGetWeatherSpriteId(getGameState().weatherCurrent.weatherType); GfxDrawSprite(dpi, ImageId(currentWeatherSpriteId), screenCoords); // Next weather - auto nextWeatherSpriteId = ClimateGetWeatherSpriteId(GetGameState().WeatherNext.weatherType); + auto nextWeatherSpriteId = ClimateGetWeatherSpriteId(getGameState().weatherNext.weatherType); if (currentWeatherSpriteId != nextWeatherSpriteId) { - if (GetGameState().WeatherUpdateTimer < 960) + if (getGameState().weatherUpdateTimer < 960) { GfxDrawSprite(dpi, ImageId(SPR_NEXT_WEATHER), screenCoords + ScreenCoordsXY{ 27, 5 }); GfxDrawSprite(dpi, ImageId(nextWeatherSpriteId), screenCoords + ScreenCoordsXY{ 40, 0 }); @@ -432,7 +432,7 @@ namespace OpenRCT2::Ui::Windows { case WIDX_LEFT_OUTSET: case WIDX_MONEY: - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) ContextOpenWindow(WindowClass::Finances); break; case WIDX_GUESTS: @@ -481,17 +481,17 @@ namespace OpenRCT2::Ui::Windows OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto ft = Formatter(); switch (widgetIndex) { case WIDX_MONEY: - ft.Add(gameState.CurrentProfit); - ft.Add(gameState.Park.Value); + ft.Add(gameState.currentProfit); + ft.Add(gameState.park.Value); break; case WIDX_PARK_RATING: - ft.Add(gameState.Park.Rating); + ft.Add(gameState.park.Rating); break; } return { fallback, ft }; @@ -514,7 +514,7 @@ namespace OpenRCT2::Ui::Windows + 1; // Reposition left widgets in accordance with line height... depending on whether there is money in play. - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) { widgets[WIDX_MONEY].type = WindowWidgetType::Empty; widgets[WIDX_GUESTS].top = 1; diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 0087f23402..7606d2be8f 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -493,7 +493,7 @@ namespace OpenRCT2::Ui::Windows if (!WidgetIsDisabled(*this, WIDX_PICKUP)) Invalidate(); } - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) { newDisabledWidgets |= (1uLL << WIDX_TAB_4); // Disable finance tab if no money } @@ -1135,7 +1135,7 @@ namespace OpenRCT2::Ui::Windows int32_t guestEntryTime = peep->GetParkEntryTime(); if (guestEntryTime != -1) { - int32_t timeInPark = (GetGameState().CurrentTicks - guestEntryTime) >> 11; + int32_t timeInPark = (getGameState().currentTicks - guestEntryTime) >> 11; auto ft = Formatter(); ft.Add(timeInPark & 0xFFFF); DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_TIME_IN_PARK, ft); @@ -1219,7 +1219,7 @@ namespace OpenRCT2::Ui::Windows } // Every 2048 ticks do a full window_invalidate - int32_t numTicks = GetGameState().CurrentTicks - guest->GetParkEntryTime(); + int32_t numTicks = getGameState().currentTicks - guest->GetParkEntryTime(); if (!(numTicks & 0x7FF)) Invalidate(); @@ -1606,7 +1606,7 @@ namespace OpenRCT2::Ui::Windows std::pair InventoryFormatItem(Guest& guest, ShopItem item) const { - auto parkName = GetGameState().Park.Name.c_str(); + auto parkName = getGameState().park.Name.c_str(); // Default item image auto& itemDesc = GetShopItemDescriptor(item); diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 961bc300e8..7beff84bb2 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -800,7 +800,7 @@ namespace OpenRCT2::Ui::Windows bool IsRefreshOfGroupsRequired() { - uint32_t tick256 = floor2(GetGameState().CurrentTicks, 256); + uint32_t tick256 = floor2(getGameState().currentTicks, 256); if (_selectedView == _lastFindGroupsSelectedView) { if (_lastFindGroupsWait != 0 || _lastFindGroupsTick == tick256) @@ -828,7 +828,7 @@ namespace OpenRCT2::Ui::Windows void RefreshGroups() { - _lastFindGroupsTick = floor2(GetGameState().CurrentTicks, 256); + _lastFindGroupsTick = floor2(getGameState().currentTicks, 256); _lastFindGroupsSelectedView = _selectedView; _lastFindGroupsWait = 320; _groups.clear(); @@ -946,7 +946,7 @@ namespace OpenRCT2::Ui::Windows static GuestItem::CompareFunc GetGuestCompareFunc() { - return GetGameState().Park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? CompareGuestItem + return getGameState().park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? CompareGuestItem : CompareGuestItem; } }; diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index cc170fa820..eb84dbd551 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -280,7 +280,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->bottom + 5 }; - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { // Draw raise cost amount if (_landToolRaiseCost != kMoney64Undefined && _landToolRaiseCost != 0) diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 8fe9e6c8ca..b41f2e864e 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -98,7 +98,7 @@ namespace OpenRCT2::Ui::Windows bool IsOwnershipMode() const { - return isInEditorMode() != 0 || GetGameState().Cheats.sandboxMode; + return isInEditorMode() != 0 || getGameState().cheats.sandboxMode; } void SwitchToMode(LandRightsMode mode) @@ -408,7 +408,7 @@ namespace OpenRCT2::Ui::Windows // Draw cost amount if (_landRightsCost != kMoney64Undefined && _landRightsCost != 0 - && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_landRightsCost); diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 2db2a48ffe..aded0aafdc 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -57,7 +57,7 @@ namespace OpenRCT2::Ui::Windows static int32_t getPracticalMapSize() { // Take non-square maps into account - return std::max(GetGameState().MapSize.x, GetGameState().MapSize.y) - 2; + return std::max(getGameState().mapSize.x, getGameState().mapSize.y) - 2; } static int32_t getPracticalMapSizeBig() { @@ -74,7 +74,7 @@ namespace OpenRCT2::Ui::Windows static bool isEditorOrSandbox() { - return gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode; + return gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode; } static constexpr StringId WINDOW_TITLE = STR_MAP_LABEL; @@ -254,8 +254,8 @@ namespace OpenRCT2::Ui::Windows CentreMapOnViewPoint(); FootpathSelectDefault(); - auto& gameState = GetGameState(); - _mapWidthAndHeightLinked = gameState.MapSize.x == gameState.MapSize.y; + auto& gameState = getGameState(); + _mapWidthAndHeightLinked = gameState.mapSize.x == gameState.mapSize.y; // Reset land rights tool size _landRightsToolSize = 1; @@ -511,7 +511,7 @@ namespace OpenRCT2::Ui::Windows size = std::clamp( size, static_cast(kMinimumMapSizeTechnical), static_cast(kMaximumMapSizeTechnical)); - TileCoordsXY newMapSize = GetGameState().MapSize; + TileCoordsXY newMapSize = getGameState().mapSize; if (_resizeDirection != ResizeDirection::X) newMapSize.y = size; if (_resizeDirection != ResizeDirection::Y) @@ -615,8 +615,8 @@ namespace OpenRCT2::Ui::Windows pressed_widgets |= (1uLL << WIDX_MAP_GENERATOR); // Set disabled widgets - auto& gameState = GetGameState(); - SetWidgetDisabled(WIDX_MAP_SIZE_LINK, gameState.MapSize.x != gameState.MapSize.y); + auto& gameState = getGameState(); + SetWidgetDisabled(WIDX_MAP_SIZE_LINK, gameState.mapSize.x != gameState.mapSize.y); // Resize widgets to window size ResizeFrameWithPage(); @@ -764,7 +764,7 @@ namespace OpenRCT2::Ui::Windows void IncreaseMapSize() { - auto newMapSize = GetGameState().MapSize; + auto newMapSize = getGameState().mapSize; if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) newMapSize.y++; if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) @@ -776,7 +776,7 @@ namespace OpenRCT2::Ui::Windows void DecreaseMapSize() { - auto newMapSize = GetGameState().MapSize; + auto newMapSize = getGameState().mapSize; if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) newMapSize.y--; if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) @@ -1112,10 +1112,10 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_MAP_SIZE_SPINNER_X_DOWN].type = WindowWidgetType::Button; // Push width (Y) and height (X) to the common formatter arguments for the map size spinners to use - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto ft = Formatter::Common(); - ft.Add(gameState.MapSize.y - 2); - ft.Add(gameState.MapSize.x - 2); + ft.Add(gameState.mapSize.y - 2); + ft.Add(gameState.mapSize.x - 2); } void InputMapSize(WidgetIndex callingWidget) diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 151068187d..5c4318e05a 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows auto currentRideEntry = GetRideEntryByIndex(rideEntryIndex); // Skip if vehicle type is not invented yet - if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.ignoreResearchStatus) + if (!RideEntryIsInvented(rideEntryIndex) && !getGameState().cheats.ignoreResearchStatus) { continue; } @@ -686,7 +686,7 @@ namespace OpenRCT2::Ui::Windows for (auto rideEntryIndex : rideEntries) { // Skip if vehicle type is not invented yet - if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.ignoreResearchStatus) + if (!RideEntryIsInvented(rideEntryIndex) && !getGameState().cheats.ignoreResearchStatus) continue; // Ride entries @@ -852,7 +852,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WindowWidgetType::Groupbox; widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WindowWidgetType::FlatBtn; - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::FlatBtn; newWidth = 300; @@ -962,7 +962,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ 0, 51 }, designCountStringId, ft); // Price - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { // Get price of ride auto startPieceId = GetRideTypeDescriptor(item.Type).StartTrackPiece; diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 42ee360b66..c77d57a3ae 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -94,14 +94,14 @@ namespace OpenRCT2::Ui::Windows size_t j = _pressedNewsItemIndex; _pressedNewsItemIndex = -1; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (j >= gameState.NewsItems.GetArchived().size()) + if (j >= gameState.newsItems.GetArchived().size()) { return; } - const auto& newsItem = gameState.NewsItems.GetArchived()[j]; + const auto& newsItem = gameState.newsItems.GetArchived()[j]; if (newsItem.HasButton()) { return; @@ -124,7 +124,7 @@ namespace OpenRCT2::Ui::Windows ScreenSize OnScrollGetSize(int32_t scrollIndex) override { - int32_t scrollHeight = static_cast(GetGameState().NewsItems.GetArchived().size()) * CalculateItemHeight(); + int32_t scrollHeight = static_cast(getGameState().newsItems.GetArchived().size()) * CalculateItemHeight(); return { WW, scrollHeight }; } @@ -134,7 +134,7 @@ namespace OpenRCT2::Ui::Windows int32_t i = 0; int32_t buttonIndex = 0; auto mutableScreenCoords = screenCoords; - for (const auto& newsItem : GetGameState().NewsItems.GetArchived()) + for (const auto& newsItem : getGameState().newsItems.GetArchived()) { if (mutableScreenCoords.y < itemHeight) { @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows int32_t y = 0; int32_t i = 0; - for (const auto& newsItem : GetGameState().NewsItems.GetArchived()) + for (const auto& newsItem : getGameState().newsItems.GetArchived()) { if (y >= dpi.y + dpi.height) break; diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 5a77d2660c..36157c4c29 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -407,12 +407,12 @@ namespace OpenRCT2::Ui::Windows void SetDisabledTabs() { // Disable price tab if money is disabled - disabled_widgets = (GetGameState().Park.Flags & 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() { - auto parkName = GetGameState().Park.Name.c_str(); + auto parkName = getGameState().park.Name.c_str(); auto ft = Formatter::Common(); ft.Add(STR_STRING); @@ -432,7 +432,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_RENAME: { - auto& park = GetGameState().Park; + auto& park = getGameState().park; WindowTextInputRawOpen( this, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, {}, park.Name.c_str(), kUserStringMaxLength); break; @@ -465,7 +465,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowText( { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, 2); - if (GetGameState().Park.IsOpen()) + if (getGameState().park.IsOpen()) { gDropdownDefaultIndex = 0; Dropdown::SetChecked(1, true); @@ -513,7 +513,7 @@ namespace OpenRCT2::Ui::Windows void OnPrepareDrawEntrance() { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); SetWidgets(_pagedWidgets[page]); InitScrollWidgets(); @@ -521,13 +521,13 @@ namespace OpenRCT2::Ui::Windows // Set open / close park button state { - auto parkName = gameState.Park.Name.c_str(); + auto parkName = gameState.park.Name.c_str(); auto ft = Formatter::Common(); ft.Add(STR_STRING); ft.Add(parkName); } - const bool parkIsOpen = gameState.Park.IsOpen(); + const bool parkIsOpen = gameState.park.IsOpen(); widgets[WIDX_OPEN_OR_CLOSE].image = ImageId(parkIsOpen ? SPR_OPEN : SPR_CLOSED); const auto closeLightImage = SPR_G2_RCT1_CLOSE_BUTTON_0 + !parkIsOpen * 2 + WidgetIsPressed(*this, WIDX_CLOSE_LIGHT); @@ -536,13 +536,13 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); // Only allow closing of park for guest / rating objective - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) disabled_widgets |= (1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT); else disabled_widgets &= ~((1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT)); // Only allow purchase of land when there is money - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::Empty; else widgets[WIDX_BUY_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; @@ -561,7 +561,7 @@ namespace OpenRCT2::Ui::Windows if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK) { widgets[WIDX_OPEN_OR_CLOSE].type = WindowWidgetType::Empty; - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) { widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::FlatBtn; widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::FlatBtn; @@ -614,7 +614,7 @@ namespace OpenRCT2::Ui::Windows // Draw park closed / open label auto ft = Formatter(); - ft.Add(GetGameState().Park.IsOpen() ? STR_PARK_OPEN : STR_PARK_CLOSED); + ft.Add(getGameState().park.IsOpen() ? STR_PARK_OPEN : STR_PARK_CLOSED); auto* labelWidget = &widgets[WIDX_STATUS]; DrawTextEllipsised( @@ -627,12 +627,12 @@ namespace OpenRCT2::Ui::Windows if (page != WINDOW_PARK_PAGE_ENTRANCE) return; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); std::optional newFocus = std::nullopt; - if (!gameState.Park.Entrances.empty()) + if (!gameState.park.Entrances.empty()) { - const auto& entrance = gameState.Park.Entrances[0]; + const auto& entrance = gameState.park.Entrances[0]; newFocus = Focus(CoordsXYZ{ entrance.x + 16, entrance.y + 16, entrance.z + 32 }); } @@ -700,7 +700,7 @@ namespace OpenRCT2::Ui::Windows _ratingProps.min = 0; _ratingProps.max = 1000; - _ratingProps.series = GetGameState().Park.RatingHistory; + _ratingProps.series = getGameState().park.RatingHistory; const Widget* background = &widgets[WIDX_PAGE_BACKGROUND]; _ratingGraphBounds = { windowPos + ScreenCoordsXY{ background->left + 4, background->top + 15 }, windowPos + ScreenCoordsXY{ background->right - 4, background->bottom - 4 } }; @@ -724,7 +724,7 @@ namespace OpenRCT2::Ui::Windows // Current value Formatter ft; - ft.Add(GetGameState().Park.Rating); + ft.Add(getGameState().park.Rating); DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, ft); // Graph border @@ -767,8 +767,8 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); AnchorBorderWidgets(); - const auto& gameState = GetGameState(); - _guestProps.series = gameState.GuestsInParkHistory; + const auto& gameState = getGameState(); + _guestProps.series = gameState.guestsInParkHistory; const Widget* background = &widgets[WIDX_PAGE_BACKGROUND]; _guestGraphBounds = { windowPos + ScreenCoordsXY{ background->left + 4, background->top + 15 }, windowPos + ScreenCoordsXY{ background->right - 4, background->bottom - 4 } }; @@ -776,9 +776,9 @@ namespace OpenRCT2::Ui::Windows // Calculate Y axis max and min _guestProps.min = 0; _guestProps.max = 5000; - for (size_t i = 0; i < std::size(gameState.GuestsInParkHistory); i++) + for (size_t i = 0; i < std::size(gameState.guestsInParkHistory); i++) { - auto value = gameState.GuestsInParkHistory[i]; + auto value = gameState.guestsInParkHistory[i]; if (value == kGuestsInParkHistoryUndefined) continue; while (value > _guestProps.max) @@ -804,7 +804,7 @@ namespace OpenRCT2::Ui::Windows // Current value Formatter ft; - ft.Add(GetGameState().NumGuestsInPark); + ft.Add(getGameState().numGuestsInPark); DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_GUESTS_IN_PARK_LABEL, ft); // Graph border @@ -829,19 +829,19 @@ namespace OpenRCT2::Ui::Windows void OnMouseDownPrice(WidgetIndex widgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_INCREASE_PRICE: { - const auto newFee = std::min(kMaxEntranceFee, gameState.Park.EntranceFee + 1.00_GBP); + const auto newFee = std::min(kMaxEntranceFee, gameState.park.EntranceFee + 1.00_GBP); auto gameAction = ParkSetEntranceFeeAction(newFee); GameActions::Execute(&gameAction); break; } case WIDX_DECREASE_PRICE: { - const auto newFee = std::max(0.00_GBP, gameState.Park.EntranceFee - 1.00_GBP); + const auto newFee = std::max(0.00_GBP, gameState.park.EntranceFee - 1.00_GBP); auto gameAction = ParkSetEntranceFeeAction(newFee); GameActions::Execute(&gameAction); break; @@ -878,7 +878,7 @@ namespace OpenRCT2::Ui::Windows } // If the entry price is locked at free, disable the widget, unless the unlock_all_prices cheat is active. - if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) || !Park::EntranceFeeUnlocked()) + if ((getGameState().park.Flags & PARK_FLAGS_NO_MONEY) || !Park::EntranceFeeUnlocked()) { widgets[WIDX_PRICE].type = WindowWidgetType::LabelCentred; widgets[WIDX_INCREASE_PRICE].type = WindowWidgetType::Empty; @@ -903,7 +903,7 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 30 }; auto ft = Formatter(); - ft.Add(GetGameState().TotalIncomeFromAdmissions); + ft.Add(getGameState().totalIncomeFromAdmissions); DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, ft); money64 parkEntranceFee = Park::GetEntranceFee(); @@ -964,9 +964,9 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Draw park size - auto parkSize = gameState.Park.Size * 10; + auto parkSize = gameState.park.Size * 10; auto stringIndex = STR_PARK_SIZE_METRIC_LABEL; if (Config::Get().general.MeasurementFormat == MeasurementFormat::Imperial) { @@ -998,12 +998,12 @@ namespace OpenRCT2::Ui::Windows // Draw number of guests in park ft = Formatter(); - ft.Add(gameState.NumGuestsInPark); + ft.Add(gameState.numGuestsInPark); DrawTextBasic(dpi, screenCoords, STR_GUESTS_IN_PARK_LABEL, ft); screenCoords.y += kListRowHeight; ft = Formatter(); - ft.Add(gameState.TotalAdmissions); + ft.Add(gameState.totalAdmissions); DrawTextBasic(dpi, screenCoords, STR_TOTAL_ADMISSIONS, ft); } #pragma endregion @@ -1042,7 +1042,7 @@ namespace OpenRCT2::Ui::Windows if (widgetIndex == WIDX_ENTER_NAME && !text.empty()) { std::string strText(text); - ScenarioSuccessSubmitName(GetGameState(), strText.c_str()); + ScenarioSuccessSubmitName(getGameState(), strText.c_str()); Invalidate(); } } @@ -1070,7 +1070,7 @@ namespace OpenRCT2::Ui::Windows PrepareWindowTitleText(); // Show name input button on scenario completion. - if (GetGameState().Park.Flags & 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].top = height - 19; @@ -1085,7 +1085,7 @@ namespace OpenRCT2::Ui::Windows void OnDrawObjective(DrawPixelInfo& dpi) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); DrawWidgets(dpi); DrawTabImages(dpi); @@ -1094,7 +1094,7 @@ namespace OpenRCT2::Ui::Windows + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 7 }; auto ft = Formatter(); ft.Add(STR_STRING); - ft.Add(gameState.ScenarioDetails.c_str()); + ft.Add(gameState.scenarioDetails.c_str()); screenCoords.y += DrawTextWrapped(dpi, screenCoords, 222, STR_BLACK_STRING, ft); screenCoords.y += 5; @@ -1104,15 +1104,15 @@ namespace OpenRCT2::Ui::Windows // Objective ft = Formatter(); - formatObjective(ft, gameState.ScenarioObjective); + formatObjective(ft, gameState.scenarioObjective); - screenCoords.y += DrawTextWrapped(dpi, screenCoords, 221, kObjectiveNames[gameState.ScenarioObjective.Type], ft); + screenCoords.y += DrawTextWrapped(dpi, screenCoords, 221, kObjectiveNames[gameState.scenarioObjective.Type], ft); screenCoords.y += 5; // Objective outcome - if (gameState.ScenarioCompletedCompanyValue != kMoney64Undefined) + if (gameState.scenarioCompletedCompanyValue != kMoney64Undefined) { - if (gameState.ScenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) + if (gameState.scenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) { // Objective failed DrawTextWrapped(dpi, screenCoords, 222, STR_OBJECTIVE_FAILED); @@ -1121,7 +1121,7 @@ namespace OpenRCT2::Ui::Windows { // Objective completed ft = Formatter(); - ft.Add(gameState.ScenarioCompletedCompanyValue); + ft.Add(gameState.scenarioCompletedCompanyValue); DrawTextWrapped(dpi, screenCoords, 222, STR_OBJECTIVE_ACHIEVED, ft); } } @@ -1157,7 +1157,7 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 }; - auto& currentAwards = GetGameState().CurrentAwards; + auto& currentAwards = getGameState().currentAwards; for (const auto& award : currentAwards) { diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index ae5239d089..cb1286a740 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -81,7 +81,7 @@ namespace OpenRCT2::Ui::Windows auto currentRide = GetRide(rideId); if (currentRide != nullptr) { - auto stringId = (GetGameState().Park.Flags & 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; auto ft = Formatter(); currentRide->formatNameTo(ft); diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 6efb34ef2f..2ff6faffc4 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -326,26 +326,26 @@ namespace OpenRCT2::Ui::Windows void WindowResearchDevelopmentMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); if (widgetIndex == (WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset)) { - News::OpenSubject(News::ItemType::Research, gameState.ResearchLastItem->rawValue); + News::OpenSubject(News::ItemType::Research, gameState.researchLastItem->rawValue); } } void WindowResearchDevelopmentPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); // Offset the widget index to allow reuse from other windows auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].type = WindowWidgetType::Empty; // Display button to link to the last development, if there is one - if (gameState.ResearchLastItem.has_value()) + if (gameState.researchLastItem.has_value()) { - auto type = gameState.ResearchLastItem->type; + auto type = gameState.researchLastItem->type; w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].type = WindowWidgetType::FlatBtn; const auto image = type == Research::EntryType::Ride ? SPR_NEW_RIDE : SPR_NEW_SCENERY; w->widgets[WIDX_LAST_DEVELOPMENT_BUTTON + widgetOffset].image = ImageId(image); @@ -354,13 +354,13 @@ namespace OpenRCT2::Ui::Windows void WindowResearchDevelopmentDraw(WindowBase* w, DrawPixelInfo& dpi, WidgetIndex baseWidgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); auto screenCoords = w->windowPos + ScreenCoordsXY{ 10, w->widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP + widgetOffset].top + 12 }; - if (gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL) + if (gameState.researchProgressStage == RESEARCH_STAGE_FINISHED_ALL) { // Research type auto ft = Formatter(); @@ -384,53 +384,53 @@ namespace OpenRCT2::Ui::Windows // Research type auto ft = Formatter(); StringId label = STR_RESEARCH_TYPE_LABEL; - if (gameState.ResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH) + if (gameState.researchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH) { ft.Add(STR_RESEARCH_UNKNOWN); } - else if (gameState.ResearchProgressStage == RESEARCH_STAGE_DESIGNING) + else if (gameState.researchProgressStage == RESEARCH_STAGE_DESIGNING) { - ft.Add(gameState.ResearchNextItem->GetCategoryName()); + ft.Add(gameState.researchNextItem->GetCategoryName()); } - else if (gameState.ResearchNextItem->type == Research::EntryType::Ride) + else if (gameState.researchNextItem->type == Research::EntryType::Ride) { - const auto& rtd = GetRideTypeDescriptor(gameState.ResearchNextItem->baseRideType); + const auto& rtd = GetRideTypeDescriptor(gameState.researchNextItem->baseRideType); if (rtd.HasFlag(RtdFlag::listVehiclesSeparately)) { - ft.Add(gameState.ResearchNextItem->GetName()); + ft.Add(gameState.researchNextItem->GetName()); } - else if (gameState.ResearchNextItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) + else if (gameState.researchNextItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) { ft.Add(rtd.Naming.Name); } else { - ft.Add(gameState.ResearchNextItem->GetName()); + ft.Add(gameState.researchNextItem->GetName()); ft.Add(rtd.Naming.Name); label = STR_RESEARCH_TYPE_LABEL_VEHICLE; } } else { - ft.Add(gameState.ResearchNextItem->GetName()); + ft.Add(gameState.researchNextItem->GetName()); } DrawTextWrapped(dpi, screenCoords, 296, label, ft); screenCoords.y += 25; // Progress ft = Formatter(); - ft.Add(ResearchStageNames[gameState.ResearchProgressStage]); + ft.Add(ResearchStageNames[gameState.researchProgressStage]); DrawTextWrapped(dpi, screenCoords, 296, STR_RESEARCH_PROGRESS_LABEL, ft); screenCoords.y += 15; // Expected ft = Formatter(); - if (gameState.ResearchProgressStage != RESEARCH_STAGE_INITIAL_RESEARCH && gameState.ResearchExpectedDay != 255) + if (gameState.researchProgressStage != RESEARCH_STAGE_INITIAL_RESEARCH && gameState.researchExpectedDay != 255) { // TODO: Should probably use game date format setting ft.Add(STR_RESEARCH_EXPECTED_FORMAT); - ft.Add(DateDayNames[gameState.ResearchExpectedDay]); - ft.Add(DateGameMonthNames[gameState.ResearchExpectedMonth]); + ft.Add(DateDayNames[gameState.researchExpectedDay]); + ft.Add(DateGameMonthNames[gameState.researchExpectedMonth]); } else { @@ -442,30 +442,30 @@ namespace OpenRCT2::Ui::Windows // Last development screenCoords = w->windowPos + ScreenCoordsXY{ 10, w->widgets[WIDX_LAST_DEVELOPMENT_GROUP + widgetOffset].top + 12 }; - if (gameState.ResearchLastItem.has_value()) + if (gameState.researchLastItem.has_value()) { StringId lastDevelopmentFormat = kStringIdEmpty; auto ft = Formatter(); - if (gameState.ResearchLastItem->type == Research::EntryType::Scenery) + if (gameState.researchLastItem->type == Research::EntryType::Scenery) { lastDevelopmentFormat = STR_RESEARCH_SCENERY_LABEL; - ft.Add(gameState.ResearchLastItem->GetName()); + ft.Add(gameState.researchLastItem->GetName()); } else { lastDevelopmentFormat = STR_RESEARCH_RIDE_LABEL; - const auto& rtd = GetRideTypeDescriptor(gameState.ResearchLastItem->baseRideType); + const auto& rtd = GetRideTypeDescriptor(gameState.researchLastItem->baseRideType); if (rtd.HasFlag(RtdFlag::listVehiclesSeparately)) { - ft.Add(gameState.ResearchLastItem->GetName()); + ft.Add(gameState.researchLastItem->GetName()); } - else if (gameState.ResearchLastItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) + else if (gameState.researchLastItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE) { ft.Add(rtd.Naming.Name); } else { - ft.Add(gameState.ResearchLastItem->GetName()); + ft.Add(gameState.researchLastItem->GetName()); ft.Add(rtd.Naming.Name); lastDevelopmentFormat = STR_RESEARCH_VEHICLE_LABEL; } @@ -481,7 +481,7 @@ namespace OpenRCT2::Ui::Windows void WindowResearchFundingMouseDown(WindowBase* w, WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); if (widgetIndex != (WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset)) @@ -498,13 +498,13 @@ namespace OpenRCT2::Ui::Windows { w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 3); - int32_t currentResearchLevel = gameState.ResearchFundingLevel; + int32_t currentResearchLevel = gameState.researchFundingLevel; Dropdown::SetChecked(currentResearchLevel, true); } void WindowResearchFundingMouseUp(WidgetIndex widgetIndex, WidgetIndex baseWidgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); switch (widgetIndex - widgetOffset) @@ -517,9 +517,9 @@ namespace OpenRCT2::Ui::Windows case WIDX_SHOPS_AND_STALLS: case WIDX_SCENERY_AND_THEMING: { - auto activeResearchTypes = gameState.ResearchPriorities; + auto activeResearchTypes = gameState.researchPriorities; activeResearchTypes ^= 1uLL << (widgetIndex - (WIDX_TRANSPORT_RIDES + widgetOffset)); - auto gameAction = ParkSetResearchFundingAction(activeResearchTypes, gameState.ResearchFundingLevel); + auto gameAction = ParkSetResearchFundingAction(activeResearchTypes, gameState.researchFundingLevel); GameActions::Execute(&gameAction); break; } @@ -528,22 +528,22 @@ namespace OpenRCT2::Ui::Windows void WindowResearchFundingDropdown(WidgetIndex widgetIndex, int32_t selectedIndex, WidgetIndex baseWidgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); if (widgetIndex != (WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON + widgetOffset) || selectedIndex == -1) return; - auto gameAction = ParkSetResearchFundingAction(gameState.ResearchPriorities, selectedIndex); + auto gameAction = ParkSetResearchFundingAction(gameState.researchPriorities, selectedIndex); GameActions::Execute(&gameAction); } void WindowResearchFundingPrepareDraw(WindowBase* w, WidgetIndex baseWidgetIndex) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto widgetOffset = GetWidgetIndexOffset(baseWidgetIndex, WIDX_RESEARCH_FUNDING); - if ((gameState.Park.Flags & PARK_FLAGS_NO_MONEY) || gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL) + if ((gameState.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_DROPDOWN_BUTTON + widgetOffset].type = WindowWidgetType::Empty; @@ -555,12 +555,12 @@ namespace OpenRCT2::Ui::Windows } // Current funding - int32_t currentResearchLevel = gameState.ResearchFundingLevel; + int32_t currentResearchLevel = gameState.researchFundingLevel; w->widgets[WIDX_RESEARCH_FUNDING + widgetOffset].text = kResearchFundingLevelNames[currentResearchLevel]; // Checkboxes - uint8_t activeResearchTypes = gameState.ResearchPriorities; - int32_t uncompletedResearchTypes = gameState.ResearchUncompletedCategories; + uint8_t activeResearchTypes = gameState.researchPriorities; + int32_t uncompletedResearchTypes = gameState.researchUncompletedCategories; for (int32_t i = 0; i < 7; i++) { int32_t mask = 1 << i; @@ -587,11 +587,11 @@ namespace OpenRCT2::Ui::Windows void WindowResearchFundingDraw(WindowBase* w, DrawPixelInfo& dpi) { - const auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + const auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) return; - int32_t currentResearchLevel = gameState.ResearchFundingLevel; + int32_t currentResearchLevel = gameState.researchFundingLevel; auto ft = Formatter(); ft.Add(research_cost_table[currentResearchLevel]); DrawTextBasic( diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 0e36b7a9f3..3d401b4152 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1383,7 +1383,7 @@ namespace OpenRCT2::Ui::Windows } if (rtd.specialType == RtdSpecialType::cashMachine || rtd.specialType == RtdSpecialType::firstAid - || (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) != 0) + || (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) != 0) disabledTabs |= (1uLL << WIDX_TAB_9); // 0x1000 if (gLegacyScene == LegacyScene::trackDesigner) @@ -1707,7 +1707,7 @@ namespace OpenRCT2::Ui::Windows } } } - if (GetGameState().Cheats.allowArbitraryRideTypeChanges) + if (getGameState().cheats.allowArbitraryRideTypeChanges) { minHeight += 15; } @@ -2007,9 +2007,9 @@ namespace OpenRCT2::Ui::Windows bool selectionShouldBeExpanded; ride_type_t rideTypeIterator, rideTypeIteratorMax; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); const auto& rtd = ride.getRideTypeDescriptor(); - if (gameState.Cheats.showVehiclesFromOtherTrackTypes + if (gameState.cheats.showVehiclesFromOtherTrackTypes && !( rtd.HasFlag(RtdFlag::isFlatRide) || rtd.specialType == RtdSpecialType::maze || rtd.specialType == RtdSpecialType::miniGolf)) @@ -2050,7 +2050,7 @@ namespace OpenRCT2::Ui::Windows continue; // Skip if vehicle type has not been invented yet - if (!RideEntryIsInvented(rideEntryIndex) && !gameState.Cheats.ignoreResearchStatus) + if (!RideEntryIsInvented(rideEntryIndex) && !gameState.cheats.ignoreResearchStatus) continue; auto name = currentRideEntry->naming.Name; @@ -2328,10 +2328,10 @@ namespace OpenRCT2::Ui::Windows if (ride == nullptr) return; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); disabled_widgets &= ~((1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_CONSTRUCTION)); if (ride->lifecycleFlags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) - && !gameState.Cheats.makeAllDestructible) + && !gameState.cheats.makeAllDestructible) disabled_widgets |= (1uLL << WIDX_DEMOLISH); auto ft = Formatter::Common(); @@ -2370,7 +2370,7 @@ namespace OpenRCT2::Ui::Windows AnchorBorderWidgets(); - const int32_t offset = gameState.Cheats.allowArbitraryRideTypeChanges ? 15 : 0; + const int32_t offset = gameState.cheats.allowArbitraryRideTypeChanges ? 15 : 0; // Anchor main page specific widgets widgets[WIDX_VIEWPORT].right = width - 26; widgets[WIDX_VIEWPORT].bottom = height - (14 + offset); @@ -2388,7 +2388,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_RIDE_TYPE_DROPDOWN].top = height - 16; widgets[WIDX_RIDE_TYPE_DROPDOWN].bottom = height - 5; - if (!gameState.Cheats.allowArbitraryRideTypeChanges) + if (!gameState.cheats.allowArbitraryRideTypeChanges) { widgets[WIDX_RIDE_TYPE].type = WindowWidgetType::Empty; widgets[WIDX_RIDE_TYPE_DROPDOWN].type = WindowWidgetType::Empty; @@ -2795,9 +2795,9 @@ namespace OpenRCT2::Ui::Windows // Vehicle type widgets[WIDX_VEHICLE_TYPE].text = rideEntry->naming.Name; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); // Trains - if (rideEntry->cars_per_flat_ride > 1 || gameState.Cheats.disableTrainLengthLimit) + if (rideEntry->cars_per_flat_ride > 1 || gameState.cheats.disableTrainLengthLimit) { widgets[WIDX_VEHICLE_TRAINS].type = WindowWidgetType::Spinner; widgets[WIDX_VEHICLE_TRAINS_INCREASE].type = WindowWidgetType::Button; @@ -2811,7 +2811,7 @@ namespace OpenRCT2::Ui::Windows } // Cars per train - if (rideEntry->zero_cars + 1 < rideEntry->max_cars_in_train || gameState.Cheats.disableTrainLengthLimit) + if (rideEntry->zero_cars + 1 < rideEntry->max_cars_in_train || gameState.cheats.disableTrainLengthLimit) { widgets[WIDX_VEHICLE_CARS_PER_TRAIN].type = WindowWidgetType::Spinner; widgets[WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE].type = WindowWidgetType::Button; @@ -2825,7 +2825,7 @@ namespace OpenRCT2::Ui::Windows } if (ride->getRideTypeDescriptor().HasFlag(RtdFlag::allowReversedTrains) - || (gameState.Cheats.disableTrainLengthLimit && !ride->getRideTypeDescriptor().HasFlag(RtdFlag::isFlatRide))) + || (gameState.cheats.disableTrainLengthLimit && !ride->getRideTypeDescriptor().HasFlag(RtdFlag::isFlatRide))) { widgets[WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX].type = WindowWidgetType::Checkbox; if (ride->hasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS)) @@ -3065,11 +3065,11 @@ namespace OpenRCT2::Ui::Windows return; const auto& operatingSettings = ride->getRideTypeDescriptor().OperatingSettings; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); uint8_t maxValue = operatingSettings.MaxValue; - uint8_t minValue = gameState.Cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; + uint8_t minValue = gameState.cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; - if (gameState.Cheats.unlockOperatingLimits) + if (gameState.cheats.unlockOperatingLimits) { maxValue = OpenRCT2::Limits::kCheatsMaxOperatingLimit; } @@ -3087,10 +3087,10 @@ namespace OpenRCT2::Ui::Windows return; const auto& operatingSettings = ride->getRideTypeDescriptor().OperatingSettings; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); uint8_t maxValue = operatingSettings.MaxValue; - uint8_t minValue = gameState.Cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; - if (gameState.Cheats.unlockOperatingLimits) + uint8_t minValue = gameState.cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; + if (gameState.cheats.unlockOperatingLimits) { maxValue = OpenRCT2::Limits::kCheatsMaxOperatingLimit; } @@ -3228,10 +3228,10 @@ namespace OpenRCT2::Ui::Windows ModeTweakDecrease(); break; case WIDX_LIFT_HILL_SPEED_INCREASE: - upperBound = GetGameState().Cheats.unlockOperatingLimits + upperBound = getGameState().cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit : ride->getRideTypeDescriptor().LiftData.maximum_speed; - lowerBound = GetGameState().Cheats.unlockOperatingLimits + lowerBound = getGameState().cheats.unlockOperatingLimits ? 0 : ride->getRideTypeDescriptor().LiftData.minimum_speed; SetOperatingSetting( @@ -3239,10 +3239,10 @@ namespace OpenRCT2::Ui::Windows std::clamp(ride->liftHillSpeed + 1, lowerBound, upperBound)); break; case WIDX_LIFT_HILL_SPEED_DECREASE: - upperBound = GetGameState().Cheats.unlockOperatingLimits + upperBound = getGameState().cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit : ride->getRideTypeDescriptor().LiftData.maximum_speed; - lowerBound = GetGameState().Cheats.unlockOperatingLimits + lowerBound = getGameState().cheats.unlockOperatingLimits ? 0 : ride->getRideTypeDescriptor().LiftData.minimum_speed; SetOperatingSetting( @@ -3290,7 +3290,7 @@ namespace OpenRCT2::Ui::Windows LoadDropdown(&widgets[widgetIndex]); break; case WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE: - upperBound = GetGameState().Cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit + upperBound = getGameState().cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit : OpenRCT2::Limits::kMaxCircuitsPerRide; lowerBound = 1; SetOperatingSetting( @@ -3298,7 +3298,7 @@ namespace OpenRCT2::Ui::Windows std::clamp(ride->numCircuits + 1, lowerBound, upperBound)); break; case WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE: - upperBound = GetGameState().Cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit + upperBound = getGameState().cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit : OpenRCT2::Limits::kMaxCircuitsPerRide; lowerBound = 1; SetOperatingSetting( @@ -3342,10 +3342,10 @@ namespace OpenRCT2::Ui::Windows } const auto& operatingSettings = ride.getRideTypeDescriptor().OperatingSettings; - const auto& gameState = GetGameState(); - int16_t maxValue = gameState.Cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit + const auto& gameState = getGameState(); + int16_t maxValue = gameState.cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit : operatingSettings.MaxValue; - int16_t minValue = gameState.Cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; + int16_t minValue = gameState.cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; const auto& title = widgets[WIDX_MODE_TWEAK_LABEL].text; Formatter ft; @@ -3425,10 +3425,10 @@ namespace OpenRCT2::Ui::Windows if (widgetIndex == WIDX_MODE_TWEAK) { const auto& operatingSettings = ride->getRideTypeDescriptor().OperatingSettings; - const auto& gameState = GetGameState(); - uint32_t maxValue = gameState.Cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit + const auto& gameState = getGameState(); + uint32_t maxValue = gameState.cheats.unlockOperatingLimits ? OpenRCT2::Limits::kCheatsMaxOperatingLimit : operatingSettings.MaxValue; - uint32_t minValue = gameState.Cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; + uint32_t minValue = gameState.cheats.unlockOperatingLimits ? 0 : operatingSettings.MinValue; auto multiplier = ride->getRideTypeDescriptor().OperatingSettings.OperatingSettingMultiplier; try @@ -4052,7 +4052,7 @@ namespace OpenRCT2::Ui::Windows // Locate mechanic button image Widget* widget = &widgets[WIDX_LOCATE_MECHANIC]; auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; - auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, GetGameState().StaffMechanicColour); + auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, getGameState().staffMechanicColour); GfxDrawSprite(dpi, image, screenCoords); // Inspection label @@ -4501,7 +4501,7 @@ namespace OpenRCT2::Ui::Windows rideSetAppearanceAction.SetCallback([objIndex](const GameAction*, const GameActions::Result* res) { if (res->Error != GameActions::Status::Ok) return; - GetGameState().LastEntranceStyle = objIndex; + getGameState().lastEntranceStyle = objIndex; }); GameActions::Execute(&rideSetAppearanceAction); break; @@ -4879,7 +4879,7 @@ namespace OpenRCT2::Ui::Windows { colour_t spriteColour = COLOUR_BLACK; // Limit update rate of preview to avoid making people dizzy. - if ((GetGameState().CurrentTicks % 64) == 0) + if ((getGameState().currentTicks % 64) == 0) { spriteColour++; if (spriteColour >= kColourNumNormal) @@ -5079,7 +5079,7 @@ namespace OpenRCT2::Ui::Windows } } - if (GetGameState().Cheats.unlockOperatingLimits || musicObj->SupportsRideType(ride->type)) + if (getGameState().cheats.unlockOperatingLimits || musicObj->SupportsRideType(ride->type)) { musicOrder.push_back(i); } @@ -6240,8 +6240,8 @@ namespace OpenRCT2::Ui::Windows static void UpdateSamePriceThroughoutFlags(ShopItem shop_item) { - const auto& gameState = GetGameState(); - const auto existingFlags = gameState.SamePriceThroughoutPark; + const auto& gameState = getGameState(); + const auto existingFlags = gameState.samePriceThroughoutPark; auto newFlags = existingFlags; if (GetShopItemDescriptor(shop_item).IsPhoto()) diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 23ab6014af..78c0caf862 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -434,7 +434,7 @@ namespace OpenRCT2::Ui::Windows } } if (currentRide->getRideTypeDescriptor().HasFlag(RtdFlag::upInclineRequiresLift) - && !GetGameState().Cheats.enableAllDrawableTrackPieces) + && !getGameState().cheats.enableAllDrawableTrackPieces) { // Disable lift hill toggle and banking if current track piece is uphill if (_previousTrackPitchEnd == TrackPitch::Up25 || _previousTrackPitchEnd == TrackPitch::Up60 @@ -772,7 +772,7 @@ namespace OpenRCT2::Ui::Windows { disabledWidgets |= (1uLL << WIDX_SLOPE_DOWN); } - if ((_currentTrackHasLiftHill) && !GetGameState().Cheats.enableChainLiftOnAllTrack) + if ((_currentTrackHasLiftHill) && !getGameState().cheats.enableChainLiftOnAllTrack) { if (_currentTrackPitchEnd != TrackPitch::None && !IsTrackEnabled(TrackGroup::liftHillCurve)) { @@ -867,7 +867,7 @@ namespace OpenRCT2::Ui::Windows { if (_currentTrackPitchEnd == TrackPitch::None && _previousTrackRollEnd != TrackRoll::None && (!currentRide->getRideTypeDescriptor().HasFlag(RtdFlag::upInclineRequiresLift) - || GetGameState().Cheats.enableAllDrawableTrackPieces)) + || getGameState().cheats.enableAllDrawableTrackPieces)) { disabledWidgets &= ~(1uLL << WIDX_SLOPE_UP); } @@ -931,7 +931,7 @@ namespace OpenRCT2::Ui::Windows } // If chain lift cheat is enabled then show the chain lift widget no matter what - if (GetGameState().Cheats.enableChainLiftOnAllTrack) + if (getGameState().cheats.enableChainLiftOnAllTrack) { disabledWidgets &= ~(1uLL << WIDX_CHAIN_LIFT); } @@ -1352,7 +1352,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_CHAIN_LIFT: RideConstructionInvalidateCurrentTrack(); _currentTrackHasLiftHill = !_currentTrackHasLiftHill; - if ((_currentTrackHasLiftHill) && !GetGameState().Cheats.enableChainLiftOnAllTrack) + if ((_currentTrackHasLiftHill) && !getGameState().cheats.enableChainLiftOnAllTrack) _currentTrackAlternative.unset(AlternativeTrackFlag::alternativePieces); _currentTrackPrice = kMoney64Undefined; WindowRideConstructionUpdateActiveElements(); @@ -1405,7 +1405,7 @@ namespace OpenRCT2::Ui::Windows { auto trackSpeedIncrement = kDefaultSpeedIncrement; auto trackSpeedMinimum = kDefaultMinimumSpeed; - if (GetGameState().Cheats.unlockOperatingLimits) + if (getGameState().cheats.unlockOperatingLimits) { trackSpeedMinimum = 0; } @@ -1436,7 +1436,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_O_TRACK: RideConstructionInvalidateCurrentTrack(); _currentTrackAlternative.set(AlternativeTrackFlag::alternativePieces); - if (!GetGameState().Cheats.enableChainLiftOnAllTrack) + if (!getGameState().cheats.enableChainLiftOnAllTrack) _currentTrackHasLiftHill = false; _currentTrackPrice = kMoney64Undefined; WindowRideConstructionUpdateActiveElements(); @@ -1655,7 +1655,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); screenCoords.y += 11; - if (_currentTrackPrice != kMoney64Undefined && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (_currentTrackPrice != kMoney64Undefined && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_currentTrackPrice); @@ -1793,16 +1793,16 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SLOPE_UP_STEEP].type = WindowWidgetType::FlatBtn; } - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); if (currentRide->getRideTypeDescriptor().HasFlag(RtdFlag::upInclineRequiresLift) && (_currentTrackPitchEnd == TrackPitch::Up25 || _currentTrackPitchEnd == TrackPitch::Up60) - && !gameState.Cheats.enableAllDrawableTrackPieces) + && !gameState.cheats.enableAllDrawableTrackPieces) { _currentTrackHasLiftHill = true; } if ((IsTrackEnabled(TrackGroup::liftHill) && !_currentlySelectedTrack.isTrackType) - || (gameState.Cheats.enableChainLiftOnAllTrack + || (gameState.cheats.enableChainLiftOnAllTrack && currentRide->getRideTypeDescriptor().HasFlag(RtdFlag::hasTrack))) { widgets[WIDX_CHAIN_LIFT].type = WindowWidgetType::FlatBtn; @@ -2485,7 +2485,7 @@ namespace OpenRCT2::Ui::Windows { _currentTrackPitchEnd = slope; _currentTrackPrice = kMoney64Undefined; - if (_rideConstructionState == RideConstructionState::Front && !GetGameState().Cheats.enableChainLiftOnAllTrack) + if (_rideConstructionState == RideConstructionState::Front && !getGameState().cheats.enableChainLiftOnAllTrack) { switch (slope) { @@ -2685,10 +2685,10 @@ namespace OpenRCT2::Ui::Windows return; } - auto& gameState = GetGameState(); - auto preserveMapSize = gameState.MapSize; + auto& gameState = getGameState(); + auto preserveMapSize = gameState.mapSize; - gameState.MapSize = { kMaximumMapSizeTechnical, kMaximumMapSizeTechnical }; + gameState.mapSize = { kMaximumMapSizeTechnical, kMaximumMapSizeTechnical }; // Setup non changing parts of the temporary track tile element tempTrackTileElement.SetType(TileElementType::Track); @@ -2754,7 +2754,7 @@ namespace OpenRCT2::Ui::Windows MapSetTileElement(southTileCoords, backupTileElementArrays[4]); } - gameState.MapSize = preserveMapSize; + gameState.mapSize = preserveMapSize; PaintSessionArrange(*session); PaintDrawStructs(*session); @@ -3607,7 +3607,7 @@ namespace OpenRCT2::Ui::Windows // FIX not sure exactly why it starts trial and error place from a lower Z, but it causes issues with disable // clearance - if (!GetGameState().Cheats.disableClearanceChecks && z > kMinimumLandZ) + if (!getGameState().cheats.disableClearanceChecks && z > kMinimumLandZ) { z -= kLandHeightStep; } @@ -4986,7 +4986,7 @@ namespace OpenRCT2::Ui::Windows if (coveredVariant != TrackElemType::None && (availableGroups.get(EnumValue(ted.definition.group)))) { trackType = coveredVariant; - if (!GetGameState().Cheats.enableChainLiftOnAllTrack) + if (!getGameState().cheats.enableChainLiftOnAllTrack) liftHillAndInvertedState.unset(LiftHillAndInverted::liftHill); } } @@ -5036,7 +5036,7 @@ namespace OpenRCT2::Ui::Windows turnOffLiftHill = true; } - if (turnOffLiftHill && !GetGameState().Cheats.enableChainLiftOnAllTrack) + if (turnOffLiftHill && !getGameState().cheats.enableChainLiftOnAllTrack) { liftHillAndInvertedState.unset(LiftHillAndInverted::liftHill); _currentTrackHasLiftHill = false; diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 33916013e2..c46e3788aa 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -301,7 +301,7 @@ namespace OpenRCT2::Ui::Windows int32_t selectedIndex = -1; for (int32_t type = INFORMATION_TYPE_STATUS; type <= lastType; type++) { - if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if ((getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { if (ride_info_type_money_mapping[type]) { diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index b473733aab..e23fb73b44 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -171,7 +171,7 @@ namespace OpenRCT2::Ui::Windows intent = std::make_unique(WindowClass::Loadsave); intent->PutEnumExtra(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save); intent->PutEnumExtra(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::landscape); - intent->PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName); + intent->PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioName); } else { diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 939add7e66..ecf4644810 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -691,7 +691,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::FlatBtn; } - if (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) + if (gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) { widgets[WIDX_RESTRICT_SCENERY].type = WindowWidgetType::Button; if (IsSceneryItemRestricted(tabSelectedScenery)) @@ -842,7 +842,7 @@ namespace OpenRCT2::Ui::Windows } auto [name, price] = GetNameAndPrice(selectedSceneryEntry); - if (price != kMoney64Undefined && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (price != kMoney64Undefined && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(price); @@ -2366,7 +2366,7 @@ namespace OpenRCT2::Ui::Windows void Sub6E1F34UpdateScreenCoordsAndButtonsPressed(bool canRaiseItem, ScreenCoordsXY& screenPos) { - if (!canRaiseItem && !GetGameState().Cheats.disableSupportLimits) + if (!canRaiseItem && !getGameState().cheats.disableSupportLimits) { gSceneryCtrlPressed = false; gSceneryShiftPressed = false; diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index a2e9717137..b48cb9f891 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -931,7 +931,7 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_RESIZE].left + 4, widgets[WIDX_RESIZE].top + 4 }; - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(GetStaffWage(staff->AssignedStaffType)); diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index a9df8ef1b8..ffc89ece0c 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -281,7 +281,7 @@ namespace OpenRCT2::Ui::Windows DrawWidgets(dpi); DrawTabImages(dpi); - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(GetStaffWage(GetSelectedStaffType())); @@ -594,10 +594,10 @@ namespace OpenRCT2::Ui::Windows void DrawTabImages(DrawPixelInfo& dpi) const { - const auto& gameState = GetGameState(); - DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_HANDYMEN, AnimationPeepType::Handyman, gameState.StaffHandymanColour); - DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_MECHANICS, AnimationPeepType::Mechanic, gameState.StaffMechanicColour); - DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_SECURITY, AnimationPeepType::Security, gameState.StaffSecurityColour); + const auto& gameState = getGameState(); + DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_HANDYMEN, AnimationPeepType::Handyman, gameState.staffHandymanColour); + DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_MECHANICS, AnimationPeepType::Mechanic, gameState.staffMechanicColour); + DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_SECURITY, AnimationPeepType::Security, gameState.staffSecurityColour); DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, AnimationPeepType::Entertainer); } diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 8ef77c5369..431297b18d 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -466,7 +466,7 @@ namespace OpenRCT2::Ui::Windows auto intent = Intent(WindowClass::Loadsave); intent.PutEnumExtra(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save); intent.PutEnumExtra(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::landscape); - intent.PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName); + intent.PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioName); ContextOpenIntent(&intent); } else @@ -650,7 +650,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PAUSE].type = WindowWidgetType::Empty; } - if ((GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) || !Config::Get().interface.ToolbarShowFinances) + if ((getGameState().park.Flags & PARK_FLAGS_NO_MONEY) || !Config::Get().interface.ToolbarShowFinances) widgets[WIDX_FINANCES].type = WindowWidgetType::Empty; } @@ -669,22 +669,22 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_NEWS].type = WindowWidgetType::Empty; widgets[WIDX_NETWORK].type = WindowWidgetType::Empty; - auto& gameState = GetGameState(); - if (gameState.EditorStep != EditorStep::LandscapeEditor) + auto& gameState = getGameState(); + if (gameState.editorStep != EditorStep::LandscapeEditor) { widgets[WIDX_LAND].type = WindowWidgetType::Empty; widgets[WIDX_WATER].type = WindowWidgetType::Empty; } - if (gameState.EditorStep != EditorStep::RollercoasterDesigner) + if (gameState.editorStep != EditorStep::RollercoasterDesigner) { widgets[WIDX_RIDES].type = WindowWidgetType::Empty; widgets[WIDX_CONSTRUCT_RIDE].type = WindowWidgetType::Empty; widgets[WIDX_FASTFORWARD].type = WindowWidgetType::Empty; } - if (gameState.EditorStep != EditorStep::LandscapeEditor - && gameState.EditorStep != EditorStep::RollercoasterDesigner) + if (gameState.editorStep != EditorStep::LandscapeEditor + && gameState.editorStep != EditorStep::RollercoasterDesigner) { widgets[WIDX_MAP].type = WindowWidgetType::Empty; widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; @@ -878,7 +878,7 @@ namespace OpenRCT2::Ui::Windows void OnDraw(DrawPixelInfo& dpi) override { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); int32_t imgId; WindowDrawWidgets(*this, dpi); @@ -891,7 +891,7 @@ namespace OpenRCT2::Ui::Windows imgId = SPR_TOOLBAR_STAFF; if (WidgetIsPressed(*this, WIDX_STAFF)) imgId++; - GfxDrawSprite(dpi, ImageId(imgId, gameState.StaffHandymanColour, gameState.StaffMechanicColour), screenPos); + GfxDrawSprite(dpi, ImageId(imgId, gameState.staffHandymanColour, gameState.staffMechanicColour), screenPos); } // Draw fast forward button @@ -922,7 +922,7 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(dpi, ImageId(SPR_G2_SANDBOX), screenPos); // Draw an overlay if clearance checks are disabled - if (GetGameState().Cheats.disableClearanceChecks) + if (getGameState().cheats.disableClearanceChecks) { auto colour = ColourWithFlags{ COLOUR_DARK_ORANGE }.withFlag(ColourFlag::withOutline, true); DrawTextBasic( @@ -1185,7 +1185,7 @@ namespace OpenRCT2::Ui::Windows auto i = 0; gDropdownItems[i++].Format = STR_SHORTCUT_SHOW_MAP; gDropdownItems[i++].Format = STR_EXTRA_VIEWPORT; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep == EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep == EditorStep::LandscapeEditor) { gDropdownItems[i++].Format = STR_MAPGEN_MENU_ITEM; } @@ -1217,7 +1217,7 @@ namespace OpenRCT2::Ui::Windows void TopToolbar::MapMenuDropdown(int16_t dropdownIndex) { int32_t customStartIndex = 3; - if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep == EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep == EditorStep::LandscapeEditor) { customStartIndex++; } @@ -1437,16 +1437,16 @@ namespace OpenRCT2::Ui::Windows Dropdown::SetDisabled(DDIDX_ENABLE_SANDBOX_MODE, true); } - auto& gameState = GetGameState(); - if (gameState.Cheats.sandboxMode) + auto& gameState = getGameState(); + if (gameState.cheats.sandboxMode) { Dropdown::SetChecked(DDIDX_ENABLE_SANDBOX_MODE, true); } - if (gameState.Cheats.disableClearanceChecks) + if (gameState.cheats.disableClearanceChecks) { Dropdown::SetChecked(DDIDX_DISABLE_CLEARANCE_CHECKS, true); } - if (gameState.Cheats.disableSupportLimits) + if (gameState.cheats.disableSupportLimits) { Dropdown::SetChecked(DDIDX_DISABLE_SUPPORT_LIMITS, true); } @@ -1481,13 +1481,13 @@ namespace OpenRCT2::Ui::Windows ContextOpenWindow(WindowClass::EditorObjectiveOptions); break; case DDIDX_ENABLE_SANDBOX_MODE: - CheatsSet(CheatType::SandboxMode, !GetGameState().Cheats.sandboxMode); + CheatsSet(CheatType::SandboxMode, !getGameState().cheats.sandboxMode); break; case DDIDX_DISABLE_CLEARANCE_CHECKS: - CheatsSet(CheatType::DisableClearanceChecks, !GetGameState().Cheats.disableClearanceChecks); + CheatsSet(CheatType::DisableClearanceChecks, !getGameState().cheats.disableClearanceChecks); break; case DDIDX_DISABLE_SUPPORT_LIMITS: - CheatsSet(CheatType::DisableSupportLimits, !GetGameState().Cheats.disableSupportLimits); + CheatsSet(CheatType::DisableSupportLimits, !getGameState().cheats.disableSupportLimits); break; } } diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 12db3043c9..1da514951c 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -206,7 +206,7 @@ namespace OpenRCT2::Ui::Windows } money64 cost = kMoney64Undefined; - if (GameIsNotPaused() || GetGameState().Cheats.buildInPauseMode) + if (GameIsNotPaused() || getGameState().cheats.buildInPauseMode) { ClearProvisional(); auto res = FindValidTrackDesignPlaceHeight(trackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); @@ -355,7 +355,7 @@ namespace OpenRCT2::Ui::Windows } // Price - if (_placementCost != kMoney64Undefined && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (_placementCost != kMoney64Undefined && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { ft = Formatter(); ft.Add(_placementCost); diff --git a/src/openrct2-ui/windows/Transparency.cpp b/src/openrct2-ui/windows/Transparency.cpp index d2f25d899d..1ae592a090 100644 --- a/src/openrct2-ui/windows/Transparency.cpp +++ b/src/openrct2-ui/windows/Transparency.cpp @@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows // Locate mechanic button image const auto& widget = widgets[WIDX_HIDE_STAFF]; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; - auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, GetGameState().StaffMechanicColour); + auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, getGameState().staffMechanicColour); GfxDrawSprite(dpi, image, screenCoords); } diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 7d6748da10..47abbc450f 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -163,7 +163,7 @@ namespace OpenRCT2::Ui::Windows dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); } - if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { // Draw raise cost amount screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x, widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 }; diff --git a/src/openrct2/Cheats.cpp b/src/openrct2/Cheats.cpp index 869231f773..fca84d4d5a 100644 --- a/src/openrct2/Cheats.cpp +++ b/src/openrct2/Cheats.cpp @@ -28,35 +28,35 @@ using namespace OpenRCT2; void CheatsReset() { - auto& gameState = GetGameState(); - gameState.Cheats.sandboxMode = false; - gameState.Cheats.disableClearanceChecks = false; - gameState.Cheats.disableSupportLimits = false; - gameState.Cheats.showAllOperatingModes = false; - gameState.Cheats.showVehiclesFromOtherTrackTypes = false; - gameState.Cheats.disableTrainLengthLimit = false; - gameState.Cheats.enableChainLiftOnAllTrack = false; - gameState.Cheats.unlockOperatingLimits = false; - gameState.Cheats.disableBrakesFailure = false; - gameState.Cheats.disableAllBreakdowns = false; - gameState.Cheats.buildInPauseMode = false; - gameState.Cheats.ignoreRideIntensity = false; - gameState.Cheats.ignorePrice = false; - gameState.Cheats.disableVandalism = false; - gameState.Cheats.disableLittering = false; - gameState.Cheats.neverendingMarketing = false; - gameState.Cheats.freezeWeather = false; - gameState.Cheats.disablePlantAging = false; - gameState.Cheats.allowArbitraryRideTypeChanges = false; - gameState.Cheats.disableRideValueAging = false; - gameState.Cheats.ignoreResearchStatus = false; - gameState.Cheats.enableAllDrawableTrackPieces = false; - gameState.Cheats.allowTrackPlaceInvalidHeights = false; - gameState.Cheats.allowRegularPathAsQueue = false; - gameState.Cheats.allowSpecialColourSchemes = false; - gameState.Cheats.makeAllDestructible = false; - gameState.Cheats.selectedStaffSpeed = StaffSpeedCheat::None; - gameState.Cheats.forcedParkRating = kForcedParkRatingDisabled; + auto& gameState = getGameState(); + gameState.cheats.sandboxMode = false; + gameState.cheats.disableClearanceChecks = false; + gameState.cheats.disableSupportLimits = false; + gameState.cheats.showAllOperatingModes = false; + gameState.cheats.showVehiclesFromOtherTrackTypes = false; + gameState.cheats.disableTrainLengthLimit = false; + gameState.cheats.enableChainLiftOnAllTrack = false; + gameState.cheats.unlockOperatingLimits = false; + gameState.cheats.disableBrakesFailure = false; + gameState.cheats.disableAllBreakdowns = false; + gameState.cheats.buildInPauseMode = false; + gameState.cheats.ignoreRideIntensity = false; + gameState.cheats.ignorePrice = false; + gameState.cheats.disableVandalism = false; + gameState.cheats.disableLittering = false; + gameState.cheats.neverendingMarketing = false; + gameState.cheats.freezeWeather = false; + gameState.cheats.disablePlantAging = false; + gameState.cheats.allowArbitraryRideTypeChanges = false; + gameState.cheats.disableRideValueAging = false; + gameState.cheats.ignoreResearchStatus = false; + gameState.cheats.enableAllDrawableTrackPieces = false; + gameState.cheats.allowTrackPlaceInvalidHeights = false; + gameState.cheats.allowRegularPathAsQueue = false; + gameState.cheats.allowSpecialColourSchemes = false; + gameState.cheats.makeAllDestructible = false; + gameState.cheats.selectedStaffSpeed = StaffSpeedCheat::None; + gameState.cheats.forcedParkRating = kForcedParkRatingDisabled; } void CheatsSet(CheatType cheatType, int64_t param1 /* = 0*/, int64_t param2 /* = 0*/) @@ -75,7 +75,7 @@ static void CheatEntrySerialise(DataSerialiser& ds, CheatType type, const T& val void CheatsSerialise(DataSerialiser& ds) { uint16_t count = 0; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (ds.IsSaving()) { @@ -85,37 +85,37 @@ void CheatsSerialise(DataSerialiser& ds) uint64_t countOffset = stream.GetPosition(); ds << count; - CheatEntrySerialise(ds, CheatType::SandboxMode, gameState.Cheats.sandboxMode, count); - CheatEntrySerialise(ds, CheatType::DisableClearanceChecks, gameState.Cheats.disableClearanceChecks, count); - CheatEntrySerialise(ds, CheatType::DisableSupportLimits, gameState.Cheats.disableSupportLimits, count); - CheatEntrySerialise(ds, CheatType::ShowAllOperatingModes, gameState.Cheats.showAllOperatingModes, count); + CheatEntrySerialise(ds, CheatType::SandboxMode, gameState.cheats.sandboxMode, count); + CheatEntrySerialise(ds, CheatType::DisableClearanceChecks, gameState.cheats.disableClearanceChecks, count); + CheatEntrySerialise(ds, CheatType::DisableSupportLimits, gameState.cheats.disableSupportLimits, count); + CheatEntrySerialise(ds, CheatType::ShowAllOperatingModes, gameState.cheats.showAllOperatingModes, count); CheatEntrySerialise( - ds, CheatType::ShowVehiclesFromOtherTrackTypes, gameState.Cheats.showVehiclesFromOtherTrackTypes, count); - CheatEntrySerialise(ds, CheatType::FastLiftHill, gameState.Cheats.unlockOperatingLimits, count); - CheatEntrySerialise(ds, CheatType::DisableBrakesFailure, gameState.Cheats.disableBrakesFailure, count); - CheatEntrySerialise(ds, CheatType::DisableAllBreakdowns, gameState.Cheats.disableAllBreakdowns, count); - CheatEntrySerialise(ds, CheatType::BuildInPauseMode, gameState.Cheats.buildInPauseMode, count); - CheatEntrySerialise(ds, CheatType::IgnoreRideIntensity, gameState.Cheats.ignoreRideIntensity, count); - CheatEntrySerialise(ds, CheatType::DisableVandalism, gameState.Cheats.disableVandalism, count); - CheatEntrySerialise(ds, CheatType::DisableLittering, gameState.Cheats.disableLittering, count); - CheatEntrySerialise(ds, CheatType::NeverendingMarketing, gameState.Cheats.neverendingMarketing, count); - CheatEntrySerialise(ds, CheatType::FreezeWeather, gameState.Cheats.freezeWeather, count); - CheatEntrySerialise(ds, CheatType::DisableTrainLengthLimit, gameState.Cheats.disableTrainLengthLimit, count); - CheatEntrySerialise(ds, CheatType::DisablePlantAging, gameState.Cheats.disablePlantAging, count); - CheatEntrySerialise(ds, CheatType::EnableChainLiftOnAllTrack, gameState.Cheats.enableChainLiftOnAllTrack, count); + ds, CheatType::ShowVehiclesFromOtherTrackTypes, gameState.cheats.showVehiclesFromOtherTrackTypes, count); + CheatEntrySerialise(ds, CheatType::FastLiftHill, gameState.cheats.unlockOperatingLimits, count); + CheatEntrySerialise(ds, CheatType::DisableBrakesFailure, gameState.cheats.disableBrakesFailure, count); + CheatEntrySerialise(ds, CheatType::DisableAllBreakdowns, gameState.cheats.disableAllBreakdowns, count); + CheatEntrySerialise(ds, CheatType::BuildInPauseMode, gameState.cheats.buildInPauseMode, count); + CheatEntrySerialise(ds, CheatType::IgnoreRideIntensity, gameState.cheats.ignoreRideIntensity, count); + CheatEntrySerialise(ds, CheatType::DisableVandalism, gameState.cheats.disableVandalism, count); + CheatEntrySerialise(ds, CheatType::DisableLittering, gameState.cheats.disableLittering, count); + CheatEntrySerialise(ds, CheatType::NeverendingMarketing, gameState.cheats.neverendingMarketing, count); + CheatEntrySerialise(ds, CheatType::FreezeWeather, gameState.cheats.freezeWeather, count); + CheatEntrySerialise(ds, CheatType::DisableTrainLengthLimit, gameState.cheats.disableTrainLengthLimit, count); + CheatEntrySerialise(ds, CheatType::DisablePlantAging, gameState.cheats.disablePlantAging, count); + CheatEntrySerialise(ds, CheatType::EnableChainLiftOnAllTrack, gameState.cheats.enableChainLiftOnAllTrack, count); CheatEntrySerialise( - ds, CheatType::AllowArbitraryRideTypeChanges, gameState.Cheats.allowArbitraryRideTypeChanges, count); - CheatEntrySerialise(ds, CheatType::DisableRideValueAging, gameState.Cheats.disableRideValueAging, count); - CheatEntrySerialise(ds, CheatType::IgnoreResearchStatus, gameState.Cheats.ignoreResearchStatus, count); - CheatEntrySerialise(ds, CheatType::EnableAllDrawableTrackPieces, gameState.Cheats.enableAllDrawableTrackPieces, count); + ds, CheatType::AllowArbitraryRideTypeChanges, gameState.cheats.allowArbitraryRideTypeChanges, count); + CheatEntrySerialise(ds, CheatType::DisableRideValueAging, gameState.cheats.disableRideValueAging, count); + CheatEntrySerialise(ds, CheatType::IgnoreResearchStatus, gameState.cheats.ignoreResearchStatus, count); + CheatEntrySerialise(ds, CheatType::EnableAllDrawableTrackPieces, gameState.cheats.enableAllDrawableTrackPieces, count); CheatEntrySerialise( - ds, CheatType::AllowTrackPlaceInvalidHeights, gameState.Cheats.allowTrackPlaceInvalidHeights, count); - CheatEntrySerialise(ds, CheatType::AllowRegularPathAsQueue, gameState.Cheats.allowRegularPathAsQueue, count); - CheatEntrySerialise(ds, CheatType::AllowSpecialColourSchemes, gameState.Cheats.allowSpecialColourSchemes, count); - CheatEntrySerialise(ds, CheatType::MakeDestructible, gameState.Cheats.makeAllDestructible, count); - CheatEntrySerialise(ds, CheatType::SetStaffSpeed, gameState.Cheats.selectedStaffSpeed, count); - CheatEntrySerialise(ds, CheatType::IgnorePrice, gameState.Cheats.ignorePrice, count); - CheatEntrySerialise(ds, CheatType::SetForcedParkRating, gameState.Cheats.forcedParkRating, count); + ds, CheatType::AllowTrackPlaceInvalidHeights, gameState.cheats.allowTrackPlaceInvalidHeights, count); + CheatEntrySerialise(ds, CheatType::AllowRegularPathAsQueue, gameState.cheats.allowRegularPathAsQueue, count); + CheatEntrySerialise(ds, CheatType::AllowSpecialColourSchemes, gameState.cheats.allowSpecialColourSchemes, count); + CheatEntrySerialise(ds, CheatType::MakeDestructible, gameState.cheats.makeAllDestructible, count); + CheatEntrySerialise(ds, CheatType::SetStaffSpeed, gameState.cheats.selectedStaffSpeed, count); + CheatEntrySerialise(ds, CheatType::IgnorePrice, gameState.cheats.ignorePrice, count); + CheatEntrySerialise(ds, CheatType::SetForcedParkRating, gameState.cheats.forcedParkRating, count); // Remember current position and update count. uint64_t endOffset = stream.GetPosition(); @@ -140,91 +140,91 @@ void CheatsSerialise(DataSerialiser& ds) switch (static_cast(type)) { case CheatType::SandboxMode: - ds << gameState.Cheats.sandboxMode; + ds << gameState.cheats.sandboxMode; break; case CheatType::DisableClearanceChecks: - ds << gameState.Cheats.disableClearanceChecks; + ds << gameState.cheats.disableClearanceChecks; break; case CheatType::DisableSupportLimits: - ds << gameState.Cheats.disableSupportLimits; + ds << gameState.cheats.disableSupportLimits; break; case CheatType::ShowAllOperatingModes: - ds << gameState.Cheats.showAllOperatingModes; + ds << gameState.cheats.showAllOperatingModes; break; case CheatType::ShowVehiclesFromOtherTrackTypes: - ds << gameState.Cheats.showVehiclesFromOtherTrackTypes; + ds << gameState.cheats.showVehiclesFromOtherTrackTypes; break; case CheatType::FastLiftHill: - ds << gameState.Cheats.unlockOperatingLimits; + ds << gameState.cheats.unlockOperatingLimits; break; case CheatType::DisableBrakesFailure: - ds << gameState.Cheats.disableBrakesFailure; + ds << gameState.cheats.disableBrakesFailure; break; case CheatType::DisableAllBreakdowns: - ds << gameState.Cheats.disableAllBreakdowns; + ds << gameState.cheats.disableAllBreakdowns; break; case CheatType::BuildInPauseMode: - ds << gameState.Cheats.buildInPauseMode; + ds << gameState.cheats.buildInPauseMode; break; case CheatType::IgnoreRideIntensity: - ds << gameState.Cheats.ignoreRideIntensity; + ds << gameState.cheats.ignoreRideIntensity; break; case CheatType::IgnorePrice: - ds << gameState.Cheats.ignorePrice; + ds << gameState.cheats.ignorePrice; break; case CheatType::DisableVandalism: - ds << gameState.Cheats.disableVandalism; + ds << gameState.cheats.disableVandalism; break; case CheatType::DisableLittering: - ds << gameState.Cheats.disableLittering; + ds << gameState.cheats.disableLittering; break; case CheatType::NeverendingMarketing: - ds << gameState.Cheats.neverendingMarketing; + ds << gameState.cheats.neverendingMarketing; break; case CheatType::FreezeWeather: - ds << gameState.Cheats.freezeWeather; + ds << gameState.cheats.freezeWeather; break; case CheatType::DisableTrainLengthLimit: - ds << gameState.Cheats.disableTrainLengthLimit; + ds << gameState.cheats.disableTrainLengthLimit; break; case CheatType::DisablePlantAging: - ds << gameState.Cheats.disablePlantAging; + ds << gameState.cheats.disablePlantAging; break; case CheatType::EnableChainLiftOnAllTrack: - ds << gameState.Cheats.enableChainLiftOnAllTrack; + ds << gameState.cheats.enableChainLiftOnAllTrack; break; case CheatType::AllowArbitraryRideTypeChanges: - ds << gameState.Cheats.allowArbitraryRideTypeChanges; + ds << gameState.cheats.allowArbitraryRideTypeChanges; break; case CheatType::DisableRideValueAging: - ds << gameState.Cheats.disableRideValueAging; + ds << gameState.cheats.disableRideValueAging; break; case CheatType::IgnoreResearchStatus: - ds << gameState.Cheats.ignoreResearchStatus; + ds << gameState.cheats.ignoreResearchStatus; break; case CheatType::EnableAllDrawableTrackPieces: - ds << gameState.Cheats.enableAllDrawableTrackPieces; + ds << gameState.cheats.enableAllDrawableTrackPieces; break; case CheatType::AllowTrackPlaceInvalidHeights: - ds << gameState.Cheats.allowTrackPlaceInvalidHeights; + ds << gameState.cheats.allowTrackPlaceInvalidHeights; break; case CheatType::NoCapOnQueueLengthDummy: ds << dummyBool; break; case CheatType::AllowRegularPathAsQueue: - ds << gameState.Cheats.allowRegularPathAsQueue; + ds << gameState.cheats.allowRegularPathAsQueue; break; case CheatType::AllowSpecialColourSchemes: - ds << gameState.Cheats.allowSpecialColourSchemes; + ds << gameState.cheats.allowSpecialColourSchemes; break; case CheatType::MakeDestructible: - ds << gameState.Cheats.makeAllDestructible; + ds << gameState.cheats.makeAllDestructible; break; case CheatType::SetStaffSpeed: - ds << gameState.Cheats.selectedStaffSpeed; + ds << gameState.cheats.selectedStaffSpeed; break; case CheatType::SetForcedParkRating: - ds << gameState.Cheats.forcedParkRating; + ds << gameState.cheats.forcedParkRating; default: break; } diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 36041ede4d..4a7758ba7f 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -809,7 +809,7 @@ namespace OpenRCT2 SetProgress(90, 100, STR_STRING_M_PERCENT); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = ::GetGameState(); + auto& gameState = ::getGameState(); parkImporter->Import(gameState); SetProgress(100, 100, STR_STRING_M_PERCENT); diff --git a/src/openrct2/Date.cpp b/src/openrct2/Date.cpp index 535011de00..1375677a48 100644 --- a/src/openrct2/Date.cpp +++ b/src/openrct2/Date.cpp @@ -108,15 +108,15 @@ int32_t Date::GetDaysInMonth(int32_t month) void OpenRCT2::DateUpdate(GameState_t& gameState) { - int32_t monthTicks = gameState.Date.monthTicks + kMonthTicksIncrement; + int32_t monthTicks = gameState.date.monthTicks + kMonthTicksIncrement; if (monthTicks > kMaskMonthTicks) { - gameState.Date.monthTicks = 0; - gameState.Date.monthsElapsed++; + gameState.date.monthTicks = 0; + gameState.date.monthsElapsed++; } else { - gameState.Date.monthTicks = static_cast(monthTicks); + gameState.date.monthTicks = static_cast(monthTicks); } } @@ -147,7 +147,7 @@ void DateUpdateRealTimeOfDay() Date& GetDate() { - return GetGameState().Date; + return getGameState().date; } /** @@ -156,7 +156,7 @@ Date& GetDate() */ void ResetDate() { - auto& gameState = GetGameState(); - gameState.Date = {}; + auto& gameState = getGameState(); + gameState.date = {}; gCurrentRealTimeTicks = 0; } diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 5c75922e72..a2704d9a6c 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -102,20 +102,20 @@ namespace OpenRCT2::Editor auto* context = GetContext(); context->SetActiveScene(context->GetGameScene()); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); Audio::StopAll(); ObjectListLoad(); gameStateInitAll(gameState, kDefaultMapSize); gLegacyScene = LegacyScene::scenarioEditor; - gameState.EditorStep = EditorStep::ObjectSelection; - gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; - gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; + gameState.editorStep = EditorStep::ObjectSelection; + gameState.park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + gameState.scenarioCategory = SCENARIO_CATEGORY_OTHER; ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); LoadPalette(); gScreenAge = 0; - gameState.ScenarioName = LanguageGetString(STR_MY_NEW_SCENARIO); + gameState.scenarioName = LanguageGetString(STR_MY_NEW_SCENARIO); } /** @@ -144,12 +144,12 @@ namespace OpenRCT2::Editor return; } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); ScenarioReset(gameState); gLegacyScene = LegacyScene::scenarioEditor; - gameState.EditorStep = EditorStep::ObjectiveSelection; - gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; + gameState.editorStep = EditorStep::ObjectiveSelection; + gameState.scenarioCategory = SCENARIO_CATEGORY_OTHER; ViewportInitAll(); OpenEditorWindows(); FinaliseMainView(); @@ -172,9 +172,9 @@ namespace OpenRCT2::Editor ObjectManagerUnloadAllObjects(); ObjectListLoad(); - gameStateInitAll(GetGameState(), kDefaultMapSize); + gameStateInitAll(getGameState(), kDefaultMapSize); SetAllLandOwned(); - GetGameState().EditorStep = EditorStep::ObjectSelection; + getGameState().editorStep = EditorStep::ObjectSelection; ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); @@ -197,9 +197,9 @@ namespace OpenRCT2::Editor ObjectManagerUnloadAllObjects(); ObjectListLoad(); - gameStateInitAll(GetGameState(), kDefaultMapSize); + gameStateInitAll(getGameState(), kDefaultMapSize); SetAllLandOwned(); - GetGameState().EditorStep = EditorStep::ObjectSelection; + getGameState().editorStep = EditorStep::ObjectSelection; ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); @@ -212,9 +212,9 @@ namespace OpenRCT2::Editor */ static void SetAllLandOwned() { - auto& gameState = GetGameState(); - MapRange range = { 2 * kCoordsXYStep, 2 * kCoordsXYStep, (gameState.MapSize.x - 3) * kCoordsXYStep, - (gameState.MapSize.y - 3) * kCoordsXYStep }; + auto& gameState = getGameState(); + MapRange range = { 2 * kCoordsXYStep, 2 * kCoordsXYStep, (gameState.mapSize.x - 3) * kCoordsXYStep, + (gameState.mapSize.y - 3) * kCoordsXYStep }; auto landSetRightsAction = LandSetRightsAction(range, LandSetRightSetting::SetForSale); landSetRightsAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND); GameActions::Execute(&landSetRightsAction); @@ -232,7 +232,7 @@ namespace OpenRCT2::Editor auto* context = GetContext(); context->SetActiveScene(context->GetGameScene()); - GetGameState().EditorStep = EditorStep::LandscapeEditor; + getGameState().editorStep = EditorStep::LandscapeEditor; gScreenAge = 0; gLegacyScene = LegacyScene::scenarioEditor; ViewportInitAll(); @@ -274,39 +274,39 @@ namespace OpenRCT2::Editor staff->SetName({}); } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); ResetAllEntities(); UpdateConsolidatedPatrolAreas(); - gameState.NumGuestsInPark = 0; - gameState.NumGuestsHeadingForPark = 0; - gameState.NumGuestsInParkLastWeek = 0; - gameState.GuestChangeModifier = 0; + gameState.numGuestsInPark = 0; + gameState.numGuestsHeadingForPark = 0; + gameState.numGuestsInParkLastWeek = 0; + gameState.guestChangeModifier = 0; if (fromSave) { - gameState.Park.Flags |= PARK_FLAGS_NO_MONEY; + gameState.park.Flags |= PARK_FLAGS_NO_MONEY; - if (gameState.Park.EntranceFee == 0) + if (gameState.park.EntranceFee == 0) { - gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; } else { - gameState.Park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY; } - gameState.Park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED; + gameState.park.Flags &= ~PARK_FLAGS_SPRITES_INITIALISED; - gameState.GuestInitialCash = std::clamp(gameState.GuestInitialCash, 10.00_GBP, kMaxEntranceFee); + gameState.guestInitialCash = std::clamp(gameState.guestInitialCash, 10.00_GBP, kMaxEntranceFee); - gameState.InitialCash = std::min(gameState.InitialCash, 100000); + gameState.initialCash = std::min(gameState.initialCash, 100000); FinanceResetCashToInitial(); - gameState.BankLoan = std::clamp(gameState.BankLoan, 0.00_GBP, 5000000.00_GBP); + gameState.bankLoan = std::clamp(gameState.bankLoan, 0.00_GBP, 5000000.00_GBP); - gameState.MaxBankLoan = std::clamp(gameState.MaxBankLoan, 0.00_GBP, 5000000.00_GBP); + gameState.maxBankLoan = std::clamp(gameState.maxBankLoan, 0.00_GBP, 5000000.00_GBP); - gameState.BankLoanInterestRate = std::clamp(gameState.BankLoanInterestRate, 5, MaxBankLoanInterestRate); + gameState.bankLoanInterestRate = std::clamp(gameState.bankLoanInterestRate, 5, MaxBankLoanInterestRate); } ClimateReset(); @@ -327,7 +327,7 @@ namespace OpenRCT2::Editor auto* windowMgr = Ui::GetWindowManager(); - switch (GetGameState().EditorStep) + switch (getGameState().editorStep) { case EditorStep::ObjectSelection: if (windowMgr->FindByClass(WindowClass::EditorObjectSelection) != nullptr) @@ -383,8 +383,8 @@ namespace OpenRCT2::Editor static void FinaliseMainView() { auto windowManager = Ui::GetWindowManager(); - auto& gameState = GetGameState(); - windowManager->SetMainView(gameState.SavedView, gameState.SavedViewZoom, gameState.SavedViewRotation); + auto& gameState = getGameState(); + windowManager->SetMainView(gameState.savedView, gameState.savedViewZoom, gameState.savedViewRotation); ResetAllSpriteQuadrantPlacements(); @@ -474,19 +474,19 @@ namespace OpenRCT2::Editor */ ResultWithMessage CheckPark() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); int32_t parkSize = Park::UpdateSize(gameState); if (parkSize == 0) { return { false, STR_PARK_MUST_OWN_SOME_LAND }; } - if (gameState.Park.Entrances.empty()) + if (gameState.park.Entrances.empty()) { return { false, STR_NO_PARK_ENTRANCES }; } - for (const auto& parkEntrance : gameState.Park.Entrances) + for (const auto& parkEntrance : gameState.park.Entrances) { int32_t direction = DirectionReverse(parkEntrance.direction); @@ -504,7 +504,7 @@ namespace OpenRCT2::Editor } } - if (gameState.PeepSpawns.empty()) + if (gameState.peepSpawns.empty()) { return { false, STR_PEEP_SPAWNS_NOT_SET }; } diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 7c2f50da39..7ef7dd8b5b 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -510,20 +510,20 @@ void ResetSelectedObjectCountAndSize() void FinishObjectSelection() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (gLegacyScene == LegacyScene::trackDesigner) { SetEveryRideTypeInvented(); SetEveryRideEntryInvented(); auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - gameState.LastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); - if (gameState.LastEntranceStyle == kObjectEntryIndexNull) + gameState.lastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); + if (gameState.lastEntranceStyle == kObjectEntryIndexNull) { - gameState.LastEntranceStyle = 0; + gameState.lastEntranceStyle = 0; } - gameState.EditorStep = EditorStep::RollercoasterDesigner; + gameState.editorStep = EditorStep::RollercoasterDesigner; GfxInvalidateScreen(); } else @@ -533,7 +533,7 @@ void FinishObjectSelection() auto intent = Intent(INTENT_ACTION_SET_DEFAULT_SCENERY_CONFIG); ContextBroadcastIntent(&intent); - gameState.EditorStep = EditorStep::LandscapeEditor; + gameState.editorStep = EditorStep::LandscapeEditor; GfxInvalidateScreen(); } } diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index d93c154797..537e9ea3bc 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -183,7 +183,7 @@ void RCT2StringToUTF8Self(char* buffer, size_t length) static void FixGuestsHeadingToParkCount() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); uint32_t guestsHeadingToPark = 0; @@ -195,13 +195,13 @@ static void FixGuestsHeadingToParkCount() } } - if (gameState.NumGuestsHeadingForPark != guestsHeadingToPark) + if (gameState.numGuestsHeadingForPark != guestsHeadingToPark) { LOG_WARNING( - "Corrected bad amount of guests heading to park: %u -> %u", gameState.NumGuestsHeadingForPark, guestsHeadingToPark); + "Corrected bad amount of guests heading to park: %u -> %u", gameState.numGuestsHeadingForPark, guestsHeadingToPark); } - gameState.NumGuestsHeadingForPark = guestsHeadingToPark; + gameState.numGuestsHeadingForPark = guestsHeadingToPark; } static void FixGuestCount() @@ -217,13 +217,13 @@ static void FixGuestCount() } } - auto& gameState = GetGameState(); - if (gameState.NumGuestsInPark != guestCount) + auto& gameState = getGameState(); + if (gameState.numGuestsInPark != guestCount) { - LOG_WARNING("Corrected bad amount of guests in park: %u -> %u", gameState.NumGuestsInPark, guestCount); + LOG_WARNING("Corrected bad amount of guests in park: %u -> %u", gameState.numGuestsInPark, guestCount); } - gameState.NumGuestsInPark = guestCount; + gameState.numGuestsInPark = guestCount; } static void FixPeepsWithInvalidRideReference() @@ -303,8 +303,8 @@ static void FixInvalidSurfaces() // Fix the invisible border tiles. // At this point, we can be sure that surfaceElement is not NULL. - auto& gameState = GetGameState(); - if (x == 0 || x == gameState.MapSize.x - 1 || y == 0 || y == gameState.MapSize.y - 1) + auto& gameState = getGameState(); + if (x == 0 || x == gameState.mapSize.x - 1 || y == 0 || y == gameState.mapSize.y - 1) { surfaceElement->SetBaseZ(kMinimumLandZ); surfaceElement->SetClearanceZ(kMinimumLandZ); @@ -367,8 +367,8 @@ void GameLoadInit() } auto windowManager = context->GetUiContext()->GetWindowManager(); - auto& gameState = GetGameState(); - windowManager->SetMainView(gameState.SavedView, gameState.SavedViewZoom, gameState.SavedViewRotation); + auto& gameState = getGameState(); + windowManager->SetMainView(gameState.savedView, gameState.savedViewZoom, gameState.savedViewRotation); if (NetworkGetMode() != NETWORK_MODE_CLIENT) { @@ -484,7 +484,7 @@ void SaveGameWithName(u8string_view name) { LOG_VERBOSE("Saving to %s", u8string(name).c_str()); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (ScenarioSave(gameState, name, Config::Get().general.SavePluginData ? 1 : 0)) { LOG_VERBOSE("Saved to %s", u8string(name).c_str()); @@ -608,7 +608,7 @@ void GameAutosave() File::Copy(path, backupPath, true); } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (!ScenarioSave(gameState, path, saveFlags)) Console::Error::WriteLine("Could not autosave the scenario. Is the save folder writeable?"); diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index d5fda0177c..f1e8799f7e 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -36,12 +36,12 @@ namespace OpenRCT2 { static auto _gameState = std::make_unique(); - GameState_t& GetGameState() + GameState_t& getGameState() { return *_gameState; } - void SwapGameState(std::unique_ptr& otherState) + void swapGameState(std::unique_ptr& otherState) { _gameState.swap(otherState); } @@ -54,7 +54,7 @@ namespace OpenRCT2 PROFILED_FUNCTION(); gInMapInitCode = true; - gameState.CurrentTicks = 0; + gameState.currentTicks = 0; MapInit(mapSize); Park::Initialise(gameState); @@ -69,7 +69,7 @@ namespace OpenRCT2 gInMapInitCode = false; - gameState.NextGuestNumber = 1; + gameState.nextGuestNumber = 1; ContextInit(); @@ -123,7 +123,7 @@ namespace OpenRCT2 if (NetworkGetMode() == NETWORK_MODE_CLIENT && NetworkGetStatus() == NETWORK_STATUS_CONNECTED && NetworkGetAuthstatus() == NetworkAuth::Ok) { - numUpdates = std::clamp(NetworkGetServerTick() - GetGameState().CurrentTicks, 0, 10); + numUpdates = std::clamp(NetworkGetServerTick() - getGameState().currentTicks, 0, 10); } else { @@ -237,7 +237,7 @@ namespace OpenRCT2 auto& snapshot = snapshots->CreateSnapshot(); snapshots->Capture(snapshot); - snapshots->LinkSnapshot(snapshot, GetGameState().CurrentTicks, ScenarioRandState().s0); + snapshots->LinkSnapshot(snapshot, getGameState().currentTicks, ScenarioRandState().s0); } void gameStateUpdateLogic() @@ -254,7 +254,7 @@ namespace OpenRCT2 NetworkUpdate(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (NetworkGetMode() == NETWORK_MODE_SERVER) { @@ -269,7 +269,7 @@ namespace OpenRCT2 else if (NetworkGetMode() == NETWORK_MODE_CLIENT) { // Don't run past the server, this condition can happen during map changes. - if (NetworkGetServerTick() == gameState.CurrentTicks) + if (NetworkGetServerTick() == gameState.currentTicks) { gInUpdateCode = false; return; @@ -294,7 +294,7 @@ namespace OpenRCT2 #ifdef ENABLE_SCRIPTING // Stash the current day number before updating the date so that we // know if the day number changes on this tick. - auto day = gameState.Date.GetDay(); + auto day = gameState.date.GetDay(); #endif DateUpdate(gameState); @@ -317,7 +317,7 @@ namespace OpenRCT2 if (!isInEditorMode()) { - Park::Update(gameState, gameState.Date); + Park::Update(gameState, gameState.date); } ResearchUpdate(); @@ -347,13 +347,13 @@ namespace OpenRCT2 NetworkProcessPending(); NetworkFlush(); - gameState.CurrentTicks++; + gameState.currentTicks++; #ifdef ENABLE_SCRIPTING auto& hookEngine = GetContext()->GetScriptEngine().GetHookEngine(); hookEngine.Call(HOOK_TYPE::INTERVAL_TICK, true); - if (day != gameState.Date.GetDay()) + if (day != gameState.date.GetDay()) { hookEngine.Call(HOOK_TYPE::INTERVAL_DAY, true); } diff --git a/src/openrct2/GameState.h b/src/openrct2/GameState.h index 17e008a2ac..723b1c150a 100644 --- a/src/openrct2/GameState.h +++ b/src/openrct2/GameState.h @@ -37,103 +37,103 @@ namespace OpenRCT2 { struct GameState_t { - ::OpenRCT2::Park::ParkData Park{}; - std::string PluginStorage; - uint32_t CurrentTicks{}; - ::OpenRCT2::Date Date; - money64 CompanyValue; + Park::ParkData park{}; + std::string pluginStorage; + uint32_t currentTicks{}; + Date date; + money64 companyValue; // The total profit for the entire scenario that precedes the current financial table. - money64 HistoricalProfit; - money64 ConstructionRightsPrice; - money64 CurrentExpenditure; - money64 CurrentProfit; - uint32_t GuestsInParkHistory[kGuestsInParkHistorySize]; - WeatherState WeatherCurrent; - WeatherState WeatherNext; - uint16_t WeatherUpdateTimer; - money64 Cash; - money64 CashHistory[kFinanceHistorySize]; - money64 InitialCash; - money64 GuestInitialCash; - uint8_t GuestInitialHappiness; - uint8_t GuestInitialHunger; - uint8_t GuestInitialThirst; - uint8_t GuestChangeModifier; - uint32_t NextGuestNumber; - uint32_t NumGuestsInPark; - uint32_t NumGuestsHeadingForPark; - uint32_t NumGuestsInParkLastWeek; - money64 WeeklyProfitAverageDividend; - uint64_t TotalAdmissions; - money64 TotalIncomeFromAdmissions; - money64 TotalRideValueForMoney; - uint16_t WeeklyProfitAverageDivisor; - money64 WeeklyProfitHistory[kFinanceHistorySize]; - Objective ScenarioObjective; - uint16_t ScenarioParkRatingWarningDays; - money64 ScenarioCompletedCompanyValue; - money64 ScenarioCompanyValueRecord; - money64 BankLoan; - uint8_t BankLoanInterestRate; - money64 MaxBankLoan; - money64 ExpenditureTable[kExpenditureTableMonthCount][EnumValue(ExpenditureType::Count)]; - random_engine_t ScenarioRand; - TileCoordsXY MapSize; - money64 LandPrice; + money64 historicalProfit; + money64 constructionRightsPrice; + money64 currentExpenditure; + money64 currentProfit; + uint32_t guestsInParkHistory[kGuestsInParkHistorySize]; + WeatherState weatherCurrent; + WeatherState weatherNext; + uint16_t weatherUpdateTimer; + money64 cash; + money64 cashHistory[kFinanceHistorySize]; + money64 initialCash; + money64 guestInitialCash; + uint8_t guestInitialHappiness; + uint8_t guestInitialHunger; + uint8_t guestInitialThirst; + uint8_t guestChangeModifier; + uint32_t nextGuestNumber; + uint32_t numGuestsInPark; + uint32_t numGuestsHeadingForPark; + uint32_t numGuestsInParkLastWeek; + money64 weeklyProfitAverageDividend; + uint64_t totalAdmissions; + money64 totalIncomeFromAdmissions; + money64 totalRideValueForMoney; + uint16_t weeklyProfitAverageDivisor; + money64 weeklyProfitHistory[kFinanceHistorySize]; + Objective scenarioObjective; + uint16_t scenarioParkRatingWarningDays; + money64 scenarioCompletedCompanyValue; + money64 scenarioCompanyValueRecord; + money64 bankLoan; + uint8_t bankLoanInterestRate; + money64 maxBankLoan; + money64 expenditureTable[kExpenditureTableMonthCount][EnumValue(ExpenditureType::Count)]; + random_engine_t scenarioRand; + TileCoordsXY mapSize; + money64 landPrice; - ::EditorStep EditorStep; + EditorStep editorStep; - SCENARIO_CATEGORY ScenarioCategory; - std::string ScenarioName; - std::string ScenarioDetails; - std::string ScenarioCompletedBy; - std::string ScenarioFileName; + SCENARIO_CATEGORY scenarioCategory; + std::string scenarioName; + std::string scenarioDetails; + std::string scenarioCompletedBy; + std::string scenarioFileName; - std::vector Banners; - Entity_t Entities[kMaxEntities]{}; + std::vector banners; + Entity_t entities[kMaxEntities]{}; // Ride storage for all the rides in the park, rides with RideId::Null are considered free. - std::array Rides{}; - size_t RidesEndOfUsedRange{}; - ::RideRatingUpdateStates RideRatingUpdateStates; - std::vector TileElements; + std::array rides{}; + size_t ridesEndOfUsedRange{}; + RideRatingUpdateStates rideRatingUpdateStates; + std::vector tileElements; - std::vector RestrictedScenery; + std::vector restrictedScenery; - std::vector PeepSpawns; - uint8_t PeepWarningThrottle[16]; + std::vector peepSpawns; + uint8_t peepWarningThrottle[16]; - News::ItemQueues NewsItems; + News::ItemQueues newsItems; - uint16_t GrassSceneryTileLoopPosition; - CoordsXY WidePathTileLoopPosition; + uint16_t grassSceneryTileLoopPosition; + CoordsXY widePathTileLoopPosition; - colour_t StaffHandymanColour; - colour_t StaffMechanicColour; - colour_t StaffSecurityColour; - uint64_t SamePriceThroughoutPark{}; + colour_t staffHandymanColour; + colour_t staffMechanicColour; + colour_t staffSecurityColour; + uint64_t samePriceThroughoutPark{}; - uint8_t ResearchFundingLevel; - uint8_t ResearchPriorities; - uint16_t ResearchProgress; - uint8_t ResearchProgressStage; - uint8_t ResearchExpectedMonth; - uint8_t ResearchExpectedDay; - std::optional ResearchLastItem; - std::optional ResearchNextItem; + uint8_t researchFundingLevel; + uint8_t researchPriorities; + uint16_t researchProgress; + uint8_t researchProgressStage; + uint8_t researchExpectedMonth; + uint8_t researchExpectedDay; + std::optional researchLastItem; + std::optional researchNextItem; - std::vector ResearchItemsUninvented; - std::vector ResearchItemsInvented; - uint8_t ResearchUncompletedCategories; + std::vector researchItemsUninvented; + std::vector researchItemsInvented; + uint8_t researchUncompletedCategories; - ScreenCoordsXY SavedView; - uint8_t SavedViewRotation; - ZoomLevel SavedViewZoom; + ScreenCoordsXY savedView; + uint8_t savedViewRotation; + ZoomLevel savedViewZoom; - ObjectEntryIndex LastEntranceStyle; + ObjectEntryIndex lastEntranceStyle; - std::vector CurrentAwards; + std::vector currentAwards; - std::vector MarketingCampaigns; + std::vector marketingCampaigns; /** * Probability out of 65535, of gaining a new guest per game tick. @@ -141,17 +141,17 @@ namespace OpenRCT2 * With a full park rating, non-overpriced entrance fee, less guests than the suggested maximum and four positive * awards, approximately 1 guest per second can be generated (+60 guests in one minute). */ - int32_t GuestGenerationProbability; + int32_t guestGenerationProbability; /** * In a difficult guest generation scenario, no guests will be generated if over this value. */ - uint32_t SuggestedGuestMaximum; + uint32_t suggestedGuestMaximum; - CheatsState Cheats; + CheatsState cheats; }; - GameState_t& GetGameState(); - void SwapGameState(std::unique_ptr& otherState); + GameState_t& getGameState(); + void swapGameState(std::unique_ptr& otherState); void gameStateInitAll(GameState_t& gameState, const TileCoordsXY& mapSize); void gameStateTick(); diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index cabd433c30..ea184f1d61 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -161,7 +161,7 @@ namespace OpenRCT2 if (_mode == ReplayMode::NONE) return; - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if ((_mode == ReplayMode::RECORDING || _mode == ReplayMode::NORMALISATION) && currentTicks == _nextChecksumTick) { @@ -221,7 +221,7 @@ namespace OpenRCT2 auto& snapshot = snapshots->CreateSnapshot(); snapshots->Capture(snapshot); - snapshots->LinkSnapshot(snapshot, GetGameState().CurrentTicks, ScenarioRandState().s0); + snapshots->LinkSnapshot(snapshot, getGameState().currentTicks, ScenarioRandState().s0); DataSerialiser snapShotDs(true, snapshotStream); snapshots->SerialiseSnapshot(snapshot, snapShotDs); } @@ -237,8 +237,8 @@ namespace OpenRCT2 if (_mode != ReplayMode::NONE && _mode != ReplayMode::NORMALISATION) return false; - auto& gameState = GetGameState(); - const auto currentTicks = gameState.CurrentTicks; + auto& gameState = getGameState(); + const auto currentTicks = gameState.currentTicks; auto replayData = std::make_unique(); replayData->magic = kReplayMagic; @@ -293,7 +293,7 @@ namespace OpenRCT2 return true; } - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; _currentRecording->tickEnd = currentTicks; @@ -378,7 +378,7 @@ namespace OpenRCT2 info.Version = data->version; info.TimeRecorded = data->timeRecorded; if (_mode == ReplayMode::RECORDING) - info.Ticks = GetGameState().CurrentTicks - data->tickStart; + info.Ticks = getGameState().currentTicks - data->tickStart; else if (_mode == ReplayMode::PLAYING) info.Ticks = data->tickEnd - data->tickStart; info.NumCommands = static_cast(data->commands.size()); @@ -396,7 +396,7 @@ namespace OpenRCT2 GameStateSnapshot_t& replaySnapshot = snapshots->CreateSnapshot(); snapshots->SerialiseSnapshot(replaySnapshot, ds); - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; auto& localSnapshot = snapshots->CreateSnapshot(); snapshots->Capture(localSnapshot); @@ -447,7 +447,7 @@ namespace OpenRCT2 return false; } - GetGameState().CurrentTicks = replayData->tickStart; + getGameState().currentTicks = replayData->tickStart; LoadAndCompareSnapshot(replayData->gameStateSnapshots); @@ -509,7 +509,7 @@ namespace OpenRCT2 return false; } - _nextReplayTick = GetGameState().CurrentTicks + 1; + _nextReplayTick = getGameState().currentTicks + 1; return true; } @@ -541,7 +541,7 @@ namespace OpenRCT2 objManager.LoadObjects(loadResult.RequiredObjects); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); importer->Import(gameState); EntityTweener::Get().Reset(); @@ -669,10 +669,10 @@ namespace OpenRCT2 bool SerialiseParkParameters(DataSerialiser& serialiser) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - serialiser << gameState.GuestGenerationProbability; - serialiser << gameState.SuggestedGuestMaximum; + serialiser << gameState.guestGenerationProbability; + serialiser << gameState.suggestedGuestMaximum; serialiser << Config::Get().general.ShowRealNamesOfGuests; // To make this a little bit less volatile against updates @@ -806,7 +806,7 @@ namespace OpenRCT2 if (checksumIndex >= _currentReplay->checksums.size()) return; - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; const auto& savedChecksum = _currentReplay->checksums[checksumIndex]; if (_currentReplay->checksums[checksumIndex].first == currentTicks) @@ -840,7 +840,7 @@ namespace OpenRCT2 { auto& replayQueue = _currentReplay->commands; - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; while (replayQueue.begin() != replayQueue.end()) { diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index db6568c27f..6077ca3386 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -105,59 +105,59 @@ GameActions::Result CheatSetAction::Query() const GameActions::Result CheatSetAction::Execute() const { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto* windowMgr = Ui::GetWindowManager(); switch (static_cast(_cheatType.id)) { case CheatType::SandboxMode: - gameState.Cheats.sandboxMode = _param1 != 0; + gameState.cheats.sandboxMode = _param1 != 0; windowMgr->InvalidateByClass(WindowClass::Map); windowMgr->InvalidateByClass(WindowClass::Footpath); break; case CheatType::DisableClearanceChecks: - gameState.Cheats.disableClearanceChecks = _param1 != 0; + gameState.cheats.disableClearanceChecks = _param1 != 0; // Required to update the clearance checks overlay on the Cheats button. windowMgr->InvalidateByClass(WindowClass::TopToolbar); break; case CheatType::DisableSupportLimits: - gameState.Cheats.disableSupportLimits = _param1 != 0; + gameState.cheats.disableSupportLimits = _param1 != 0; break; case CheatType::ShowAllOperatingModes: - gameState.Cheats.showAllOperatingModes = _param1 != 0; + gameState.cheats.showAllOperatingModes = _param1 != 0; break; case CheatType::ShowVehiclesFromOtherTrackTypes: - gameState.Cheats.showVehiclesFromOtherTrackTypes = _param1 != 0; + gameState.cheats.showVehiclesFromOtherTrackTypes = _param1 != 0; break; case CheatType::FastLiftHill: - gameState.Cheats.unlockOperatingLimits = _param1 != 0; + gameState.cheats.unlockOperatingLimits = _param1 != 0; break; case CheatType::DisableBrakesFailure: - gameState.Cheats.disableBrakesFailure = _param1 != 0; + gameState.cheats.disableBrakesFailure = _param1 != 0; break; case CheatType::DisableAllBreakdowns: - gameState.Cheats.disableAllBreakdowns = _param1 != 0; + gameState.cheats.disableAllBreakdowns = _param1 != 0; break; case CheatType::DisableTrainLengthLimit: - gameState.Cheats.disableTrainLengthLimit = _param1 != 0; + gameState.cheats.disableTrainLengthLimit = _param1 != 0; break; case CheatType::EnableChainLiftOnAllTrack: - gameState.Cheats.enableChainLiftOnAllTrack = _param1 != 0; + gameState.cheats.enableChainLiftOnAllTrack = _param1 != 0; break; case CheatType::BuildInPauseMode: - gameState.Cheats.buildInPauseMode = _param1 != 0; + gameState.cheats.buildInPauseMode = _param1 != 0; break; case CheatType::IgnoreRideIntensity: - gameState.Cheats.ignoreRideIntensity = _param1 != 0; + gameState.cheats.ignoreRideIntensity = _param1 != 0; break; case CheatType::IgnorePrice: - gameState.Cheats.ignorePrice = _param1 != 0; + gameState.cheats.ignorePrice = _param1 != 0; break; case CheatType::DisableVandalism: - gameState.Cheats.disableVandalism = _param1 != 0; + gameState.cheats.disableVandalism = _param1 != 0; break; case CheatType::DisableLittering: - gameState.Cheats.disableLittering = _param1 != 0; + gameState.cheats.disableLittering = _param1 != 0; break; case CheatType::NoMoney: SetScenarioNoMoney(_param1 != 0); @@ -196,7 +196,7 @@ GameActions::Result CheatSetAction::Execute() const RemoveLitter(); break; case CheatType::DisablePlantAging: - gameState.Cheats.disablePlantAging = _param1 != 0; + gameState.cheats.disablePlantAging = _param1 != 0; break; case CheatType::SetStaffSpeed: SetStaffSpeed(_param1); @@ -205,7 +205,7 @@ GameActions::Result CheatSetAction::Execute() const RenewRides(); break; case CheatType::MakeDestructible: - gameState.Cheats.makeAllDestructible = _param1 != 0; + gameState.cheats.makeAllDestructible = _param1 != 0; windowMgr->InvalidateByClass(WindowClass::Ride); break; case CheatType::FixRides: @@ -225,35 +225,35 @@ GameActions::Result CheatSetAction::Execute() const ClimateForceWeather(WeatherType{ static_cast(_param1) }); break; case CheatType::FreezeWeather: - gameState.Cheats.freezeWeather = _param1 != 0; + gameState.cheats.freezeWeather = _param1 != 0; break; case CheatType::NeverendingMarketing: - gameState.Cheats.neverendingMarketing = _param1 != 0; + gameState.cheats.neverendingMarketing = _param1 != 0; break; case CheatType::OpenClosePark: - ParkSetOpen(!gameState.Park.IsOpen()); + ParkSetOpen(!gameState.park.IsOpen()); break; case CheatType::HaveFun: - gameState.ScenarioObjective.Type = OBJECTIVE_HAVE_FUN; + gameState.scenarioObjective.Type = OBJECTIVE_HAVE_FUN; break; case CheatType::SetForcedParkRating: Park::SetForcedRating(_param1); break; case CheatType::AllowArbitraryRideTypeChanges: - gameState.Cheats.allowArbitraryRideTypeChanges = _param1 != 0; + gameState.cheats.allowArbitraryRideTypeChanges = _param1 != 0; windowMgr->InvalidateByClass(WindowClass::Ride); break; case CheatType::OwnAllLand: OwnAllLand(); break; case CheatType::DisableRideValueAging: - gameState.Cheats.disableRideValueAging = _param1 != 0; + gameState.cheats.disableRideValueAging = _param1 != 0; break; case CheatType::IgnoreResearchStatus: - gameState.Cheats.ignoreResearchStatus = _param1 != 0; + gameState.cheats.ignoreResearchStatus = _param1 != 0; break; case CheatType::EnableAllDrawableTrackPieces: - gameState.Cheats.enableAllDrawableTrackPieces = _param1 != 0; + gameState.cheats.enableAllDrawableTrackPieces = _param1 != 0; break; case CheatType::CreateDucks: CreateDucks(_param1); @@ -262,13 +262,13 @@ GameActions::Result CheatSetAction::Execute() const Duck::RemoveAll(); break; case CheatType::AllowTrackPlaceInvalidHeights: - gameState.Cheats.allowTrackPlaceInvalidHeights = _param1 != 0; + gameState.cheats.allowTrackPlaceInvalidHeights = _param1 != 0; break; case CheatType::AllowRegularPathAsQueue: - gameState.Cheats.allowRegularPathAsQueue = _param1 != 0; + gameState.cheats.allowRegularPathAsQueue = _param1 != 0; break; case CheatType::AllowSpecialColourSchemes: - gameState.Cheats.allowSpecialColourSchemes = static_cast(_param1); + gameState.cheats.allowSpecialColourSchemes = static_cast(_param1); break; case CheatType::RemoveParkFences: RemoveParkFences(); @@ -437,10 +437,10 @@ ParametersRange CheatSetAction::GetParameterRange(CheatType cheatType) const void CheatSetAction::SetGrassLength(int32_t length) const { - auto& gameState = GetGameState(); - for (int32_t y = 0; y < gameState.MapSize.y; y++) + auto& gameState = getGameState(); + for (int32_t y = 0; y < gameState.mapSize.y; y++) { - for (int32_t x = 0; x < gameState.MapSize.x; x++) + for (int32_t x = 0; x < gameState.mapSize.x; x++) { auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }); if (surfaceElement == nullptr) @@ -581,14 +581,14 @@ void CheatSetAction::Set10MinuteInspection() const void CheatSetAction::SetScenarioNoMoney(bool enabled) const { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (enabled) { - gameState.Park.Flags |= PARK_FLAGS_NO_MONEY; + gameState.park.Flags |= PARK_FLAGS_NO_MONEY; } else { - gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY; + gameState.park.Flags &= ~PARK_FLAGS_NO_MONEY; } // Invalidate all windows that have anything to do with finance @@ -604,7 +604,7 @@ void CheatSetAction::SetScenarioNoMoney(bool enabled) const void CheatSetAction::SetMoney(money64 amount) const { - GetGameState().Cash = amount; + getGameState().cash = amount; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::Finances); @@ -613,8 +613,8 @@ void CheatSetAction::SetMoney(money64 amount) const void CheatSetAction::AddMoney(money64 amount) const { - auto& gameState = GetGameState(); - gameState.Cash = AddClamp(gameState.Cash, amount); + auto& gameState = getGameState(); + gameState.cash = AddClamp(gameState.cash, amount); auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::Finances); @@ -624,7 +624,7 @@ void CheatSetAction::AddMoney(money64 amount) const void CheatSetAction::ClearLoan() const { // First give money - AddMoney(GetGameState().BankLoan); + AddMoney(getGameState().bankLoan); // Then pay the loan auto gameAction = ParkSetLoanAction(0.00_GBP); @@ -809,7 +809,7 @@ void CheatSetAction::OwnAllLand() const } // Completely unown peep spawn points - for (const auto& spawn : GetGameState().PeepSpawns) + for (const auto& spawn : getGameState().peepSpawns) { auto* surfaceElement = MapGetSurfaceElementAt(spawn); if (surfaceElement != nullptr) diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp index bdd5fe661b..8aaaf06acb 100644 --- a/src/openrct2/actions/ClearAction.cpp +++ b/src/openrct2/actions/ClearAction.cpp @@ -220,11 +220,11 @@ money64 ClearAction::ClearSceneryFromTile(const CoordsXY& tilePos, bool executin void ClearAction::ResetClearLargeSceneryFlag() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // TODO: Improve efficiency of this - for (int32_t y = 0; y < gameState.MapSize.y; y++) + for (int32_t y = 0; y < gameState.mapSize.y; y++) { - for (int32_t x = 0; x < gameState.MapSize.x; x++) + for (int32_t x = 0; x < gameState.mapSize.x; x++) { auto tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y }); do @@ -242,6 +242,6 @@ void ClearAction::ResetClearLargeSceneryFlag() bool ClearAction::MapCanClearAt(const CoordsXY& location) { - return gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode + return gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode || MapIsLocationOwnedOrHasRights(location); } diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp index 31ace71a41..b7268903d3 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp @@ -60,7 +60,7 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp index 0ac204eb18..f506cfdf3c 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp @@ -52,7 +52,7 @@ GameActions::Result FootpathAdditionRemoveAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP); } - if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp index 4de720bdf3..9399fb1ddd 100644 --- a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp +++ b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp @@ -78,7 +78,7 @@ GameActions::Result FootpathLayoutPlaceAction::Query() const GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -168,7 +168,7 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertQuery(GameActions::R const auto clearanceData = canBuild.GetData(); gFootpathGroundFlags = clearanceData.GroundFlags; - if (!GetGameState().Cheats.disableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) + if (!getGameState().cheats.disableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER); diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index d2b5af2388..4d8c6a8f04 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -86,7 +86,7 @@ GameActions::Result FootpathPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP); } - if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -143,7 +143,7 @@ GameActions::Result FootpathPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - if (_direction != INVALID_DIRECTION && !GetGameState().Cheats.disableClearanceChecks) + if (_direction != INVALID_DIRECTION && !getGameState().cheats.disableClearanceChecks) { // It is possible, let's remove walls between the old and new piece of path auto zLow = _loc.z; @@ -323,7 +323,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result const auto clearanceData = canBuild.GetData(); gFootpathGroundFlags = clearanceData.GroundFlags; - if (!GetGameState().Cheats.disableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) + if (!getGameState().cheats.disableClearanceChecks && (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER)) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER); @@ -484,12 +484,12 @@ void FootpathPlaceAction::AutomaticallySetPeepSpawn() const } } - auto& gameState = GetGameState(); - if (gameState.PeepSpawns.empty()) + auto& gameState = getGameState(); + if (gameState.peepSpawns.empty()) { - gameState.PeepSpawns.emplace_back(); + gameState.peepSpawns.emplace_back(); } - PeepSpawn* peepSpawn = &gameState.PeepSpawns[0]; + PeepSpawn* peepSpawn = &gameState.peepSpawns[0]; peepSpawn->x = _loc.x + (DirectionOffsets[direction].x * 15) + 16; peepSpawn->y = _loc.y + (DirectionOffsets[direction].y * 15) + 16; peepSpawn->direction = direction; diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp index 5f28e5b376..c2eef248aa 100644 --- a/src/openrct2/actions/FootpathRemoveAction.cpp +++ b/src/openrct2/actions/FootpathRemoveAction.cpp @@ -59,7 +59,7 @@ GameActions::Result FootpathRemoveAction::Query() const GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_OFF_EDGE_OF_MAP); } - if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -104,17 +104,17 @@ GameActions::Result FootpathRemoveAction::Execute() const TileElementRemove(footpathElement); FootpathUpdateQueueChains(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Remove the spawn point (if there is one in the current tile) - gameState.PeepSpawns.erase( + gameState.peepSpawns.erase( std::remove_if( - gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), + gameState.peepSpawns.begin(), gameState.peepSpawns.end(), [this](const CoordsXYZ& spawn) { { return spawn.ToTileStart() == _loc.ToTileStart(); } }), - gameState.PeepSpawns.end()); + gameState.peepSpawns.end()); } else { diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp index c48d111153..8b456f0bfb 100644 --- a/src/openrct2/actions/GameAction.cpp +++ b/src/openrct2/actions/GameAction.cpp @@ -99,7 +99,7 @@ namespace OpenRCT2::GameActions return; } - const uint32_t currentTick = GetGameState().CurrentTicks; + const uint32_t currentTick = getGameState().currentTicks; while (_actionQueue.begin() != _actionQueue.end()) { @@ -181,7 +181,7 @@ namespace OpenRCT2::GameActions { if (gGamePaused == 0) return true; - if (GetGameState().Cheats.buildInPauseMode) + if (getGameState().cheats.buildInPauseMode) return true; if (actionFlags & GameActions::Flags::AllowWhilePaused) return true; @@ -249,7 +249,7 @@ namespace OpenRCT2::GameActions char temp[128] = {}; snprintf( - temp, sizeof(temp), "[%s] Tick: %u, GA: %s (%08X) (", GetRealm(), GetGameState().CurrentTicks, action->GetName(), + temp, sizeof(temp), "[%s] Tick: %u, GA: %s (%08X) (", GetRealm(), getGameState().currentTicks, action->GetName(), EnumValue(action->GetType())); output.Write(temp, strlen(temp)); @@ -343,7 +343,7 @@ namespace OpenRCT2::GameActions if (!(actionFlags & GameActions::Flags::ClientOnly) && !(flags & GAME_COMMAND_FLAG_NETWORKED)) { LOG_VERBOSE("[%s] GameAction::Execute %s (Queue)", GetRealm(), action->GetName()); - Enqueue(action, GetGameState().CurrentTicks); + Enqueue(action, getGameState().currentTicks); return result; } @@ -413,7 +413,7 @@ namespace OpenRCT2::GameActions } if (recordAction) { - replayManager->AddGameAction(GetGameState().CurrentTicks, action); + replayManager->AddGameAction(getGameState().currentTicks, action); } } } diff --git a/src/openrct2/actions/LandBuyRightsAction.cpp b/src/openrct2/actions/LandBuyRightsAction.cpp index fc0d282fa9..d37428106d 100644 --- a/src/openrct2/actions/LandBuyRightsAction.cpp +++ b/src/openrct2/actions/LandBuyRightsAction.cpp @@ -143,7 +143,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& surfaceElement->SetOwnership(OWNERSHIP_OWNED); Park::UpdateFencesAroundTile(loc); } - res.Cost = GetGameState().LandPrice; + res.Cost = getGameState().landPrice; return res; case LandBuyRightSetting::BuyConstructionRights: // 2 @@ -165,7 +165,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& uint16_t baseZ = surfaceElement->GetBaseZ(); MapInvalidateTile({ loc, baseZ, baseZ + 16 }); } - res.Cost = GetGameState().ConstructionRightsPrice; + res.Cost = getGameState().constructionRightsPrice; return res; default: diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp index 2ba247a944..0d519c4d3b 100644 --- a/src/openrct2/actions/LandLowerAction.cpp +++ b/src/openrct2/actions/LandLowerAction.cpp @@ -95,7 +95,7 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp index 1be7f02be3..470f83cf97 100644 --- a/src/openrct2/actions/LandRaiseAction.cpp +++ b/src/openrct2/actions/LandRaiseAction.cpp @@ -96,7 +96,7 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index 9a34f7ccf3..967031b890 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -59,8 +59,8 @@ void LandSetHeightAction::Serialise(DataSerialiser& stream) GameActions::Result LandSetHeightAction::Query() const { - auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) + auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { return GameActions::Result(GameActions::Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY, kStringIdNone); } @@ -71,7 +71,7 @@ GameActions::Result LandSetHeightAction::Query() const return GameActions::Result(GameActions::Status::Disallowed, kStringIdNone, errorMessage); } - if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode) { if (!MapIsLocationInPark(_coords)) { @@ -80,9 +80,9 @@ GameActions::Result LandSetHeightAction::Query() const } money64 sceneryRemovalCost = 0; - if (!gameState.Cheats.disableClearanceChecks) + if (!gameState.cheats.disableClearanceChecks) { - if (gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) + if (gameState.park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) { // Check for obstructing large trees TileElement* tileElement = CheckTreeObstructions(); @@ -97,7 +97,7 @@ GameActions::Result LandSetHeightAction::Query() const } // Check for ride support limits - if (!gameState.Cheats.disableSupportLimits) + if (!gameState.cheats.disableSupportLimits) { errorMessage = CheckRideSupports(); if (errorMessage != kStringIdNone) @@ -128,7 +128,7 @@ GameActions::Result LandSetHeightAction::Query() const return res; } - if (!gameState.Cheats.disableClearanceChecks) + if (!gameState.cheats.disableClearanceChecks) { uint8_t zCorner = _height; if (_style & kTileSlopeRaisedCornersMask) @@ -161,7 +161,7 @@ GameActions::Result LandSetHeightAction::Execute() const auto surfaceHeight = TileElementHeight(_coords); FootpathRemoveLitter({ _coords, surfaceHeight }); - if (!GetGameState().Cheats.disableClearanceChecks) + if (!getGameState().cheats.disableClearanceChecks) { WallRemoveAt({ _coords, _height * 8 - 16, _height * 8 + 32 }); cost += GetSmallSceneryRemovalCost(); diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index 15ec2b1dd1..b387bc3e88 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -84,7 +84,7 @@ GameActions::Result LandSetRightsAction::QueryExecute(bool isExecuting) const res.Position = centre; res.Expenditure = ExpenditureType::LandPurchase; - if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !getGameState().cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, kStringIdNone, STR_LAND_NOT_FOR_SALE); } @@ -185,7 +185,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& } } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const uint8_t currentOwnership = surfaceElement->GetOwnership(); // Are land rights or construction rights currently owned? @@ -193,36 +193,36 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& { // Buying land if (!(currentOwnership & OWNERSHIP_OWNED) && (_ownership & OWNERSHIP_OWNED)) - res.Cost = gameState.LandPrice; + res.Cost = gameState.landPrice; // Buying construction rights if (!(currentOwnership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) && (_ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)) - res.Cost = gameState.ConstructionRightsPrice; + res.Cost = gameState.constructionRightsPrice; } else { // Selling land if ((currentOwnership & OWNERSHIP_OWNED) && !(_ownership & OWNERSHIP_OWNED)) - res.Cost = -gameState.LandPrice; + res.Cost = -gameState.landPrice; // Selling construction rights if ((currentOwnership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) && !(_ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)) - res.Cost = -gameState.ConstructionRightsPrice; + res.Cost = -gameState.constructionRightsPrice; } if (isExecuting) { if (_ownership != OWNERSHIP_UNOWNED) { - gameState.PeepSpawns.erase( + gameState.peepSpawns.erase( std::remove_if( - gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), + gameState.peepSpawns.begin(), gameState.peepSpawns.end(), [x = loc.x, y = loc.y](const auto& spawn) { return floor2(spawn.x, 32) == x && floor2(spawn.y, 32) == y; }), - gameState.PeepSpawns.end()); + gameState.peepSpawns.end()); } surfaceElement->SetOwnership(_ownership); Park::UpdateFencesAroundTile(loc); diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index 2abb84636f..a098d45be3 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -74,7 +74,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const auto resultData = LargeSceneryPlaceActionResult{}; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); money64 supportsCost = 0; @@ -152,7 +152,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const const auto clearanceData = canBuild.GetData(); int32_t tempSceneryGroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND); - if (!gameState.Cheats.disableClearanceChecks) + if (!gameState.cheats.disableClearanceChecks) { if ((clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER) || (clearanceData.GroundFlags & ELEMENT_IS_UNDERGROUND)) { @@ -175,7 +175,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const } if (gLegacyScene != LegacyScene::scenarioEditor && !MapIsLocationOwned({ curTile, zLow }) - && !gameState.Cheats.sandboxMode) + && !gameState.cheats.sandboxMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -297,7 +297,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { FootpathRemoveLitter({ curTile, zLow }); - if (!GetGameState().Cheats.disableClearanceChecks) + if (!getGameState().cheats.disableClearanceChecks) { WallRemoveAt({ curTile, zLow, zHigh }); } diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.cpp b/src/openrct2/actions/LargeSceneryRemoveAction.cpp index bc3663a6fc..f6526a3c66 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.cpp +++ b/src/openrct2/actions/LargeSceneryRemoveAction.cpp @@ -88,9 +88,9 @@ GameActions::Result LargeSceneryRemoveAction::Query() const auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + currentTileRotatedOffset; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { - if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) + if (getGameState().park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) { if (sceneryEntry->HasFlag(LARGE_SCENERY_FLAG_IS_TREE)) { @@ -168,7 +168,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + rotatedCurrentTile; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z })) { diff --git a/src/openrct2/actions/LargeScenerySetColourAction.cpp b/src/openrct2/actions/LargeScenerySetColourAction.cpp index 11192bb9d4..fcb073927c 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.cpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.cpp @@ -127,7 +127,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) auto rotatedTileCoords = CoordsXYZ{ CoordsXY{ tile.offset }.Rotate(_loc.direction), tile.offset.z }; auto currentTile = CoordsXYZ{ baseTile.x, baseTile.y, baseTile.z } + rotatedTileCoords; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationOwned(currentTile)) { diff --git a/src/openrct2/actions/MapChangeSizeAction.cpp b/src/openrct2/actions/MapChangeSizeAction.cpp index ba6a95bd7c..754c2bb424 100644 --- a/src/openrct2/actions/MapChangeSizeAction.cpp +++ b/src/openrct2/actions/MapChangeSizeAction.cpp @@ -59,16 +59,16 @@ GameActions::Result MapChangeSizeAction::Query() const GameActions::Result MapChangeSizeAction::Execute() const { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Expand map - while (_targetSize.x > gameState.MapSize.x) + while (_targetSize.x > gameState.mapSize.x) { - gameState.MapSize.x++; + gameState.mapSize.x++; MapExtendBoundarySurfaceX(); } - while (_targetSize.y > gameState.MapSize.y) + while (_targetSize.y > gameState.mapSize.y) { - gameState.MapSize.y++; + gameState.mapSize.y++; MapExtendBoundarySurfaceY(); } @@ -76,9 +76,9 @@ GameActions::Result MapChangeSizeAction::Execute() const ShiftMap(_shift); // Shrink map - if (_targetSize.x < gameState.MapSize.x || _targetSize.y < gameState.MapSize.y) + if (_targetSize.x < gameState.mapSize.x || _targetSize.y < gameState.mapSize.y) { - gameState.MapSize = _targetSize; + gameState.mapSize = _targetSize; MapRemoveOutOfRangeElements(); } diff --git a/src/openrct2/actions/MazePlaceTrackAction.cpp b/src/openrct2/actions/MazePlaceTrackAction.cpp index 81d9492400..2bdbaa1274 100644 --- a/src/openrct2/actions/MazePlaceTrackAction.cpp +++ b/src/openrct2/actions/MazePlaceTrackAction.cpp @@ -64,8 +64,8 @@ GameActions::Result MazePlaceTrackAction::Query() const res.ErrorMessage = STR_OFF_EDGE_OF_MAP; return res; } - auto& gameState = GetGameState(); - if (!MapIsLocationOwned(_loc) && !gameState.Cheats.sandboxMode) + auto& gameState = getGameState(); + if (!MapIsLocationOwned(_loc) && !gameState.cheats.sandboxMode) { res.Error = GameActions::Status::NotOwned; res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK; @@ -90,7 +90,7 @@ GameActions::Result MazePlaceTrackAction::Query() const auto clearanceHeight = _loc.z + kMazeClearanceHeight; auto heightDifference = baseHeight - surfaceElement->GetBaseZ(); - if (heightDifference >= 0 && !gameState.Cheats.disableSupportLimits) + if (heightDifference >= 0 && !gameState.cheats.disableSupportLimits) { heightDifference /= kCoordsZPerTinyZ; diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp index 2e489dd743..53c6acb0fb 100644 --- a/src/openrct2/actions/MazeSetTrackAction.cpp +++ b/src/openrct2/actions/MazeSetTrackAction.cpp @@ -99,8 +99,8 @@ GameActions::Result MazeSetTrackAction::Query() const res.ErrorMessage = STR_OFF_EDGE_OF_MAP; return res; } - auto& gameState = GetGameState(); - if (!MapIsLocationOwned(_loc) && !gameState.Cheats.sandboxMode) + auto& gameState = getGameState(); + if (!MapIsLocationOwned(_loc) && !gameState.cheats.sandboxMode) { res.Error = GameActions::Status::NotOwned; res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK; @@ -125,7 +125,7 @@ GameActions::Result MazeSetTrackAction::Query() const auto clearanceHeight = _loc.z + 32; auto heightDifference = baseHeight - surfaceElement->GetBaseZ(); - if (heightDifference >= 0 && !gameState.Cheats.disableSupportLimits) + if (heightDifference >= 0 && !gameState.cheats.disableSupportLimits) { heightDifference /= kCoordsZPerTinyZ; diff --git a/src/openrct2/actions/ParkEntrancePlaceAction.cpp b/src/openrct2/actions/ParkEntrancePlaceAction.cpp index 44544a0168..090c5c7c49 100644 --- a/src/openrct2/actions/ParkEntrancePlaceAction.cpp +++ b/src/openrct2/actions/ParkEntrancePlaceAction.cpp @@ -56,7 +56,7 @@ void ParkEntrancePlaceAction::Serialise(DataSerialiser& stream) GameActions::Result ParkEntrancePlaceAction::Query() const { - if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !getGameState().cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_CANT_BUILD_THIS_HERE, kStringIdNone); } @@ -79,8 +79,8 @@ GameActions::Result ParkEntrancePlaceAction::Query() const GameActions::Status::NoFreeElements, STR_CANT_BUILD_THIS_HERE, STR_ERR_LANDSCAPE_DATA_AREA_FULL); } - const auto& gameState = GetGameState(); - if (gameState.Park.Entrances.size() >= OpenRCT2::Limits::kMaxParkEntrances) + const auto& gameState = getGameState(); + if (gameState.park.Entrances.size() >= OpenRCT2::Limits::kMaxParkEntrances) { return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES); @@ -126,7 +126,7 @@ GameActions::Result ParkEntrancePlaceAction::Execute() const uint32_t flags = GetFlags(); - GetGameState().Park.Entrances.push_back(_loc); + getGameState().park.Entrances.push_back(_loc); auto zLow = _loc.z; auto zHigh = zLow + ParkEntranceHeight; diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp index 44ad178e0b..f92edc0371 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp +++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp @@ -43,7 +43,7 @@ void ParkEntranceRemoveAction::Serialise(DataSerialiser& stream) GameActions::Result ParkEntranceRemoveAction::Query() const { - if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !getGameState().cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_CANT_REMOVE_THIS, kStringIdNone); } @@ -79,8 +79,8 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, kStringIdNone); } - auto& gameState = GetGameState(); - auto direction = (gameState.Park.Entrances[entranceIndex].direction - 1) & 3; + auto& gameState = getGameState(); + auto direction = (gameState.park.Entrances[entranceIndex].direction - 1) & 3; // Centre (sign) ParkEntranceRemoveSegment(_loc); @@ -93,7 +93,7 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const ParkEntranceRemoveSegment( { _loc.x - CoordsDirectionDelta[direction].x, _loc.y - CoordsDirectionDelta[direction].y, _loc.z }); - gameState.Park.Entrances.erase(gameState.Park.Entrances.begin() + entranceIndex); + gameState.park.Entrances.erase(gameState.park.Entrances.begin() + entranceIndex); return res; } diff --git a/src/openrct2/actions/ParkMarketingAction.cpp b/src/openrct2/actions/ParkMarketingAction.cpp index c538da0f8a..42b031a160 100644 --- a/src/openrct2/actions/ParkMarketingAction.cpp +++ b/src/openrct2/actions/ParkMarketingAction.cpp @@ -55,7 +55,7 @@ GameActions::Result ParkMarketingAction::Query() const return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_ERR_VALUE_OUT_OF_RANGE); } - if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) + if (getGameState().park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_START_MARKETING_CAMPAIGN, diff --git a/src/openrct2/actions/ParkSetDateAction.cpp b/src/openrct2/actions/ParkSetDateAction.cpp index 3068aa2d0e..5b25fc0bac 100644 --- a/src/openrct2/actions/ParkSetDateAction.cpp +++ b/src/openrct2/actions/ParkSetDateAction.cpp @@ -71,7 +71,7 @@ GameActions::Result ParkSetDateAction::Query() const GameActions::Result ParkSetDateAction::Execute() const { - auto& gameState = GetGameState(); - gameState.Date = OpenRCT2::Date::FromYMD(_year, _month, _day); + auto& gameState = getGameState(); + gameState.date = OpenRCT2::Date::FromYMD(_year, _month, _day); return GameActions::Result(); } diff --git a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp index f58bc951ee..3e5647425e 100644 --- a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp +++ b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp @@ -43,7 +43,7 @@ void ParkSetEntranceFeeAction::Serialise(DataSerialiser& stream) GameActions::Result ParkSetEntranceFeeAction::Query() const { - if ((GetGameState().Park.Flags & 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"); return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, kStringIdNone); @@ -65,7 +65,7 @@ GameActions::Result ParkSetEntranceFeeAction::Query() const GameActions::Result ParkSetEntranceFeeAction::Execute() const { - GetGameState().Park.EntranceFee = _fee; + getGameState().park.EntranceFee = _fee; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ParkInformation); diff --git a/src/openrct2/actions/ParkSetLoanAction.cpp b/src/openrct2/actions/ParkSetLoanAction.cpp index 318e6dba2b..b753443753 100644 --- a/src/openrct2/actions/ParkSetLoanAction.cpp +++ b/src/openrct2/actions/ParkSetLoanAction.cpp @@ -42,20 +42,20 @@ void ParkSetLoanAction::Serialise(DataSerialiser& stream) GameActions::Result ParkSetLoanAction::Query() const { - auto& gameState = GetGameState(); - if (_value > gameState.BankLoan && _value > gameState.MaxBankLoan) + auto& gameState = getGameState(); + if (_value > gameState.bankLoan && _value > gameState.maxBankLoan) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BORROW_ANY_MORE_MONEY, STR_BANK_REFUSES_TO_INCREASE_LOAN); } - if (_value < gameState.BankLoan && _value < 0.00_GBP) + if (_value < gameState.bankLoan && _value < 0.00_GBP) { return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_PAY_BACK_LOAN, STR_LOAN_CANT_BE_NEGATIVE); } // The “isPayingBack” check is needed to allow increasing the loan when the player is in debt. - const auto isPayingBack = gameState.BankLoan > _value; - const auto amountToPayBack = gameState.BankLoan - _value; - if (isPayingBack && amountToPayBack > gameState.Cash) + const auto isPayingBack = gameState.bankLoan > _value; + const auto amountToPayBack = gameState.bankLoan - _value; + if (isPayingBack && amountToPayBack > gameState.cash) { return GameActions::Result( GameActions::Status::InsufficientFunds, STR_CANT_PAY_BACK_LOAN, STR_NOT_ENOUGH_CASH_AVAILABLE); @@ -65,10 +65,10 @@ GameActions::Result ParkSetLoanAction::Query() const GameActions::Result ParkSetLoanAction::Execute() const { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - gameState.Cash -= (gameState.BankLoan - _value); - gameState.BankLoan = _value; + gameState.cash -= (gameState.bankLoan - _value); + gameState.bankLoan = _value; auto windowManager = OpenRCT2::Ui::GetWindowManager(); windowManager->BroadcastIntent(Intent(INTENT_ACTION_UPDATE_CASH)); diff --git a/src/openrct2/actions/ParkSetNameAction.cpp b/src/openrct2/actions/ParkSetNameAction.cpp index 801d1d5502..5584562bf9 100644 --- a/src/openrct2/actions/ParkSetNameAction.cpp +++ b/src/openrct2/actions/ParkSetNameAction.cpp @@ -56,7 +56,7 @@ GameActions::Result ParkSetNameAction::Query() const GameActions::Result ParkSetNameAction::Execute() const { // Do a no-op if new name is the same as the current name is the same - auto& park = GetGameState().Park; + auto& park = getGameState().park; if (_name != park.Name) { park.Name = _name; diff --git a/src/openrct2/actions/ParkSetParameterAction.cpp b/src/openrct2/actions/ParkSetParameterAction.cpp index 8aa547a543..7bcaa29a47 100644 --- a/src/openrct2/actions/ParkSetParameterAction.cpp +++ b/src/openrct2/actions/ParkSetParameterAction.cpp @@ -57,27 +57,27 @@ GameActions::Result ParkSetParameterAction::Query() const GameActions::Result ParkSetParameterAction::Execute() const { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto* windowMgr = Ui::GetWindowManager(); switch (_parameter) { case ParkParameter::Close: - if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) + if (gameState.park.Flags & PARK_FLAGS_PARK_OPEN) { - gameState.Park.Flags &= ~PARK_FLAGS_PARK_OPEN; + gameState.park.Flags &= ~PARK_FLAGS_PARK_OPEN; windowMgr->InvalidateByClass(WindowClass::ParkInformation); } break; case ParkParameter::Open: - if (!(gameState.Park.Flags & PARK_FLAGS_PARK_OPEN)) + if (!(gameState.park.Flags & PARK_FLAGS_PARK_OPEN)) { - gameState.Park.Flags |= PARK_FLAGS_PARK_OPEN; + gameState.park.Flags |= PARK_FLAGS_PARK_OPEN; windowMgr->InvalidateByClass(WindowClass::ParkInformation); } break; case ParkParameter::SamePriceInPark: - gameState.SamePriceThroughoutPark = _value; + gameState.samePriceThroughoutPark = _value; windowMgr->InvalidateByClass(WindowClass::Ride); break; default: diff --git a/src/openrct2/actions/ParkSetResearchFundingAction.cpp b/src/openrct2/actions/ParkSetResearchFundingAction.cpp index 56af4e1be1..26aa1eb83a 100644 --- a/src/openrct2/actions/ParkSetResearchFundingAction.cpp +++ b/src/openrct2/actions/ParkSetResearchFundingAction.cpp @@ -56,9 +56,9 @@ GameActions::Result ParkSetResearchFundingAction::Query() const GameActions::Result ParkSetResearchFundingAction::Execute() const { - auto& gameState = GetGameState(); - gameState.ResearchPriorities = _priorities; - gameState.ResearchFundingLevel = _fundingAmount; + auto& gameState = getGameState(); + gameState.researchPriorities = _priorities; + gameState.researchFundingLevel = _fundingAmount; auto windowManager = OpenRCT2::Ui::GetWindowManager(); windowManager->BroadcastIntent(Intent(INTENT_ACTION_UPDATE_RESEARCH)); diff --git a/src/openrct2/actions/PeepSpawnPlaceAction.cpp b/src/openrct2/actions/PeepSpawnPlaceAction.cpp index 1af1fc9560..f9a0c9ec35 100644 --- a/src/openrct2/actions/PeepSpawnPlaceAction.cpp +++ b/src/openrct2/actions/PeepSpawnPlaceAction.cpp @@ -45,7 +45,7 @@ void PeepSpawnPlaceAction::Serialise(DataSerialiser& stream) GameActions::Result PeepSpawnPlaceAction::Query() const { - if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !getGameState().cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, kStringIdNone); } @@ -103,37 +103,37 @@ GameActions::Result PeepSpawnPlaceAction::Execute() const spawn.z = _location.z; spawn.direction = _location.direction; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // When attempting to place a peep spawn on a tile that already contains it, // remove that peep spawn instead. - if (!gameState.PeepSpawns.empty()) + if (!gameState.peepSpawns.empty()) { // When searching for existing spawns, ignore the direction. auto foundSpawn = std::find_if( - gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), [spawn](const CoordsXYZ& existingSpawn) { + gameState.peepSpawns.begin(), gameState.peepSpawns.end(), [spawn](const CoordsXYZ& existingSpawn) { { return existingSpawn.ToTileStart() == spawn.ToTileStart(); } }); - if (foundSpawn != std::end(gameState.PeepSpawns)) + if (foundSpawn != std::end(gameState.peepSpawns)) { - gameState.PeepSpawns.erase(foundSpawn); + gameState.peepSpawns.erase(foundSpawn); MapInvalidateTileFull(spawn); return res; } } // If we have reached our max peep spawns, remove the oldest spawns - while (gameState.PeepSpawns.size() >= Limits::kMaxPeepSpawns) + while (gameState.peepSpawns.size() >= Limits::kMaxPeepSpawns) { - PeepSpawn oldestSpawn = *gameState.PeepSpawns.begin(); - gameState.PeepSpawns.erase(gameState.PeepSpawns.begin()); + PeepSpawn oldestSpawn = *gameState.peepSpawns.begin(); + gameState.peepSpawns.erase(gameState.peepSpawns.begin()); MapInvalidateTileFull(oldestSpawn); } // Set peep spawn - gameState.PeepSpawns.push_back(spawn); + gameState.peepSpawns.push_back(spawn); // Invalidate tile MapInvalidateTileFull(_location); diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp index 638ca213d5..9affa5cad5 100644 --- a/src/openrct2/actions/RideCreateAction.cpp +++ b/src/openrct2/actions/RideCreateAction.cpp @@ -158,8 +158,8 @@ GameActions::Result RideCreateAction::Execute() const ride->status = RideStatus::closed; ride->numTrains = 1; - auto& gameState = GetGameState(); - if (gameState.Cheats.disableTrainLengthLimit) + auto& gameState = getGameState(); + if (gameState.cheats.disableTrainLengthLimit) { // Reduce amount of proposed trains to prevent 32 trains from always spawning when limits are disabled if (rideEntry->cars_per_flat_ride == kNoFlatRideCars) @@ -203,7 +203,7 @@ GameActions::Result RideCreateAction::Execute() const ride->ratings.setNull(); - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { for (auto i = 0; i < RCT2::ObjectLimits::kMaxShopItemsPerRideEntry; i++) { @@ -212,7 +212,7 @@ GameActions::Result RideCreateAction::Execute() const if (rideEntry->shop_item[0] == ShopItem::None) { - if (!Park::RidePricesUnlocked() || gameState.Park.EntranceFee > 0) + if (!Park::RidePricesUnlocked() || gameState.park.EntranceFee > 0) { ride->price[0] = 0; } @@ -226,7 +226,7 @@ GameActions::Result RideCreateAction::Execute() const ride->price[1] = GetShopItemDescriptor(rideEntry->shop_item[1]).DefaultPrice; } - if (gameState.ScenarioObjective.Type == OBJECTIVE_BUILD_THE_BEST) + if (gameState.scenarioObjective.Type == OBJECTIVE_BUILD_THE_BEST) { ride->price[0] = 0; } diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp index 470c812b29..1ac55b3567 100644 --- a/src/openrct2/actions/RideDemolishAction.cpp +++ b/src/openrct2/actions/RideDemolishAction.cpp @@ -65,7 +65,7 @@ GameActions::Result RideDemolishAction::Query() const if ((ride->lifecycleFlags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) && _modifyType == RideModifyType::demolish) - && !GetGameState().Cheats.makeAllDestructible) + && !getGameState().cheats.makeAllDestructible) { return GameActions::Result( GameActions::Status::NoClearance, STR_CANT_DEMOLISH_RIDE, @@ -154,7 +154,7 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride& ride) const } ride.remove(); - GetGameState().Park.Value = Park::CalculateParkValue(); + getGameState().park.Value = Park::CalculateParkValue(); // Close windows related to the demolished ride auto* windowMgr = Ui::GetWindowManager(); @@ -195,11 +195,11 @@ money64 RideDemolishAction::DemolishTracks() const uint8_t oldpaused = gGamePaused; gGamePaused = 0; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - for (TileCoordsXY tilePos = {}; tilePos.x < gameState.MapSize.x; ++tilePos.x) + for (TileCoordsXY tilePos = {}; tilePos.x < gameState.mapSize.x; ++tilePos.x) { - for (tilePos.y = 0; tilePos.y < gameState.MapSize.y; ++tilePos.y) + for (tilePos.y = 0; tilePos.y < gameState.mapSize.y; ++tilePos.y) { const auto tileCoords = tilePos.ToCoordsXY(); // Loop over all elements of the tile until there are no more items to remove diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 58088b5c3d..9d721e27fb 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -102,7 +102,7 @@ GameActions::Result RideEntranceExitPlaceAction::Query() const { return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_OFF_EDGE_OF_MAP); } - if (!GetGameState().Cheats.sandboxMode && !MapIsLocationOwned({ _loc, z })) + if (!getGameState().cheats.sandboxMode && !MapIsLocationOwned({ _loc, z })) { return GameActions::Result(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } @@ -173,7 +173,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const auto z = station.GetBaseZ(); if (!(GetFlags() & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) - && !GetGameState().Cheats.disableClearanceChecks) + && !getGameState().cheats.disableClearanceChecks) { FootpathRemoveLitter({ _loc, z }); WallRemoveAtZ({ _loc, z }); @@ -236,7 +236,7 @@ GameActions::Result RideEntranceExitPlaceAction::TrackPlaceQuery(const CoordsXYZ const auto errorTitle = isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION : STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION; - if (!GetGameState().Cheats.sandboxMode && !MapIsLocationOwned(loc)) + if (!getGameState().cheats.sandboxMode && !MapIsLocationOwned(loc)) { return GameActions::Result(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/RideSetSettingAction.cpp b/src/openrct2/actions/RideSetSettingAction.cpp index 55e7ec5f14..fec30a0ee7 100644 --- a/src/openrct2/actions/RideSetSettingAction.cpp +++ b/src/openrct2/actions/RideSetSettingAction.cpp @@ -70,7 +70,7 @@ GameActions::Result RideSetSettingAction::Query() const GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, STR_MUST_BE_CLOSED_FIRST); } - if (!RideIsModeValid(*ride) && !GetGameState().Cheats.showAllOperatingModes) + if (!RideIsModeValid(*ride) && !getGameState().cheats.showAllOperatingModes) { LOG_ERROR("Invalid ride mode: %u", _value); return GameActions::Result( @@ -149,7 +149,7 @@ GameActions::Result RideSetSettingAction::Query() const } break; case RideSetSetting::RideType: - if (!GetGameState().Cheats.allowArbitraryRideTypeChanges) + if (!getGameState().cheats.allowArbitraryRideTypeChanges) { LOG_ERROR("Arbitrary ride type changes not allowed."); return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, kStringIdNone); @@ -263,16 +263,16 @@ bool RideSetSettingAction::RideIsModeValid(const Ride& ride) const bool RideSetSettingAction::RideIsValidLiftHillSpeed(const Ride& ride) const { - auto& gameState = GetGameState(); - int32_t minSpeed = gameState.Cheats.unlockOperatingLimits ? 0 : ride.getRideTypeDescriptor().LiftData.minimum_speed; - int32_t maxSpeed = gameState.Cheats.unlockOperatingLimits ? 255 : ride.getRideTypeDescriptor().LiftData.maximum_speed; + auto& gameState = getGameState(); + int32_t minSpeed = gameState.cheats.unlockOperatingLimits ? 0 : ride.getRideTypeDescriptor().LiftData.minimum_speed; + int32_t maxSpeed = gameState.cheats.unlockOperatingLimits ? 255 : ride.getRideTypeDescriptor().LiftData.maximum_speed; return _value >= minSpeed && _value <= maxSpeed; } bool RideSetSettingAction::RideIsValidNumCircuits() const { int32_t minNumCircuits = 1; - int32_t maxNumCircuits = GetGameState().Cheats.unlockOperatingLimits ? 255 : Limits::kMaxCircuitsPerRide; + int32_t maxNumCircuits = getGameState().cheats.unlockOperatingLimits ? 255 : Limits::kMaxCircuitsPerRide; return _value >= minNumCircuits && _value <= maxNumCircuits; } @@ -281,7 +281,7 @@ bool RideSetSettingAction::RideIsValidOperationOption(const Ride& ride) const const auto& operatingSettings = ride.getRideTypeDescriptor().OperatingSettings; uint8_t minValue = operatingSettings.MinValue; uint8_t maxValue = operatingSettings.MaxValue; - if (GetGameState().Cheats.unlockOperatingLimits) + if (getGameState().cheats.unlockOperatingLimits) { minValue = 0; maxValue = 255; diff --git a/src/openrct2/actions/RideSetVehicleAction.cpp b/src/openrct2/actions/RideSetVehicleAction.cpp index f0aad1b7ce..629ca3cddb 100644 --- a/src/openrct2/actions/RideSetVehicleAction.cpp +++ b/src/openrct2/actions/RideSetVehicleAction.cpp @@ -157,7 +157,7 @@ GameActions::Result RideSetVehicleAction::Execute() const } uint8_t clampValue = _value; static_assert(sizeof(clampValue) == sizeof(ride->proposedNumCarsPerTrain)); - if (!GetGameState().Cheats.disableTrainLengthLimit) + if (!getGameState().cheats.disableTrainLengthLimit) { clampValue = std::clamp(clampValue, rideEntry->min_cars_in_train, rideEntry->max_cars_in_train); } @@ -180,7 +180,7 @@ GameActions::Result RideSetVehicleAction::Execute() const } RideSetVehicleColoursToRandomPreset(*ride, _colour); - if (!GetGameState().Cheats.disableTrainLengthLimit) + if (!getGameState().cheats.disableTrainLengthLimit) { ride->proposedNumCarsPerTrain = std::clamp( ride->proposedNumCarsPerTrain, rideEntry->min_cars_in_train, rideEntry->max_cars_in_train); @@ -224,11 +224,11 @@ bool RideSetVehicleAction::RideIsVehicleTypeValid(const Ride& ride) const { bool selectionShouldBeExpanded; ride_type_t rideTypeIterator, rideTypeIteratorMax; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); { const auto& rtd = ride.getRideTypeDescriptor(); - if (gameState.Cheats.showVehiclesFromOtherTrackTypes + if (gameState.cheats.showVehiclesFromOtherTrackTypes && !( ride.getRideTypeDescriptor().HasFlag(RtdFlag::isFlatRide) || rtd.specialType == RtdSpecialType::maze || rtd.specialType == RtdSpecialType::miniGolf)) @@ -263,7 +263,7 @@ bool RideSetVehicleAction::RideIsVehicleTypeValid(const Ride& ride) const { if (rideEntryIndex == _value) { - if (!RideEntryIsInvented(rideEntryIndex) && !gameState.Cheats.ignoreResearchStatus) + if (!RideEntryIsInvented(rideEntryIndex) && !gameState.cheats.ignoreResearchStatus) { return false; } diff --git a/src/openrct2/actions/ScenarioSetSettingAction.cpp b/src/openrct2/actions/ScenarioSetSettingAction.cpp index b7d52bda69..5485bfcd51 100644 --- a/src/openrct2/actions/ScenarioSetSettingAction.cpp +++ b/src/openrct2/actions/ScenarioSetSettingAction.cpp @@ -46,7 +46,7 @@ GameActions::Result ScenarioSetSettingAction::Query() const GameActions::Result ScenarioSetSettingAction::Execute() const { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto* windowMgr = Ui::GetWindowManager(); switch (_setting) @@ -56,22 +56,22 @@ GameActions::Result ScenarioSetSettingAction::Execute() const { if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_NO_MONEY; + gameState.park.Flags |= PARK_FLAGS_NO_MONEY; } else { - gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY; + gameState.park.Flags &= ~PARK_FLAGS_NO_MONEY; } } else { if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_NO_MONEY; + gameState.park.Flags |= PARK_FLAGS_NO_MONEY; } else { - gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY; + gameState.park.Flags &= ~PARK_FLAGS_NO_MONEY; } // Invalidate all windows that have anything to do with finance windowMgr->InvalidateByClass(WindowClass::Ride); @@ -83,168 +83,168 @@ GameActions::Result ScenarioSetSettingAction::Execute() const } break; case ScenarioSetSetting::InitialCash: - gameState.InitialCash = std::clamp(_value, 0.00_GBP, 1000000.00_GBP); - gameState.Cash = gameState.InitialCash; + gameState.initialCash = std::clamp(_value, 0.00_GBP, 1000000.00_GBP); + gameState.cash = gameState.initialCash; windowMgr->InvalidateByClass(WindowClass::Finances); windowMgr->InvalidateByClass(WindowClass::BottomToolbar); break; case ScenarioSetSetting::InitialLoan: - gameState.BankLoan = std::clamp(_value, 0.00_GBP, 5000000.00_GBP); - gameState.MaxBankLoan = std::max(gameState.BankLoan, gameState.MaxBankLoan); + gameState.bankLoan = std::clamp(_value, 0.00_GBP, 5000000.00_GBP); + gameState.maxBankLoan = std::max(gameState.bankLoan, gameState.maxBankLoan); windowMgr->InvalidateByClass(WindowClass::Finances); break; case ScenarioSetSetting::MaximumLoanSize: - gameState.MaxBankLoan = std::clamp(_value, 0.00_GBP, 5000000.00_GBP); - gameState.BankLoan = std::min(gameState.BankLoan, gameState.MaxBankLoan); + gameState.maxBankLoan = std::clamp(_value, 0.00_GBP, 5000000.00_GBP); + gameState.bankLoan = std::min(gameState.bankLoan, gameState.maxBankLoan); windowMgr->InvalidateByClass(WindowClass::Finances); break; case ScenarioSetSetting::AnnualInterestRate: - gameState.BankLoanInterestRate = std::clamp(_value, 0, MaxBankLoanInterestRate); + gameState.bankLoanInterestRate = std::clamp(_value, 0, MaxBankLoanInterestRate); windowMgr->InvalidateByClass(WindowClass::Finances); break; case ScenarioSetSetting::ForbidMarketingCampaigns: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN; + gameState.park.Flags |= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN; } else { - gameState.Park.Flags &= ~PARK_FLAGS_FORBID_MARKETING_CAMPAIGN; + gameState.park.Flags &= ~PARK_FLAGS_FORBID_MARKETING_CAMPAIGN; } break; case ScenarioSetSetting::AverageCashPerGuest: - gameState.GuestInitialCash = std::clamp(_value, 0.00_GBP, 1000.00_GBP); + gameState.guestInitialCash = std::clamp(_value, 0.00_GBP, 1000.00_GBP); break; case ScenarioSetSetting::GuestInitialHappiness: - gameState.GuestInitialHappiness = std::clamp(_value, 40, 250); + gameState.guestInitialHappiness = std::clamp(_value, 40, 250); break; case ScenarioSetSetting::GuestInitialHunger: - gameState.GuestInitialHunger = std::clamp(_value, 40, 250); + gameState.guestInitialHunger = std::clamp(_value, 40, 250); break; case ScenarioSetSetting::GuestInitialThirst: - gameState.GuestInitialThirst = std::clamp(_value, 40, 250); + gameState.guestInitialThirst = std::clamp(_value, 40, 250); break; case ScenarioSetSetting::GuestsPreferLessIntenseRides: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_PREF_LESS_INTENSE_RIDES; + gameState.park.Flags |= PARK_FLAGS_PREF_LESS_INTENSE_RIDES; } else { - gameState.Park.Flags &= ~PARK_FLAGS_PREF_LESS_INTENSE_RIDES; + gameState.park.Flags &= ~PARK_FLAGS_PREF_LESS_INTENSE_RIDES; } break; case ScenarioSetSetting::GuestsPreferMoreIntenseRides: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_PREF_MORE_INTENSE_RIDES; + gameState.park.Flags |= PARK_FLAGS_PREF_MORE_INTENSE_RIDES; } else { - gameState.Park.Flags &= ~PARK_FLAGS_PREF_MORE_INTENSE_RIDES; + gameState.park.Flags &= ~PARK_FLAGS_PREF_MORE_INTENSE_RIDES; } break; case ScenarioSetSetting::CostToBuyLand: - gameState.LandPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); + gameState.landPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); break; case ScenarioSetSetting::CostToBuyConstructionRights: - gameState.ConstructionRightsPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); + gameState.constructionRightsPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); break; case ScenarioSetSetting::ParkChargeMethod: if (gLegacyScene == LegacyScene::scenarioEditor) { if (_value == 0) { - gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; - gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; - gameState.Park.EntranceFee = 0.00_GBP; + gameState.park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.EntranceFee = 0.00_GBP; } else if (_value == 1) { - gameState.Park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY; - gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; - gameState.Park.EntranceFee = 10.00_GBP; + gameState.park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.EntranceFee = 10.00_GBP; } else { - gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; - gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; - gameState.Park.EntranceFee = 10.00_GBP; + gameState.park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.EntranceFee = 10.00_GBP; } } else { if (_value == 0) { - gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; - gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; } else if (_value == 1) { - gameState.Park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY; - gameState.Park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.Flags &= ~PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES; } else { - gameState.Park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; - gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.Flags |= PARK_FLAGS_PARK_FREE_ENTRY; + gameState.park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; } windowMgr->InvalidateByClass(WindowClass::ParkInformation); windowMgr->InvalidateByClass(WindowClass::Ride); } break; case ScenarioSetSetting::ParkChargeEntryFee: - gameState.Park.EntranceFee = std::clamp(_value, 0.00_GBP, kMaxEntranceFee); + gameState.park.EntranceFee = std::clamp(_value, 0.00_GBP, kMaxEntranceFee); windowMgr->InvalidateByClass(WindowClass::ParkInformation); break; case ScenarioSetSetting::ForbidTreeRemoval: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_FORBID_TREE_REMOVAL; + gameState.park.Flags |= PARK_FLAGS_FORBID_TREE_REMOVAL; } else { - gameState.Park.Flags &= ~PARK_FLAGS_FORBID_TREE_REMOVAL; + gameState.park.Flags &= ~PARK_FLAGS_FORBID_TREE_REMOVAL; } break; case ScenarioSetSetting::ForbidLandscapeChanges: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES; + gameState.park.Flags |= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES; } else { - gameState.Park.Flags &= ~PARK_FLAGS_FORBID_LANDSCAPE_CHANGES; + gameState.park.Flags &= ~PARK_FLAGS_FORBID_LANDSCAPE_CHANGES; } break; case ScenarioSetSetting::ForbidHighConstruction: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; + gameState.park.Flags |= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; } else { - gameState.Park.Flags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; + gameState.park.Flags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; } break; case ScenarioSetSetting::ParkRatingHigherDifficultyLevel: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_DIFFICULT_PARK_RATING; + gameState.park.Flags |= PARK_FLAGS_DIFFICULT_PARK_RATING; } else { - gameState.Park.Flags &= ~PARK_FLAGS_DIFFICULT_PARK_RATING; + gameState.park.Flags &= ~PARK_FLAGS_DIFFICULT_PARK_RATING; } break; case ScenarioSetSetting::GuestGenerationHigherDifficultyLevel: if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_DIFFICULT_GUEST_GENERATION; + gameState.park.Flags |= PARK_FLAGS_DIFFICULT_GUEST_GENERATION; } else { - gameState.Park.Flags &= ~PARK_FLAGS_DIFFICULT_GUEST_GENERATION; + gameState.park.Flags &= ~PARK_FLAGS_DIFFICULT_GUEST_GENERATION; } break; case ScenarioSetSetting::AllowEarlyCompletion: @@ -254,11 +254,11 @@ GameActions::Result ScenarioSetSettingAction::Execute() const { if (_value != 0) { - gameState.Park.Flags |= PARK_FLAGS_RCT1_INTEREST; + gameState.park.Flags |= PARK_FLAGS_RCT1_INTEREST; } else { - gameState.Park.Flags &= ~PARK_FLAGS_RCT1_INTEREST; + gameState.park.Flags &= ~PARK_FLAGS_RCT1_INTEREST; } break; } diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.cpp b/src/openrct2/actions/SmallSceneryPlaceAction.cpp index f7f429bd90..318e3b0f69 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.cpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.cpp @@ -171,8 +171,8 @@ GameActions::Result SmallSceneryPlaceAction::Query() const targetHeight = surfaceHeight; } - auto& gameState = GetGameState(); - if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode + auto& gameState = getGameState(); + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode && !MapIsLocationOwned({ _loc.x, _loc.y, targetHeight })) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -180,7 +180,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const auto* surfaceElement = MapGetSurfaceElementAt(_loc); - if (surfaceElement != nullptr && !gameState.Cheats.disableClearanceChecks && surfaceElement->GetWaterHeight() > 0) + if (surfaceElement != nullptr && !gameState.cheats.disableClearanceChecks && surfaceElement->GetWaterHeight() > 0) { int32_t water_height = surfaceElement->GetWaterHeight() - 1; if (water_height > targetHeight) @@ -190,7 +190,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const } } - if (!gameState.Cheats.disableClearanceChecks && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE))) + if (!gameState.cheats.disableClearanceChecks && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE))) { if (isOnWater) { @@ -208,13 +208,13 @@ GameActions::Result SmallSceneryPlaceAction::Query() const } } - if (!gameState.Cheats.disableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE)) + if (!gameState.cheats.disableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE)) && !supportsRequired && !isOnWater && surfaceElement != nullptr && (surfaceElement->GetSlope() != kTileSlopeFlat)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LEVEL_LAND_REQUIRED); } - if (!gameState.Cheats.disableSupportLimits && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE)) && supportsRequired) + if (!gameState.cheats.disableSupportLimits && !(sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_STACKABLE)) && supportsRequired) { if (!isOnWater) { @@ -367,7 +367,7 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { FootpathRemoveLitter({ _loc, targetHeight }); - if (!GetGameState().Cheats.disableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))) + if (!getGameState().cheats.disableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))) { WallRemoveAt({ _loc, targetHeight, targetHeight + sceneryEntry->height }); } diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.cpp b/src/openrct2/actions/SmallSceneryRemoveAction.cpp index ba799d93fb..31886c2e31 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.cpp +++ b/src/openrct2/actions/SmallSceneryRemoveAction.cpp @@ -75,10 +75,10 @@ GameActions::Result SmallSceneryRemoveAction::Query() const res.Position = _loc; if (gLegacyScene != LegacyScene::scenarioEditor && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) - && !GetGameState().Cheats.sandboxMode) + && !getGameState().cheats.sandboxMode) { // Check if allowed to remove item - if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) + if (getGameState().park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) { if (entry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE)) { diff --git a/src/openrct2/actions/SmallScenerySetColourAction.cpp b/src/openrct2/actions/SmallScenerySetColourAction.cpp index 3493037745..2ae5015e33 100644 --- a/src/openrct2/actions/SmallScenerySetColourAction.cpp +++ b/src/openrct2/actions/SmallScenerySetColourAction.cpp @@ -83,7 +83,7 @@ GameActions::Result SmallScenerySetColourAction::QueryExecute(bool isExecuting) return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP); } - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationOwned(_loc)) { diff --git a/src/openrct2/actions/StaffHireNewAction.cpp b/src/openrct2/actions/StaffHireNewAction.cpp index 3256470b90..ef91a5172c 100644 --- a/src/openrct2/actions/StaffHireNewAction.cpp +++ b/src/openrct2/actions/StaffHireNewAction.cpp @@ -193,7 +193,7 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const newPeep->TrousersColour = colour; // Staff energy determines their walking speed - switch (GetGameState().Cheats.selectedStaffSpeed) + switch (getGameState().cheats.selectedStaffSpeed) { case StaffSpeedCheat::None: newPeep->Energy = kCheatsStaffNormalSpeed; @@ -280,11 +280,11 @@ void StaffHireNewAction::AutoPositionNewStaff(Peep* newPeep) const else { // No walking guests; pick random park entrance - const auto& gameState = GetGameState(); - if (!gameState.Park.Entrances.empty()) + const auto& gameState = getGameState(); + if (!gameState.park.Entrances.empty()) { - auto rand = ScenarioRandMax(static_cast(gameState.Park.Entrances.size())); - const auto& entrance = gameState.Park.Entrances[rand]; + auto rand = ScenarioRandMax(static_cast(gameState.park.Entrances.size())); + const auto& entrance = gameState.park.Entrances[rand]; auto dir = entrance.direction; newLocation = entrance; // TODO: Replace with CoordsDirectionDelta diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 1ed467a2be..8138daf0e2 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -85,11 +85,11 @@ GameActions::Result SurfaceSetStyleAction::Query() const res.Position.y = yMid; res.Position.z = heightMid; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Do nothing if not in editor, sandbox mode or landscaping is forbidden - if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode - && (gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)) + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode + && (gameState.park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_CHANGE_LAND_TYPE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY); @@ -105,7 +105,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (!LocationValid(coords)) continue; - if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode) { if (!MapIsLocationInPark(coords)) continue; @@ -173,7 +173,7 @@ GameActions::Result SurfaceSetStyleAction::Execute() const if (!LocationValid(coords)) continue; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(coords)) continue; diff --git a/src/openrct2/actions/TrackDesignAction.cpp b/src/openrct2/actions/TrackDesignAction.cpp index fc16a96ee6..29b0ba74c7 100644 --- a/src/openrct2/actions/TrackDesignAction.cpp +++ b/src/openrct2/actions/TrackDesignAction.cpp @@ -65,21 +65,21 @@ GameActions::Result TrackDesignAction::Query() const GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto& objManager = GetContext()->GetObjectManager(); auto entryIndex = objManager.GetLoadedObjectEntryIndex(_td.trackAndVehicle.vehicleObject); if (entryIndex == kObjectEntryIndexNull) { // Force a fallback if the entry is not invented yet a track design of it is selected, // which can happen in select-by-track-type mode - if (!RideEntryIsInvented(entryIndex) && !gameState.Cheats.ignoreResearchStatus) + if (!RideEntryIsInvented(entryIndex) && !gameState.cheats.ignoreResearchStatus) { entryIndex = kObjectEntryIndexNull; } } // Colours do not matter as will be overwritten - auto rideCreateAction = RideCreateAction(_td.trackAndVehicle.rtdIndex, entryIndex, 0, 0, gameState.LastEntranceStyle); + auto rideCreateAction = RideCreateAction(_td.trackAndVehicle.rtdIndex, entryIndex, 0, 0, gameState.lastEntranceStyle); rideCreateAction.SetFlags(GetFlags()); auto r = GameActions::ExecuteNested(&rideCreateAction); if (r.Error != GameActions::Status::Ok) @@ -139,21 +139,21 @@ GameActions::Result TrackDesignAction::Execute() const res.Position.z = _loc.z; res.Expenditure = ExpenditureType::RideConstruction; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto& objManager = GetContext()->GetObjectManager(); auto entryIndex = objManager.GetLoadedObjectEntryIndex(_td.trackAndVehicle.vehicleObject); if (entryIndex != kObjectEntryIndexNull) { // Force a fallback if the entry is not invented yet a track design using it is selected. // This can happen on rides with multiple vehicles where some have been invented and some haven’t. - if (!RideEntryIsInvented(entryIndex) && !gameState.Cheats.ignoreResearchStatus) + if (!RideEntryIsInvented(entryIndex) && !gameState.cheats.ignoreResearchStatus) { entryIndex = kObjectEntryIndexNull; } } // Colours do not matter as will be overwritten - auto rideCreateAction = RideCreateAction(_td.trackAndVehicle.rtdIndex, entryIndex, 0, 0, gameState.LastEntranceStyle); + auto rideCreateAction = RideCreateAction(_td.trackAndVehicle.rtdIndex, entryIndex, 0, 0, gameState.lastEntranceStyle); rideCreateAction.SetFlags(GetFlags()); auto r = GameActions::ExecuteNested(&rideCreateAction); if (r.Error != GameActions::Status::Ok) @@ -245,7 +245,7 @@ GameActions::Result TrackDesignAction::Execute() const ride->entranceStyle = objManager.GetLoadedObjectEntryIndex(_td.appearance.stationObjectIdentifier); if (ride->entranceStyle == kObjectEntryIndexNull) { - ride->entranceStyle = gameState.LastEntranceStyle; + ride->entranceStyle = gameState.lastEntranceStyle; } for (size_t i = 0; i < std::min(std::size(ride->trackColours), std::size(_td.appearance.trackColours)); i++) diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index f997470a81..35b591dc51 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -99,8 +99,8 @@ GameActions::Result TrackPlaceAction::Query() const GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE); } - auto& gameState = GetGameState(); - if (_rideType != ride->type && !gameState.Cheats.allowArbitraryRideTypeChanges) + auto& gameState = getGameState(); + if (_rideType != ride->type && !gameState.cheats.allowArbitraryRideTypeChanges) { return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, kStringIdNone); @@ -138,7 +138,7 @@ GameActions::Result TrackPlaceAction::Query() const if (!(GetActionFlags() & GameActions::Flags::AllowWhilePaused)) { - if (GameIsPaused() && !gameState.Cheats.buildInPauseMode) + if (GameIsPaused() && !gameState.cheats.buildInPauseMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, @@ -168,7 +168,7 @@ GameActions::Result TrackPlaceAction::Query() const } // Backwards steep lift hills are allowed, even on roller coasters that do not support forwards steep lift hills. if (_trackPlaceFlags.has(LiftHillAndInverted::liftHill) && !rtd.SupportsTrackGroup(TrackGroup::liftHillSteep) - && !gameState.Cheats.enableChainLiftOnAllTrack) + && !gameState.cheats.enableChainLiftOnAllTrack) { const auto& ted = GetTrackElementDescriptor(_trackType); if (ted.flags & TRACK_ELEM_FLAG_IS_STEEP_UP) @@ -194,7 +194,7 @@ GameActions::Result TrackPlaceAction::Query() const return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!MapIsLocationOwned(tileCoords) && !gameState.Cheats.sandboxMode) + if (!MapIsLocationOwned(tileCoords) && !gameState.cheats.sandboxMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -210,7 +210,7 @@ GameActions::Result TrackPlaceAction::Query() const STR_TILE_ELEMENT_LIMIT_REACHED); } - if (!gameState.Cheats.allowTrackPlaceInvalidHeights) + if (!gameState.cheats.allowTrackPlaceInvalidHeights) { if (ted.flags & TRACK_ELEM_FLAG_STARTS_AT_HALF_HEIGHT) { @@ -313,7 +313,7 @@ GameActions::Result TrackPlaceAction::Query() const } } - if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER && !gameState.Cheats.disableClearanceChecks) + if (clearanceData.GroundFlags & ELEMENT_IS_UNDERWATER && !gameState.cheats.disableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, @@ -379,7 +379,7 @@ GameActions::Result TrackPlaceAction::Query() const STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } - if (!gameState.Cheats.disableSupportLimits) + if (!gameState.cheats.disableSupportLimits) { int32_t ride_height = clearanceZ - surfaceElement->GetBaseZ(); if (ride_height >= 0) @@ -504,8 +504,8 @@ GameActions::Result TrackPlaceAction::Execute() const } } - auto& gameState = GetGameState(); - if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gameState.Cheats.disableClearanceChecks) + auto& gameState = getGameState(); + if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gameState.cheats.disableClearanceChecks) { FootpathRemoveLitter(mapLoc); if (rtd.HasFlag(RtdFlag::noWallsAroundTrack)) @@ -639,7 +639,7 @@ GameActions::Result TrackPlaceAction::Execute() const uint32_t availableDirections = entranceDirections & 0x0F; if (availableDirections != 0) { - if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gameState.Cheats.disableClearanceChecks) + if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gameState.cheats.disableClearanceChecks) { for (int32_t chosenDirection = Numerics::bitScanForward(availableDirections); chosenDirection != -1; chosenDirection = Numerics::bitScanForward(availableDirections)) @@ -681,7 +681,7 @@ GameActions::Result TrackPlaceAction::Execute() const } } - if (!gameState.Cheats.disableClearanceChecks || !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) + if (!gameState.cheats.disableClearanceChecks || !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { FootpathConnectEdges(mapLoc, tileElement, GetFlags()); } @@ -712,7 +712,7 @@ GameActions::Result TrackPlaceAction::Execute() const if (ride->mode == RideMode::poweredLaunch) { if (rtd.SupportsRideMode(RideMode::poweredLaunchBlockSectioned) - || GetGameState().Cheats.showAllOperatingModes) + || getGameState().cheats.showAllOperatingModes) newMode = RideMode::poweredLaunchBlockSectioned; else newMode = RideMode::poweredLaunch; diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index 930ad01948..b2bc9a3746 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -440,7 +440,7 @@ GameActions::Result TrackRemoveAction::Execute() const InvalidateTestResults(*ride); FootpathQueueChainReset(); - if (!GetGameState().Cheats.disableClearanceChecks || !(tileElement->IsGhost())) + if (!getGameState().cheats.disableClearanceChecks || !(tileElement->IsGhost())) { FootpathRemoveEdgesAt(mapLoc, tileElement); } diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 4d8c2bf14c..373ac29003 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -89,10 +89,10 @@ GameActions::Result WallPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto mapSizeMax = GetMapSizeMaxXY(); if (gLegacyScene != LegacyScene::scenarioEditor && !(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) - && !gameState.Cheats.sandboxMode) + && !gameState.cheats.sandboxMode) { if (_loc.z == 0) { @@ -151,14 +151,14 @@ GameActions::Result WallPlaceAction::Query() const { uint16_t waterHeight = surfaceElement->GetWaterHeight(); - if (targetHeight < waterHeight && !gameState.Cheats.disableClearanceChecks) + if (targetHeight < waterHeight && !gameState.cheats.disableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER); } } - if (targetHeight < surfaceElement->GetBaseZ() && !gameState.Cheats.disableClearanceChecks) + if (targetHeight < surfaceElement->GetBaseZ() && !gameState.cheats.disableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND); @@ -171,7 +171,7 @@ GameActions::Result WallPlaceAction::Query() const newBaseHeight += 2; if (surfaceElement->GetSlope() & (1 << newEdge)) { - if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.disableClearanceChecks) + if (targetHeight / 8 < newBaseHeight && !gameState.cheats.disableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND); @@ -187,7 +187,7 @@ GameActions::Result WallPlaceAction::Query() const if (surfaceElement->GetSlope() & (1 << newEdge)) { newBaseHeight += 2; - if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.disableClearanceChecks) + if (targetHeight / 8 < newBaseHeight && !gameState.cheats.disableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, @@ -202,7 +202,7 @@ GameActions::Result WallPlaceAction::Query() const newEdge = (_edge + 3) & 3; if (surfaceElement->GetSlope() & (1 << newEdge)) { - if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.disableClearanceChecks) + if (targetHeight / 8 < newBaseHeight && !gameState.cheats.disableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND); @@ -218,7 +218,7 @@ GameActions::Result WallPlaceAction::Query() const if (surfaceElement->GetSlope() & (1 << newEdge)) { newBaseHeight += 2; - if (targetHeight / 8 < newBaseHeight && !gameState.Cheats.disableClearanceChecks) + if (targetHeight / 8 < newBaseHeight && !gameState.cheats.disableClearanceChecks) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, @@ -261,7 +261,7 @@ GameActions::Result WallPlaceAction::Query() const clearanceHeight += wallEntry->height; bool wallAcrossTrack = false; - if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gameState.Cheats.disableClearanceChecks) + if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gameState.cheats.disableClearanceChecks) { auto result = WallCheckObstruction(wallEntry, targetHeight / 8, clearanceHeight, &wallAcrossTrack); if (result.Error != GameActions::Status::Ok) @@ -286,7 +286,7 @@ GameActions::Result WallPlaceAction::Query() const GameActions::Result WallPlaceAction::Execute() const { auto res = GameActions::Result(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); res.ErrorTitle = STR_CANT_BUILD_THIS_HERE; res.Position = _loc; @@ -339,7 +339,7 @@ GameActions::Result WallPlaceAction::Execute() const clearanceHeight += wallEntry->height; bool wallAcrossTrack = false; - if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gameState.Cheats.disableClearanceChecks) + if (!(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gameState.cheats.disableClearanceChecks) { auto result = WallCheckObstruction(wallEntry, targetHeight / kCoordsZStep, clearanceHeight, &wallAcrossTrack); if (result.Error != GameActions::Status::Ok) diff --git a/src/openrct2/actions/WallRemoveAction.cpp b/src/openrct2/actions/WallRemoveAction.cpp index d325f985d9..ec1bba608b 100644 --- a/src/openrct2/actions/WallRemoveAction.cpp +++ b/src/openrct2/actions/WallRemoveAction.cpp @@ -50,7 +50,7 @@ GameActions::Result WallRemoveAction::Query() const } const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST; - if (!isGhost && gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode + if (!isGhost && gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); diff --git a/src/openrct2/actions/WallSetColourAction.cpp b/src/openrct2/actions/WallSetColourAction.cpp index 0b0e07c105..cf77121e42 100644 --- a/src/openrct2/actions/WallSetColourAction.cpp +++ b/src/openrct2/actions/WallSetColourAction.cpp @@ -67,7 +67,7 @@ GameActions::Result WallSetColourAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP); } - if (gLegacyScene != LegacyScene::scenarioEditor && !MapIsLocationInPark(_loc) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !MapIsLocationInPark(_loc) && !getGameState().cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/WaterLowerAction.cpp b/src/openrct2/actions/WaterLowerAction.cpp index 1e63788fb3..656e0cce08 100644 --- a/src/openrct2/actions/WaterLowerAction.cpp +++ b/src/openrct2/actions/WaterLowerAction.cpp @@ -80,7 +80,7 @@ GameActions::Result WaterLowerAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -139,7 +139,7 @@ uint8_t WaterLowerAction::GetLowestHeight(const MapRange& validRange) const { for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += kCoordsXYStep) { - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/WaterRaiseAction.cpp b/src/openrct2/actions/WaterRaiseAction.cpp index 866a63c7f2..5cc656699f 100644 --- a/src/openrct2/actions/WaterRaiseAction.cpp +++ b/src/openrct2/actions/WaterRaiseAction.cpp @@ -80,7 +80,7 @@ GameActions::Result WaterRaiseAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -152,7 +152,7 @@ uint16_t WaterRaiseAction::GetHighestHeight(const MapRange& validRange) const { for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += kCoordsXYStep) { - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/WaterSetHeightAction.cpp b/src/openrct2/actions/WaterSetHeightAction.cpp index 7ff53baad7..64dd87c871 100644 --- a/src/openrct2/actions/WaterSetHeightAction.cpp +++ b/src/openrct2/actions/WaterSetHeightAction.cpp @@ -51,9 +51,9 @@ GameActions::Result WaterSetHeightAction::Query() const res.Expenditure = ExpenditureType::Landscaping; res.Position = { _coords, _height * kCoordsZStep }; - auto& gameState = GetGameState(); - if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode - && gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) + auto& gameState = getGameState(); + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode + && gameState.park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { return GameActions::Result(GameActions::Status::Disallowed, kStringIdNone, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY); } @@ -69,7 +69,7 @@ GameActions::Result WaterSetHeightAction::Query() const return GameActions::Result(GameActions::Status::NotOwned, kStringIdNone, STR_LAND_NOT_OWNED_BY_PARK); } - if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode) { if (!MapIsLocationInPark(_coords)) { @@ -121,7 +121,7 @@ GameActions::Result WaterSetHeightAction::Execute() const int32_t surfaceHeight = TileElementHeight(_coords); FootpathRemoveLitter({ _coords, surfaceHeight }); - if (!GetGameState().Cheats.disableClearanceChecks) + if (!getGameState().cheats.disableClearanceChecks) WallRemoveAtZ({ _coords, surfaceHeight }); SurfaceElement* surfaceElement = MapGetSurfaceElementAt(_coords); diff --git a/src/openrct2/command_line/ConvertCommand.cpp b/src/openrct2/command_line/ConvertCommand.cpp index 1846c50fc1..550b7842dc 100644 --- a/src/openrct2/command_line/ConvertCommand.cpp +++ b/src/openrct2/command_line/ConvertCommand.cpp @@ -92,7 +92,7 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato context->Initialise(); auto& objManager = context->GetObjectManager(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); try { diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 6d913a7772..5b6d707a1a 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -1011,7 +1011,7 @@ void UpdatePaletteEffects() uint32_t shade = 0; if (Config::Get().general.RenderWeatherGloom) { - auto paletteId = ClimateGetWeatherGloomPaletteId(GetGameState().WeatherCurrent); + auto paletteId = ClimateGetWeatherGloomPaletteId(getGameState().weatherCurrent); if (paletteId != FilterPaletteID::PaletteNull) { shade = 1; diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index d0b1e9b392..c2b896a9e2 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -835,7 +835,7 @@ namespace OpenRCT2::Drawing::LightFx void ApplyPaletteFilter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); float night = static_cast(pow(gDayNightCycle, 1.5)); @@ -866,9 +866,9 @@ namespace OpenRCT2::Drawing::LightFx // overExpose += ((lightMax - lightAvg) / lightMax) * 0.01f; - if (gameState.WeatherCurrent.temperature > 20) + if (gameState.weatherCurrent.temperature > 20) { - float offset = (static_cast(gameState.WeatherCurrent.temperature - 20)) * 0.04f; + float offset = (static_cast(gameState.weatherCurrent.temperature - 20)) * 0.04f; offset *= 1.0f - night; lightAvg /= 1.0f + offset; // overExpose += offset * 0.1f; @@ -890,12 +890,12 @@ namespace OpenRCT2::Drawing::LightFx natLightB *= 1.0f + overExpose; overExpose *= 255.0f; - float targetFogginess = static_cast(gameState.WeatherCurrent.level) / 8.0f; + float targetFogginess = static_cast(gameState.weatherCurrent.level) / 8.0f; targetFogginess += (night * night) * 0.15f; - if (gameState.WeatherCurrent.temperature < 10) + if (gameState.weatherCurrent.temperature < 10) { - targetFogginess += (static_cast(10 - gameState.WeatherCurrent.temperature)) * 0.01f; + targetFogginess += (static_cast(10 - gameState.weatherCurrent.temperature)) * 0.01f; } fogginess -= (fogginess - targetFogginess) * 0.00001f; @@ -933,7 +933,7 @@ namespace OpenRCT2::Drawing::LightFx natLightG /= 1.0f + lightPolution; natLightB /= 1.0f + lightPolution; - reduceColourLit += static_cast(gameState.WeatherCurrent.level) / 2.0f; + reduceColourLit += static_cast(gameState.weatherCurrent.level) / 2.0f; reduceColourNat /= 1.0f + fogginess; reduceColourLit /= 1.0f + fogginess; diff --git a/src/openrct2/drawing/Weather.cpp b/src/openrct2/drawing/Weather.cpp index 4e1dedbd74..9b426efada 100644 --- a/src/openrct2/drawing/Weather.cpp +++ b/src/openrct2/drawing/Weather.cpp @@ -62,7 +62,7 @@ void DrawWeather(DrawPixelInfo& dpi, IWeatherDrawer* weatherDrawer) if (viewport != nullptr) viewFlags = viewport->flags; - auto weatherLevel = GetGameState().WeatherCurrent.level; + auto weatherLevel = getGameState().weatherCurrent.level; if (weatherLevel == WeatherLevel::None || gTrackDesignSaveMode || (viewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) return; @@ -84,7 +84,7 @@ void DrawWeather(DrawPixelInfo& dpi, IWeatherDrawer* weatherDrawer) static void DrawLightRain( DrawPixelInfo& dpi, IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; int32_t x_start = -static_cast(currentTicks) + 8; int32_t y_start = (currentTicks * 3) + 7; @@ -108,7 +108,7 @@ static void DrawLightRain( static void DrawHeavyRain( DrawPixelInfo& dpi, IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; int32_t x_start = -static_cast(currentTicks); int32_t y_start = currentTicks * 5; @@ -142,7 +142,7 @@ static void DrawHeavyRain( static void DrawLightSnow( DrawPixelInfo& dpi, IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; const uint32_t t = currentTicks / 2; const int32_t negT = -static_cast(t); @@ -166,7 +166,7 @@ static void DrawLightSnow( static void DrawHeavySnow( DrawPixelInfo& dpi, IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; int32_t x_start = -static_cast(currentTicks * 3) + 1; int32_t y_start = currentTicks + 23; diff --git a/src/openrct2/entity/Duck.cpp b/src/openrct2/entity/Duck.cpp index 938344d286..cbcc9116d4 100644 --- a/src/openrct2/entity/Duck.cpp +++ b/src/openrct2/entity/Duck.cpp @@ -89,7 +89,7 @@ void Duck::Remove() void Duck::UpdateFlyToWater() { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if ((currentTicks & 3) != 0) return; @@ -153,7 +153,7 @@ void Duck::UpdateFlyToWater() void Duck::UpdateSwim() { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if (((currentTicks + Id.ToUnderlying()) & 3) != 0) return; @@ -251,7 +251,7 @@ void Duck::UpdateDoubleDrink() void Duck::UpdateFlyAway() { - if ((GetGameState().CurrentTicks & 3) == 0) + if ((getGameState().currentTicks & 3) == 0) { frame++; if (frame >= std::size(kDuckAnimationFlyAway)) diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp index 76c83ba2f8..75b17c538d 100644 --- a/src/openrct2/entity/EntityRegistry.cpp +++ b/src/openrct2/entity/EntityRegistry.cpp @@ -112,9 +112,9 @@ std::string EntitiesChecksum::ToString() const EntityBase* TryGetEntity(EntityId entityIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto idx = entityIndex.ToUnderlying(); - return idx >= kMaxEntities ? nullptr : &gameState.Entities[idx].base; + return idx >= kMaxEntities ? nullptr : &gameState.entities[idx].base; } EntityBase* GetEntity(EntityId entityIndex) @@ -175,8 +175,8 @@ void ResetAllEntities() FreeEntity(*spr); } - auto& gameState = GetGameState(); - std::fill(std::begin(gameState.Entities), std::end(gameState.Entities), Entity_t()); + auto& gameState = getGameState(); + std::fill(std::begin(gameState.entities), std::end(gameState.entities), Entity_t()); OpenRCT2::RideUse::GetHistory().Clear(); OpenRCT2::RideUse::GetTypeHistory().Clear(); for (int32_t i = 0; i < kMaxEntities; ++i) diff --git a/src/openrct2/entity/Fountain.cpp b/src/openrct2/entity/Fountain.cpp index 98f72e2888..ee92726905 100644 --- a/src/openrct2/entity/Fountain.cpp +++ b/src/openrct2/entity/Fountain.cpp @@ -90,7 +90,7 @@ bool EntityBase::Is() const void JumpingFountain::StartAnimation(const JumpingFountainType newType, const CoordsXY& newLoc, const TileElement* tileElement) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; int32_t randomIndex; auto newZ = tileElement->GetBaseZ(); diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index c1fc65b194..e34e46f2f9 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -916,7 +916,7 @@ void Guest::UpdateConsumptionMotives() void Guest::Tick128UpdateGuest(uint32_t index) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if ((index & 0x1FF) != (currentTicks & 0x1FF)) { UpdateConsumptionMotives(); @@ -1102,7 +1102,7 @@ void Guest::Tick128UpdateGuest(uint32_t index) possible_thoughts[num_thoughts++] = PeepThoughtType::Toilet; } - if (!(GetGameState().Park.Flags & 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) { /* The energy check was originally a second check on happiness. @@ -1495,11 +1495,11 @@ static money64 getItemValue(const ShopItemDescriptor& shopItemDescriptor) return shopItemDescriptor.BaseValue; const auto& thresholds = climateObj->getItemThresholds(); - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); - if (gameState.WeatherCurrent.temperature >= thresholds.warm) + if (gameState.weatherCurrent.temperature >= thresholds.warm) return shopItemDescriptor.HotValue; - else if (gameState.WeatherCurrent.temperature <= thresholds.cold) + else if (gameState.weatherCurrent.temperature <= thresholds.cold) return shopItemDescriptor.ColdValue; else return shopItemDescriptor.BaseValue; @@ -1557,8 +1557,8 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price) return false; } - auto& gameState = GetGameState(); - if ((shopItem == ShopItem::Sunglasses || shopItem == ShopItem::IceCream) && gameState.WeatherCurrent.temperature < 12) + auto& gameState = getGameState(); + if ((shopItem == ShopItem::Sunglasses || shopItem == ShopItem::IceCream) && gameState.weatherCurrent.temperature < 12) { return false; } @@ -1583,7 +1583,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price) if (!hasVoucher) { - if (price != 0 && !(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (price != 0 && !(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { if (CashInPocket == 0) { @@ -1611,7 +1611,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price) if (Happiness >= 180) itemValue /= 2; } - if (itemValue > (static_cast(ScenarioRand() & 0x07)) && !(GetGameState().Cheats.ignorePrice)) + if (itemValue > (static_cast(ScenarioRand() & 0x07)) && !(getGameState().cheats.ignorePrice)) { // "I'm not paying that much for x" InsertNewThought(shopItemDescriptor.TooMuchThought, ride.id); @@ -1624,7 +1624,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price) itemValue -= price; itemValue = std::max(0.80_GBP, itemValue); - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { if (itemValue >= static_cast(ScenarioRand() & 0x07)) { @@ -1724,7 +1724,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price) expenditure = ExpenditureType::FoodDrinkStock; } - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) FinancePayment(shopItemDescriptor.Cost, expenditure); // Sets the expenditure type to *_FOODDRINK_SALES or *_SHOP_SALES appropriately. @@ -1734,7 +1734,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price) RemoveItem(ShopItem::Voucher); WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY; } - else if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + else if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { SpendMoney(*expend_type, price, expenditure); } @@ -2034,9 +2034,9 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b return false; } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Basic price checks - if (ridePrice != 0 && !PeepHasVoucherForFreeRide(this, ride) && !(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (ridePrice != 0 && !PeepHasVoucherForFreeRide(this, ride) && !(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { if (ridePrice > CashInPocket) { @@ -2078,7 +2078,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // excitement check and will only do a basic intensity check when they arrive at the ride itself. if (ride.id == GuestHeadingToRideId) { - if (ride.ratings.intensity > MakeRideRating(10, 00) && !GetGameState().Cheats.ignoreRideIntensity) + if (ride.ratings.intensity > MakeRideRating(10, 00) && !getGameState().cheats.ignoreRideIntensity) { PeepRideIsTooIntense(this, ride, peepAtRide); return false; @@ -2105,7 +2105,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // ride intensity check and get me on a sheltered ride! if (!isPrecipitating || !ShouldRideWhileRaining(ride)) { - if (!GetGameState().Cheats.ignoreRideIntensity) + if (!getGameState().cheats.ignoreRideIntensity) { // Intensity calculations. Even though the max intensity can go up to 15, it's capped // at 10.0 (before happiness calculations). A full happiness bar will increase the max @@ -2171,7 +2171,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b return false; } - if (!GetGameState().Cheats.ignoreRideIntensity) + if (!getGameState().cheats.ignoreRideIntensity) { if (ride.maxPositiveVerticalG > MakeFixed16_2dp(5, 00) || ride.maxNegativeVerticalG < MakeFixed16_2dp(-4, 00) || ride.maxLateralG > MakeFixed16_2dp(4, 00)) @@ -2186,7 +2186,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 (value != kRideValueUndefined && !PeepHasVoucherForFreeRide(this, ride) - && !(gameState.Park.Flags & 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. if (PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY) @@ -2194,7 +2194,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // Peeps won't pay more than twice the value of the ride. ridePrice = RideGetPrice(ride); - if ((ridePrice > (value * 2)) && !(gameState.Cheats.ignorePrice)) + if ((ridePrice > (value * 2)) && !(gameState.cheats.ignorePrice)) { if (peepAtRide) { @@ -2212,7 +2212,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. if (ridePrice <= (value / 2) && peepAtRide) { - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { if (!(PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY)) { @@ -2262,7 +2262,7 @@ bool Guest::ShouldGoToShop(Ride& ride, bool peepAtShop) // The amount that peeps are willing to pay to use the Toilets scales with their toilet stat. // It effectively has a minimum of $0.10 (due to the check above) and a maximum of $0.60. - if ((RideGetPrice(ride) * 40 > Toilet) && !GetGameState().Cheats.ignorePrice) + if ((RideGetPrice(ride) * 40 > Toilet) && !getGameState().cheats.ignorePrice) { if (peepAtShop) { @@ -2331,7 +2331,7 @@ void Guest::SpendMoney(money64 amount, ExpenditureType expenditure) */ void Guest::SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureType expenditure) { - assert(!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)); + assert(!(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)); CashInPocket = std::max(0.00_GBP, static_cast(CashInPocket) - amount); CashSpent += amount; @@ -2648,7 +2648,7 @@ static bool PeepCheckRidePriceAtEntrance(Guest* peep, const Ride& ride, money64 && peep->VoucherRideId == peep->CurrentRide) return true; - if (peep->CashInPocket <= 0 && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (peep->CashInPocket <= 0 && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { peep->InsertNewThought(PeepThoughtType::SpentMoney); PeepUpdateRideAtEntranceTryLeave(peep); @@ -2671,7 +2671,7 @@ static bool PeepCheckRidePriceAtEntrance(Guest* peep, const Ride& ride, money64 auto value = ride.value; if (value != kRideValueUndefined) { - if (((value * 2) < ridePrice) && !(GetGameState().Cheats.ignorePrice)) + if (((value * 2) < ridePrice) && !(getGameState().cheats.ignorePrice)) { peep->InsertNewThought(PeepThoughtType::BadValue, peep->CurrentRide); PeepUpdateRideAtEntranceTryLeave(peep); @@ -2742,7 +2742,7 @@ static void GuestUpdateFavouriteRide(Guest& peep, const Ride& ride, uint8_t sati /* rct2: 0x00695555 */ static int16_t PeepCalculateRideValueSatisfaction(Guest* peep, const Ride& ride) { - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) { return -30; } @@ -2887,7 +2887,7 @@ static bool PeepShouldGoOnRideAgain(Guest* peep, const Ride& ride) return false; if (!RideHasRatings(ride)) return false; - if (ride.ratings.intensity > MakeRideRating(10, 00) && !GetGameState().Cheats.ignoreRideIntensity) + if (ride.ratings.intensity > MakeRideRating(10, 00) && !getGameState().cheats.ignoreRideIntensity) return false; if (peep->Happiness < 180) return false; @@ -2916,7 +2916,7 @@ static bool PeepShouldGoOnRideAgain(Guest* peep, const Ride& ride) static bool PeepShouldPreferredIntensityIncrease(Guest* peep) { - if (GetGameState().Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) + if (getGameState().park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) return false; if (peep->Happiness < 200) return false; @@ -2932,7 +2932,7 @@ static bool PeepReallyLikedRide(Guest* peep, const Ride& ride) return false; if (!RideHasRatings(ride)) return false; - if (ride.ratings.intensity > MakeRideRating(10, 00) && !GetGameState().Cheats.ignoreRideIntensity) + if (ride.ratings.intensity > MakeRideRating(10, 00) && !getGameState().cheats.ignoreRideIntensity) return false; return true; } @@ -3051,7 +3051,7 @@ static PeepThoughtType PeepAssessSurroundings(int16_t centre_x, int16_t centre_y if (nearby_music == 1 && num_rubbish < 20) return PeepThoughtType::Music; - if (num_rubbish < 2 && !GetGameState().Cheats.disableLittering) + if (num_rubbish < 2 && !getGameState().cheats.disableLittering) // if disable littering cheat is enabled, peeps will not have the "clean and tidy park" thought return PeepThoughtType::VeryClean; @@ -3086,7 +3086,7 @@ static void PeepDecideWhetherToLeavePark(Guest* peep) peep->EnergyTarget -= 2; } - if (GetGameState().WeatherCurrent.temperature >= 21 && peep->Thirst >= 5) + if (getGameState().weatherCurrent.temperature >= 21 && peep->Thirst >= 5) { peep->Thirst--; } @@ -3101,7 +3101,7 @@ static void PeepDecideWhetherToLeavePark(Guest* peep) * in the park. */ if (!(peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK)) { - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) { if (peep->Energy >= 70 && peep->Happiness >= 60) { @@ -3339,7 +3339,7 @@ void Guest::StopPurchaseThought(ride_type_t rideType) */ static bool PeepShouldUseCashMachine(Guest* peep, RideId rideIndex) { - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) return false; if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) return false; @@ -3608,7 +3608,7 @@ void PeepUpdateRideLeaveEntranceSpiralSlide(Guest* peep, Ride& ride, CoordsXYZD& void PeepUpdateRideLeaveEntranceDefault(Guest* peep, Ride& ride, CoordsXYZD& entrance_loc) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; // If the ride type was changed guests will become stuck. // Inform the player about this if its a new issue or hasn't been addressed within 120 seconds. @@ -5336,7 +5336,7 @@ void Guest::UpdateWalking() if (!CheckForPath()) return; - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if (!IsOnLevelCrossing()) { @@ -5756,7 +5756,7 @@ void Guest::UpdateEnteringPark() SetState(PeepState::Falling); OutsideOfPark = false; - ParkEntryTime = GetGameState().CurrentTicks; + ParkEntryTime = getGameState().currentTicks; IncrementGuestsInPark(); DecrementGuestsHeadingForPark(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); @@ -6236,7 +6236,7 @@ static PathElement* FindBreakableElement(const CoordsXYZ& loc) */ static void PeepUpdateWalkingBreakScenery(Guest* peep) { - if (GetGameState().Cheats.disableVandalism) + if (getGameState().cheats.disableVandalism) return; if (!(peep->PeepFlags & PEEP_FLAGS_ANGRY)) @@ -7150,7 +7150,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) if (GetNumFreeEntities() < 400) return nullptr; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); Guest* peep = CreateEntity(); peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Guest); @@ -7191,9 +7191,9 @@ Guest* Guest::Generate(const CoordsXYZ& coords) /* Check which intensity boxes are enabled * and apply the appropriate intensity settings. */ - if (gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) + if (gameState.park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) { - if (gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) + if (gameState.park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) { intensityLowest = 0; intensityHighest = 15; @@ -7204,7 +7204,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) intensityHighest = 4; } } - else if (gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) + else if (gameState.park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) { intensityLowest = 9; intensityHighest = 15; @@ -7213,7 +7213,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) peep->Intensity = IntensityRange(intensityLowest, intensityHighest); uint8_t nauseaTolerance = ScenarioRand() & 0x7; - if (gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) + if (gameState.park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) { nauseaTolerance += 4; } @@ -7223,10 +7223,10 @@ Guest* Guest::Generate(const CoordsXYZ& coords) /* Scenario editor limits initial guest happiness to between 37..253. * To be on the safe side, assume the value could have been hacked * to any value 0..255. */ - peep->Happiness = gameState.GuestInitialHappiness; + peep->Happiness = gameState.guestInitialHappiness; /* Assume a default initial happiness of 0 is wrong and set * to 128 (50%) instead. */ - if (gameState.GuestInitialHappiness == 0) + if (gameState.guestInitialHappiness == 0) peep->Happiness = 128; /* Initial value will vary by -15..16 */ int8_t happinessDelta = (ScenarioRand() & 0x1F) - 15; @@ -7239,7 +7239,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) /* Scenario editor limits initial guest hunger to between 37..253. * To be on the safe side, assume the value could have been hacked * to any value 0..255. */ - peep->Hunger = gameState.GuestInitialHunger; + peep->Hunger = gameState.guestInitialHunger; /* Initial value will vary by -15..16 */ int8_t hungerDelta = (ScenarioRand() & 0x1F) - 15; /* Adjust by the delta, clamping at min=0 and max=255. */ @@ -7248,7 +7248,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) /* Scenario editor limits initial guest thirst to between 37..253. * To be on the safe side, assume the value could have been hacked * to any value 0..255. */ - peep->Thirst = gameState.GuestInitialThirst; + peep->Thirst = gameState.guestInitialThirst; /* Initial value will vary by -15..16 */ int8_t thirstDelta = (ScenarioRand() & 0x1F) - 15; /* Adjust by the delta, clamping at min=0 and max=255. */ @@ -7258,24 +7258,24 @@ Guest* Guest::Generate(const CoordsXYZ& coords) peep->TimeToConsume = 0; peep->GuestNumRides = 0; - peep->PeepId = gameState.NextGuestNumber++; + peep->PeepId = gameState.nextGuestNumber++; peep->Name = nullptr; - money64 cash = (static_cast(ScenarioRand() & 0x3) * 100) - 100 + gameState.GuestInitialCash; + money64 cash = (static_cast(ScenarioRand() & 0x3) * 100) - 100 + gameState.guestInitialCash; if (cash < 0) cash = 0; - if (gameState.GuestInitialCash == 0.00_GBP) + if (gameState.guestInitialCash == 0.00_GBP) { cash = 500; } - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { cash = 0; } - if (gameState.GuestInitialCash == kMoney64Undefined) + if (gameState.guestInitialCash == kMoney64Undefined) { cash = 0; } diff --git a/src/openrct2/entity/Litter.cpp b/src/openrct2/entity/Litter.cpp index ef2f20c01d..344c1b09ac 100644 --- a/src/openrct2/entity/Litter.cpp +++ b/src/openrct2/entity/Litter.cpp @@ -53,8 +53,8 @@ static bool IsLocationLitterable(const CoordsXYZ& mapPos) */ void Litter::Create(const CoordsXYZD& litterPos, Type type) { - auto& gameState = GetGameState(); - if (gameState.Cheats.disableLittering) + auto& gameState = getGameState(); + if (gameState.cheats.disableLittering) return; auto offsetLitterPos = litterPos @@ -94,7 +94,7 @@ void Litter::Create(const CoordsXYZD& litterPos, Type type) litter->SpriteData.HeightMax = 3; litter->SubType = type; litter->MoveTo(offsetLitterPos); - litter->creationTick = gameState.CurrentTicks; + litter->creationTick = gameState.currentTicks; } /** @@ -147,7 +147,7 @@ StringId Litter::GetName() const uint32_t Litter::GetAge() const { - return GetGameState().CurrentTicks - creationTick; + return getGameState().currentTicks - creationTick; } void Litter::Serialise(DataSerialiser& stream) diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 207e9ed00d..3a1b032fd9 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -203,7 +203,7 @@ void PeepUpdateAll() if (isInEditorMode()) return; - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; constexpr auto kTicks128Mask = 128u - 1u; const auto currentTicksMasked = currentTicks & kTicks128Mask; @@ -786,8 +786,8 @@ void Peep::UpdateFalling() News::AddItemToQueue(News::ItemType::Blank, STR_NEWS_ITEM_GUEST_DROWNED, x | (y << 16), ft); } - auto& gameState = GetGameState(); - gameState.Park.RatingCasualtyPenalty = std::min(gameState.Park.RatingCasualtyPenalty + 25, 1000); + auto& gameState = getGameState(); + gameState.park.RatingCasualtyPenalty = std::min(gameState.park.RatingCasualtyPenalty + 25, 1000); Remove(); return; } @@ -918,7 +918,7 @@ void Peep::SetState(PeepState new_state) */ void Peep::UpdatePicked() { - if (GetGameState().CurrentTicks & 0x1F) + if (getGameState().currentTicks & 0x1F) return; SubState++; auto* guest = As(); @@ -999,7 +999,7 @@ void Peep::Update() if (!(PeepFlags & PEEP_FLAGS_ANIMATION_FROZEN)) { // This is circumventing other logic, so only update every few ticks - if ((GetGameState().CurrentTicks & 3) == 0) + if ((getGameState().currentTicks & 3) == 0) { if (IsActionWalking()) UpdateWalkingAnimation(); @@ -1101,12 +1101,12 @@ void Peep::Update() */ void PeepProblemWarningsUpdate() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); Ride* ride; uint32_t hungerCounter = 0, lostCounter = 0, noexitCounter = 0, thirstCounter = 0, litterCounter = 0, disgustCounter = 0, toiletCounter = 0, vandalismCounter = 0; - uint8_t* warningThrottle = gameState.PeepWarningThrottle; + uint8_t* warningThrottle = gameState.peepWarningThrottle; int32_t inQueueCounter = 0; int32_t tooLongQueueCounter = 0; @@ -1186,7 +1186,7 @@ void PeepProblemWarningsUpdate() // could maybe be packed into a loop, would lose a lot of clarity though if (warningThrottle[0]) --warningThrottle[0]; - else if (hungerCounter >= kPeepHungerWarningThreshold && hungerCounter >= gameState.NumGuestsInPark / 16) + else if (hungerCounter >= kPeepHungerWarningThreshold && hungerCounter >= gameState.numGuestsInPark / 16) { warningThrottle[0] = 4; if (Config::Get().notifications.GuestWarnings) @@ -1198,7 +1198,7 @@ void PeepProblemWarningsUpdate() if (warningThrottle[1]) --warningThrottle[1]; - else if (thirstCounter >= kPeepThirstWarningThreshold && thirstCounter >= gameState.NumGuestsInPark / 16) + else if (thirstCounter >= kPeepThirstWarningThreshold && thirstCounter >= gameState.numGuestsInPark / 16) { warningThrottle[1] = 4; if (Config::Get().notifications.GuestWarnings) @@ -1210,7 +1210,7 @@ void PeepProblemWarningsUpdate() if (warningThrottle[2]) --warningThrottle[2]; - else if (toiletCounter >= kPeepToiletWarningThreshold && toiletCounter >= gameState.NumGuestsInPark / 16) + else if (toiletCounter >= kPeepToiletWarningThreshold && toiletCounter >= gameState.numGuestsInPark / 16) { warningThrottle[2] = 4; if (Config::Get().notifications.GuestWarnings) @@ -1222,7 +1222,7 @@ void PeepProblemWarningsUpdate() if (warningThrottle[3]) --warningThrottle[3]; - else if (litterCounter >= kPeepLitterWarningThreshold && litterCounter >= gameState.NumGuestsInPark / 32) + else if (litterCounter >= kPeepLitterWarningThreshold && litterCounter >= gameState.numGuestsInPark / 32) { warningThrottle[3] = 4; if (Config::Get().notifications.GuestWarnings) @@ -1234,7 +1234,7 @@ void PeepProblemWarningsUpdate() if (warningThrottle[4]) --warningThrottle[4]; - else if (disgustCounter >= kPeepDisgustWarningThreshold && disgustCounter >= gameState.NumGuestsInPark / 32) + else if (disgustCounter >= kPeepDisgustWarningThreshold && disgustCounter >= gameState.numGuestsInPark / 32) { warningThrottle[4] = 4; if (Config::Get().notifications.GuestWarnings) @@ -1246,7 +1246,7 @@ void PeepProblemWarningsUpdate() if (warningThrottle[5]) --warningThrottle[5]; - else if (vandalismCounter >= kPeepVandalismWarningThreshold && vandalismCounter >= gameState.NumGuestsInPark / 32) + else if (vandalismCounter >= kPeepVandalismWarningThreshold && vandalismCounter >= gameState.numGuestsInPark / 32) { warningThrottle[5] = 4; if (Config::Get().notifications.GuestWarnings) @@ -1619,9 +1619,9 @@ void Peep::FormatNameTo(Formatter& ft) const { if (Name == nullptr) { - auto& gameState = GetGameState(); - const bool showGuestNames = gameState.Park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES; - const bool showStaffNames = gameState.Park.Flags & PARK_FLAGS_SHOW_REAL_STAFF_NAMES; + auto& gameState = getGameState(); + const bool showGuestNames = gameState.park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + const bool showStaffNames = gameState.park.Flags & PARK_FLAGS_SHOW_REAL_STAFF_NAMES; auto* staff = As(); const bool isStaff = staff != nullptr; @@ -1895,7 +1895,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_ return true; } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); uint8_t entranceDirection = tile_element->GetDirection(); if (entranceDirection != guest->PeepDirection) { @@ -1915,7 +1915,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_ if (!(guest->PeepFlags & PEEP_FLAGS_LEAVING_PARK)) { // If the park is open and leaving flag isn't set return to centre - if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) + if (gameState.park.Flags & PARK_FLAGS_PARK_OPEN) { PeepReturnToCentreOfTile(guest); return true; @@ -1948,7 +1948,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_ return true; } - if (!(gameState.Park.Flags & PARK_FLAGS_PARK_OPEN)) + if (!(gameState.park.Flags & PARK_FLAGS_PARK_OPEN)) { guest->State = PeepState::LeavingPark; guest->Var37 = 1; @@ -1959,10 +1959,10 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_ } bool found = false; - auto entrance = std::find_if(gameState.Park.Entrances.begin(), gameState.Park.Entrances.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; }); - if (entrance != gameState.Park.Entrances.end()) + if (entrance != gameState.park.Entrances.end()) { int16_t z = entrance->z / 8; entranceDirection = entrance->direction; @@ -2049,12 +2049,12 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_ return true; } - gameState.TotalIncomeFromAdmissions += entranceFee; + gameState.totalIncomeFromAdmissions += entranceFee; guest->SpendMoney(guest->PaidToEnter, entranceFee, ExpenditureType::ParkEntranceTickets); guest->PeepFlags |= PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY; } - GetGameState().TotalAdmissions++; + getGameState().totalAdmissions++; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByNumber(WindowClass::ParkInformation, 0); @@ -2399,7 +2399,7 @@ static bool PeepInteractWithShop(Peep* peep, const CoordsXYE& coords) } auto cost = ride->price[0]; - if (cost != 0 && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (cost != 0 && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { ride->totalProfit += cost; ride->windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_INCOME; @@ -2665,7 +2665,7 @@ int32_t PeepCompare(const EntityId sprite_index_a, const EntityId sprite_index_b if (peep_a->Name == nullptr && peep_b->Name == nullptr) { - if (GetGameState().Park.Flags & 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 } @@ -2695,18 +2695,18 @@ int32_t PeepCompare(const EntityId sprite_index_a, const EntityId sprite_index_b */ void PeepUpdateNames() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto& config = Config::Get().general; if (config.ShowRealNamesOfGuests) - gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + gameState.park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; else - gameState.Park.Flags &= ~PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + gameState.park.Flags &= ~PARK_FLAGS_SHOW_REAL_GUEST_NAMES; if (config.ShowRealNamesOfStaff) - gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_STAFF_NAMES; + gameState.park.Flags |= PARK_FLAGS_SHOW_REAL_STAFF_NAMES; else - gameState.Park.Flags &= ~PARK_FLAGS_SHOW_REAL_STAFF_NAMES; + gameState.park.Flags &= ~PARK_FLAGS_SHOW_REAL_STAFF_NAMES; auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST); ContextBroadcastIntent(&intent); @@ -2715,10 +2715,10 @@ void PeepUpdateNames() void IncrementGuestsInPark() { - auto& gameState = GetGameState(); - if (gameState.NumGuestsInPark < UINT32_MAX) + auto& gameState = getGameState(); + if (gameState.numGuestsInPark < UINT32_MAX) { - gameState.NumGuestsInPark++; + gameState.numGuestsInPark++; } else { @@ -2728,10 +2728,10 @@ void IncrementGuestsInPark() void IncrementGuestsHeadingForPark() { - auto& gameState = GetGameState(); - if (gameState.NumGuestsHeadingForPark < UINT32_MAX) + auto& gameState = getGameState(); + if (gameState.numGuestsHeadingForPark < UINT32_MAX) { - gameState.NumGuestsHeadingForPark++; + gameState.numGuestsHeadingForPark++; } else { @@ -2741,10 +2741,10 @@ void IncrementGuestsHeadingForPark() void DecrementGuestsInPark() { - auto& gameState = GetGameState(); - if (gameState.NumGuestsInPark > 0) + auto& gameState = getGameState(); + if (gameState.numGuestsInPark > 0) { - gameState.NumGuestsInPark--; + gameState.numGuestsInPark--; } else { @@ -2754,11 +2754,11 @@ void DecrementGuestsInPark() void DecrementGuestsHeadingForPark() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.NumGuestsHeadingForPark > 0) + if (gameState.numGuestsHeadingForPark > 0) { - gameState.NumGuestsHeadingForPark--; + gameState.numGuestsHeadingForPark--; } else { diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index bf729b7966..bcbbb975a1 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -478,7 +478,7 @@ bool Staff::DoHandymanPathFinding() Direction litterDirection = INVALID_DIRECTION; uint8_t validDirections = GetValidPatrolDirections(NextLoc); - if ((StaffOrders & STAFF_ORDERS_SWEEPING) && ((GetGameState().CurrentTicks + Id.ToUnderlying()) & 0xFFF) > 110) + if ((StaffOrders & STAFF_ORDERS_SWEEPING) && ((getGameState().currentTicks + Id.ToUnderlying()) & 0xFFF) > 110) { litterDirection = HandymanDirectionToNearestLitter(); } @@ -950,15 +950,15 @@ int32_t Staff::GetHireDate() const colour_t StaffGetColour(StaffType staffType) { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); switch (staffType) { case StaffType::Handyman: - return gameState.StaffHandymanColour; + return gameState.staffHandymanColour; case StaffType::Mechanic: - return gameState.StaffMechanicColour; + return gameState.staffMechanicColour; case StaffType::Security: - return gameState.StaffSecurityColour; + return gameState.staffSecurityColour; case StaffType::Entertainer: return 0; default: @@ -969,17 +969,17 @@ colour_t StaffGetColour(StaffType staffType) GameActions::Result StaffSetColour(StaffType staffType, colour_t value) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); switch (staffType) { case StaffType::Handyman: - gameState.StaffHandymanColour = value; + gameState.staffHandymanColour = value; break; case StaffType::Mechanic: - gameState.StaffMechanicColour = value; + gameState.staffMechanicColour = value; break; case StaffType::Security: - gameState.StaffSecurityColour = value; + gameState.staffSecurityColour = value; break; default: return GameActions::Result( diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 138093cb60..b9f240ae1f 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -203,7 +203,7 @@ static void ConsoleCommandRides(InteractiveConsole& console, const arguments_t& auto res = SetOperatingSetting(RideId::FromUnderlying(ride_index), RideSetSetting::RideType, type); if (res == kMoney64Undefined) { - if (!GetGameState().Cheats.allowArbitraryRideTypeChanges) + if (!getGameState().cheats.allowArbitraryRideTypeChanges) { console.WriteFormatLine( "That didn't work. Try enabling the 'Allow arbitrary ride type changes' cheat"); @@ -543,62 +543,62 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t& static void ConsoleCommandGet(InteractiveConsole& console, const arguments_t& argv) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (!argv.empty()) { if (argv[0] == "park_rating") { - console.WriteFormatLine("park_rating %d", gameState.Park.Rating); + console.WriteFormatLine("park_rating %d", gameState.park.Rating); } else if (argv[0] == "park_value") { - console.WriteLine(FormatString("park_value {CURRENCY2DP}", gameState.Park.Value)); + console.WriteLine(FormatString("park_value {CURRENCY2DP}", gameState.park.Value)); } else if (argv[0] == "company_value") { - console.WriteLine(FormatString("company_value {CURRENCY2DP}", gameState.CompanyValue)); + console.WriteLine(FormatString("company_value {CURRENCY2DP}", gameState.companyValue)); } else if (argv[0] == "money") { - console.WriteLine(FormatString("money {CURRENCY2DP}", gameState.Cash)); + console.WriteLine(FormatString("money {CURRENCY2DP}", gameState.cash)); } else if (argv[0] == "scenario_initial_cash") { - console.WriteLine(FormatString("scenario_initial_cash {CURRENCY2DP}", gameState.InitialCash)); + console.WriteLine(FormatString("scenario_initial_cash {CURRENCY2DP}", gameState.initialCash)); } else if (argv[0] == "current_loan") { - console.WriteLine(FormatString("current_loan {CURRENCY2DP}", gameState.BankLoan)); + console.WriteLine(FormatString("current_loan {CURRENCY2DP}", gameState.bankLoan)); } else if (argv[0] == "max_loan") { - console.WriteLine(FormatString("max_loan {CURRENCY2DP}", gameState.MaxBankLoan)); + console.WriteLine(FormatString("max_loan {CURRENCY2DP}", gameState.maxBankLoan)); } else if (argv[0] == "guest_initial_cash") { - console.WriteLine(FormatString("guest_initial_cash {CURRENCY2DP}", gameState.GuestInitialCash)); + console.WriteLine(FormatString("guest_initial_cash {CURRENCY2DP}", gameState.guestInitialCash)); } else if (argv[0] == "land_rights_cost") { - console.WriteLine(FormatString("land_rights_cost {CURRENCY2DP}", gameState.LandPrice)); + console.WriteLine(FormatString("land_rights_cost {CURRENCY2DP}", gameState.landPrice)); } else if (argv[0] == "construction_rights_cost") { - console.WriteLine(FormatString("construction_rights_cost {CURRENCY2DP}", gameState.ConstructionRightsPrice)); + console.WriteLine(FormatString("construction_rights_cost {CURRENCY2DP}", gameState.constructionRightsPrice)); } else if (argv[0] == "guest_initial_happiness") { - uint32_t current_happiness = gameState.GuestInitialHappiness; + uint32_t current_happiness = gameState.guestInitialHappiness; for (int32_t i = 15; i <= 99; i++) { if (i == 99) { - console.WriteFormatLine("guest_initial_happiness %d%% (%d)", 15, gameState.GuestInitialHappiness); + console.WriteFormatLine("guest_initial_happiness %d%% (%d)", 15, gameState.guestInitialHappiness); } 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; } } @@ -606,64 +606,64 @@ static void ConsoleCommandGet(InteractiveConsole& console, const arguments_t& ar else if (argv[0] == "guest_initial_hunger") { console.WriteFormatLine( - "guest_initial_hunger %d%% (%d)", ((255 - gameState.GuestInitialHunger) * 100) / 255, - gameState.GuestInitialHunger); + "guest_initial_hunger %d%% (%d)", ((255 - gameState.guestInitialHunger) * 100) / 255, + gameState.guestInitialHunger); } else if (argv[0] == "guest_initial_thirst") { console.WriteFormatLine( - "guest_initial_thirst %d%% (%d)", ((255 - gameState.GuestInitialThirst) * 100) / 255, - gameState.GuestInitialThirst); + "guest_initial_thirst %d%% (%d)", ((255 - gameState.guestInitialThirst) * 100) / 255, + gameState.guestInitialThirst); } else if (argv[0] == "guest_prefer_less_intense_rides") { console.WriteFormatLine( - "guest_prefer_less_intense_rides %d", (gameState.Park.Flags & 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") { console.WriteFormatLine( - "guest_prefer_more_intense_rides %d", (gameState.Park.Flags & 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") { console.WriteFormatLine( - "forbid_marketing_campaigns %d", (gameState.Park.Flags & 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") { console.WriteFormatLine( - "forbid_landscape_changes %d", (gameState.Park.Flags & 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") { - console.WriteFormatLine("forbid_tree_removal %d", (gameState.Park.Flags & 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") { console.WriteFormatLine( - "forbid_high_construction %d", (gameState.Park.Flags & 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") { - console.WriteFormatLine("pay_for_rides %d", (gameState.Park.Flags & 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") { - console.WriteFormatLine("no_money %d", (gameState.Park.Flags & 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") { - console.WriteFormatLine("difficult_park_rating %d", (gameState.Park.Flags & 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") { console.WriteFormatLine( - "difficult_guest_generation %d", (gameState.Park.Flags & 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") { - console.WriteFormatLine("park_open %d", (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) != 0); + console.WriteFormatLine("park_open %d", (gameState.park.Flags & PARK_FLAGS_PARK_OPEN) != 0); } else if (argv[0] == "game_speed") { @@ -704,15 +704,15 @@ static void ConsoleCommandGet(InteractiveConsole& console, const arguments_t& ar } else if (argv[0] == "cheat_sandbox_mode") { - console.WriteFormatLine("cheat_sandbox_mode %d", GetGameState().Cheats.sandboxMode); + console.WriteFormatLine("cheat_sandbox_mode %d", getGameState().cheats.sandboxMode); } else if (argv[0] == "cheat_disable_clearance_checks") { - console.WriteFormatLine("cheat_disable_clearance_checks %d", GetGameState().Cheats.disableClearanceChecks); + console.WriteFormatLine("cheat_disable_clearance_checks %d", getGameState().cheats.disableClearanceChecks); } else if (argv[0] == "cheat_disable_support_limits") { - console.WriteFormatLine("cheat_disable_support_limits %d", GetGameState().Cheats.disableSupportLimits); + console.WriteFormatLine("cheat_disable_support_limits %d", getGameState().cheats.disableSupportLimits); } else if (argv[0] == "current_rotation") { @@ -778,11 +778,11 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar std::string varName = argv[0]; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (varName == "money" && InvalidArguments(&invalidArgs, double_valid[0])) { money64 money = ToMoney64FromGBP(double_val[0]); - if (gameState.Cash != money) + if (gameState.cash != money) { ConsoleSetVariableAction(console, varName, CheatType::SetMoney, money); } @@ -800,7 +800,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar else if (varName == "current_loan" && InvalidArguments(&invalidArgs, int_valid[0])) { auto amount = std::clamp( - ToMoney64FromGBP(int_val[0]) - ToMoney64FromGBP(int_val[0] % 1000), 0.00_GBP, gameState.MaxBankLoan); + ToMoney64FromGBP(int_val[0]) - ToMoney64FromGBP(int_val[0] % 1000), 0.00_GBP, gameState.maxBankLoan); ConsoleSetVariableAction(console, varName, ScenarioSetSetting::InitialLoan, amount); } else if (varName == "max_loan" && InvalidArguments(&invalidArgs, int_valid[0])) @@ -865,7 +865,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar } else if (varName == "pay_for_rides" && InvalidArguments(&invalidArgs, int_valid[0])) { - SET_FLAG(gameState.Park.Flags, 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"); } else if (varName == "no_money" && InvalidArguments(&invalidArgs, int_valid[0])) @@ -950,7 +950,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar } else if (varName == "cheat_sandbox_mode" && InvalidArguments(&invalidArgs, int_valid[0])) { - if (GetGameState().Cheats.sandboxMode != (int_val[0] != 0)) + if (getGameState().cheats.sandboxMode != (int_val[0] != 0)) { ConsoleSetVariableAction(console, varName, CheatType::SandboxMode, int_val[0] != 0); } @@ -961,7 +961,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar } else if (varName == "cheat_disable_clearance_checks" && InvalidArguments(&invalidArgs, int_valid[0])) { - if (GetGameState().Cheats.disableClearanceChecks != (int_val[0] != 0)) + if (getGameState().cheats.disableClearanceChecks != (int_val[0] != 0)) { ConsoleSetVariableAction(console, varName, CheatType::DisableClearanceChecks, int_val[0] != 0); } @@ -972,7 +972,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar } else if (varName == "cheat_disable_support_limits" && InvalidArguments(&invalidArgs, int_valid[0])) { - if (GetGameState().Cheats.disableSupportLimits != (int_val[0] != 0)) + if (getGameState().cheats.disableSupportLimits != (int_val[0] != 0)) { ConsoleSetVariableAction(console, varName, CheatType::DisableSupportLimits, int_val[0] != 0); } diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 1ba5381434..390e969726 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -112,7 +112,7 @@ void ScreenshotCheck() static std::string ScreenshotGetParkName() { - return GetGameState().Park.Name; + return getGameState().park.Name; } static std::string ScreenshotGetDirectory() @@ -257,25 +257,25 @@ static void ReleaseDPI(DrawPixelInfo& dpi) static Viewport GetGiantViewport(int32_t rotation, ZoomLevel zoom) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Get the tile coordinates of each corner const TileCoordsXY cornerCoords[2][4] = { { // Map corners { 1, 1 }, - { gameState.MapSize.x - 2, gameState.MapSize.y - 2 }, - { 1, gameState.MapSize.y - 2 }, - { gameState.MapSize.x - 2, 1 }, + { gameState.mapSize.x - 2, gameState.mapSize.y - 2 }, + { 1, gameState.mapSize.y - 2 }, + { gameState.mapSize.x - 2, 1 }, }, { // Horizontal view clipping corners TileCoordsXY{ CoordsXY{ std::max(gClipSelectionA.x, 32), std::max(gClipSelectionA.y, 32) } }, - TileCoordsXY{ CoordsXY{ std::min(gClipSelectionB.x, (gameState.MapSize.x - 2) * 32), - std::min(gClipSelectionB.y, (gameState.MapSize.y - 2) * 32) } }, + TileCoordsXY{ CoordsXY{ std::min(gClipSelectionB.x, (gameState.mapSize.x - 2) * 32), + std::min(gClipSelectionB.y, (gameState.mapSize.y - 2) * 32) } }, TileCoordsXY{ - CoordsXY{ std::max(gClipSelectionA.x, 32), std::min(gClipSelectionB.y, (gameState.MapSize.y - 2) * 32) } }, + CoordsXY{ std::max(gClipSelectionA.x, 32), std::min(gClipSelectionB.y, (gameState.mapSize.y - 2) * 32) } }, TileCoordsXY{ - CoordsXY{ std::min(gClipSelectionB.x, (gameState.MapSize.x - 2) * 32), std::max(gClipSelectionA.y, 32) } }, + CoordsXY{ std::min(gClipSelectionB.x, (gameState.mapSize.x - 2) * 32), std::max(gClipSelectionA.y, 32) } }, }, }; @@ -500,7 +500,7 @@ int32_t CommandLineForScreenshot(const char** argv, int32_t argc, ScreenshotOpti customRotation = std::atoi(argv[7]) & 3; } - const auto& mapSize = GetGameState().MapSize; + const auto& mapSize = getGameState().mapSize; if (resolutionWidth == 0 || resolutionHeight == 0) { resolutionWidth = (mapSize.x * kCoordsXYStep * 2) >> customZoom; @@ -531,11 +531,11 @@ int32_t CommandLineForScreenshot(const char** argv, int32_t argc, ScreenshotOpti } else { - auto& gameState = GetGameState(); - viewport.viewPos = { gameState.SavedView + auto& gameState = getGameState(); + viewport.viewPos = { gameState.savedView - ScreenCoordsXY{ (viewport.ViewWidth() / 2), (viewport.ViewHeight() / 2) } }; - viewport.zoom = gameState.SavedViewZoom; - viewport.rotation = gameState.SavedViewRotation; + viewport.zoom = gameState.savedViewZoom; + viewport.rotation = gameState.savedViewRotation; } } diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 03e6dc356e..1411fe4f1b 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -1084,7 +1084,7 @@ namespace OpenRCT2 static void ViewportPaintWeatherGloom(DrawPixelInfo& dpi) { - auto paletteId = ClimateGetWeatherGloomPaletteId(GetGameState().WeatherCurrent); + auto paletteId = ClimateGetWeatherGloomPaletteId(getGameState().weatherCurrent); if (paletteId != FilterPaletteID::PaletteNull) { auto x = dpi.x; @@ -2044,12 +2044,12 @@ namespace OpenRCT2 if (w != nullptr) { Viewport* viewport = w->viewport; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - gameState.SavedView = ScreenCoordsXY{ viewport->ViewWidth() / 2, viewport->ViewHeight() / 2 } + viewport->viewPos; + gameState.savedView = ScreenCoordsXY{ viewport->ViewWidth() / 2, viewport->ViewHeight() / 2 } + viewport->viewPos; - gameState.SavedViewZoom = viewport->zoom; - gameState.SavedViewRotation = viewport->rotation; + gameState.savedViewZoom = viewport->zoom; + gameState.savedViewRotation = viewport->rotation; } } } // namespace OpenRCT2 diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index 2606ca23e9..354fe06351 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -101,7 +101,7 @@ static bool AwardIsDeservedMostUntidy(int32_t activeAwardTypes) } } - return (negativeCount > GetGameState().NumGuestsInPark / 16); + return (negativeCount > getGameState().numGuestsInPark / 16); } /** More than 1/64 of the total guests must be thinking tidy thoughts and less than 6 guests thinking untidy thoughts. */ @@ -133,7 +133,7 @@ static bool AwardIsDeservedMostTidy(int32_t activeAwardTypes) } } - return (negativeCount <= 5 && positiveCount > GetGameState().NumGuestsInPark / 64); + return (negativeCount <= 5 && positiveCount > getGameState().numGuestsInPark / 64); } /** At least 6 open roller coasters. */ @@ -166,7 +166,7 @@ static bool AwardIsDeservedBestRollercoasters([[maybe_unused]] int32_t activeAwa /** Entrance fee is 0.10 less than half of the total ride value. */ static bool AwardIsDeservedBestValue(int32_t activeAwardTypes) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (activeAwardTypes & EnumToFlag(AwardType::WorstValue)) return false; @@ -174,13 +174,13 @@ static bool AwardIsDeservedBestValue(int32_t activeAwardTypes) if (activeAwardTypes & EnumToFlag(AwardType::MostDisappointing)) return false; - if ((gameState.Park.Flags & PARK_FLAGS_NO_MONEY) || !Park::EntranceFeeUnlocked()) + if ((gameState.park.Flags & PARK_FLAGS_NO_MONEY) || !Park::EntranceFeeUnlocked()) return false; - if (gameState.TotalRideValueForMoney < 10.00_GBP) + if (gameState.totalRideValueForMoney < 10.00_GBP) return false; - if (Park::GetEntranceFee() + 0.10_GBP >= gameState.TotalRideValueForMoney / 2) + if (Park::GetEntranceFee() + 0.10_GBP >= gameState.totalRideValueForMoney / 2) return false; return true; @@ -216,23 +216,23 @@ static bool AwardIsDeservedMostBeautiful(int32_t activeAwardTypes) } } - return (negativeCount <= 15 && positiveCount > GetGameState().NumGuestsInPark / 128); + return (negativeCount <= 15 && positiveCount > getGameState().numGuestsInPark / 128); } /** Entrance fee is more than total ride value. */ static bool AwardIsDeservedWorstValue(int32_t activeAwardTypes) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (activeAwardTypes & EnumToFlag(AwardType::BestValue)) return false; - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) return false; const auto parkEntranceFee = Park::GetEntranceFee(); if (parkEntranceFee == 0.00_GBP) return false; - if (parkEntranceFee <= gameState.TotalRideValueForMoney) + if (parkEntranceFee <= gameState.totalRideValueForMoney) return false; return true; } @@ -306,7 +306,7 @@ static bool AwardIsDeservedBestFood(int32_t activeAwardTypes) } } - if (shops < 7 || uniqueShops < 4 || shops < GetGameState().NumGuestsInPark / 128) + if (shops < 7 || uniqueShops < 4 || shops < getGameState().numGuestsInPark / 128) return false; // Count hungry peeps @@ -351,7 +351,7 @@ static bool AwardIsDeservedWorstFood(int32_t activeAwardTypes) } } - if (uniqueShops > 2 || shops > GetGameState().NumGuestsInPark / 256) + if (uniqueShops > 2 || shops > getGameState().numGuestsInPark / 256) return false; // Count hungry peeps @@ -383,7 +383,7 @@ static bool AwardIsDeservedBestToilets([[maybe_unused]] int32_t activeAwardTypes return false; // At least one open toilet for every 128 guests - if (numToilets < GetGameState().NumGuestsInPark / 128u) + if (numToilets < getGameState().numGuestsInPark / 128u) return false; // Count number of guests who are thinking they need the toilet @@ -405,7 +405,7 @@ static bool AwardIsDeservedMostDisappointing(int32_t activeAwardTypes) { if (activeAwardTypes & EnumToFlag(AwardType::BestValue)) return false; - if (GetGameState().Park.Rating > 650) + if (getGameState().park.Rating > 650) return false; // Count the number of disappointing rides @@ -593,7 +593,7 @@ static bool AwardIsDeserved(AwardType awardType, int32_t activeAwardTypes) void AwardReset() { - GetGameState().CurrentAwards.clear(); + getGameState().currentAwards.clear(); } /** @@ -604,8 +604,8 @@ void AwardUpdateAll() { PROFILED_FUNCTION(); - auto& gameState = GetGameState(); - auto& currentAwards = gameState.CurrentAwards; + auto& gameState = getGameState(); + auto& currentAwards = gameState.currentAwards; auto* windowMgr = Ui::GetWindowManager(); // Decrease award times @@ -624,7 +624,7 @@ void AwardUpdateAll() } // Only add new awards if park is open - if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) + if (gameState.park.Flags & PARK_FLAGS_PARK_OPEN) { // Set active award types as flags int32_t activeAwardTypes = 0; diff --git a/src/openrct2/management/Finance.cpp b/src/openrct2/management/Finance.cpp index fa6befa07d..00a098e115 100644 --- a/src/openrct2/management/Finance.cpp +++ b/src/openrct2/management/Finance.cpp @@ -47,7 +47,7 @@ static constexpr int32_t dword_988E60[EnumValue(ExpenditureType::Count)] = { */ bool FinanceCheckMoneyRequired(uint32_t flags) { - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) return false; if (isInEditorMode()) return false; @@ -65,7 +65,7 @@ bool FinanceCheckMoneyRequired(uint32_t flags) */ bool FinanceCheckAffordability(money64 cost, uint32_t flags) { - return !FinanceCheckMoneyRequired(flags) || cost <= 0 || cost <= GetGameState().Cash; + return !FinanceCheckMoneyRequired(flags) || cost <= 0 || cost <= getGameState().cash; } /** @@ -77,14 +77,14 @@ bool FinanceCheckAffordability(money64 cost, uint32_t flags) void FinancePayment(money64 amount, ExpenditureType type) { // overflow check - auto& gameState = GetGameState(); - gameState.Cash = AddClamp(gameState.Cash, -amount); + auto& gameState = getGameState(); + gameState.cash = AddClamp(gameState.cash, -amount); - gameState.ExpenditureTable[0][EnumValue(type)] -= amount; + gameState.expenditureTable[0][EnumValue(type)] -= amount; if (dword_988E60[EnumValue(type)] & 1) { // Cumulative amount of money spent this day - gameState.CurrentExpenditure -= amount; + gameState.currentExpenditure -= amount; } auto intent = Intent(INTENT_ACTION_UPDATE_CASH); @@ -99,7 +99,7 @@ void FinancePayWages() { PROFILED_FUNCTION(); - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) { return; } @@ -116,13 +116,13 @@ void FinancePayWages() **/ void FinancePayResearch() { - const auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + const auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { return; } - const uint8_t level = gameState.ResearchFundingLevel; + const uint8_t level = gameState.researchFundingLevel; FinancePayment(research_cost_table[level] / 4, ExpenditureType::Research); } @@ -132,18 +132,18 @@ void FinancePayResearch() */ void FinancePayInterest() { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { return; } // This variable uses the 64-bit type as the computation below can involve multiplying very large numbers // that will overflow money64 if the loan is greater than (1 << 31) / (5 * current_interest_rate) - const money64 current_loan = gameState.BankLoan; - const auto current_interest_rate = gameState.BankLoanInterestRate; - const money64 interest_to_pay = (gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST) + const money64 current_loan = gameState.bankLoan; + const auto current_interest_rate = gameState.bankLoanInterestRate; + const money64 interest_to_pay = (gameState.park.Flags & PARK_FLAGS_RCT1_INTEREST) ? (current_loan / 2400) : (current_loan * 5 * current_interest_rate) >> 14; @@ -165,7 +165,7 @@ void FinancePayRideUpkeep() ride.renew(); } - if (ride.status != RideStatus::closed && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) + if (ride.status != RideStatus::closed && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY)) { auto upkeep = ride.upkeepCost; if (upkeep != kMoney64Undefined) @@ -185,19 +185,19 @@ void FinancePayRideUpkeep() void FinanceResetHistory() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); for (auto i = 0; i < kFinanceHistorySize; i++) { - gameState.CashHistory[i] = kMoney64Undefined; - gameState.WeeklyProfitHistory[i] = kMoney64Undefined; - gameState.Park.ValueHistory[i] = kMoney64Undefined; + gameState.cashHistory[i] = kMoney64Undefined; + gameState.weeklyProfitHistory[i] = kMoney64Undefined; + gameState.park.ValueHistory[i] = kMoney64Undefined; } for (uint32_t i = 0; i < kExpenditureTableMonthCount; ++i) { for (uint32_t j = 0; j < static_cast(ExpenditureType::Count); ++j) { - gameState.ExpenditureTable[i][j] = 0; + gameState.expenditureTable[i][j] = 0; } } } @@ -208,34 +208,34 @@ void FinanceResetHistory() */ void FinanceInit() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // It only initialises the first month for (uint32_t i = 0; i < static_cast(ExpenditureType::Count); i++) { - gameState.ExpenditureTable[0][i] = 0; + gameState.expenditureTable[0][i] = 0; } - gameState.CurrentExpenditure = 0; - gameState.CurrentProfit = 0; + gameState.currentExpenditure = 0; + gameState.currentProfit = 0; - gameState.WeeklyProfitAverageDividend = 0; - gameState.WeeklyProfitAverageDivisor = 0; + gameState.weeklyProfitAverageDividend = 0; + gameState.weeklyProfitAverageDivisor = 0; - gameState.InitialCash = 10000.00_GBP; // Cheat detection + gameState.initialCash = 10000.00_GBP; // Cheat detection - gameState.Cash = 10000.00_GBP; - gameState.BankLoan = 10000.00_GBP; - gameState.MaxBankLoan = 20000.00_GBP; + gameState.cash = 10000.00_GBP; + gameState.bankLoan = 10000.00_GBP; + gameState.maxBankLoan = 20000.00_GBP; - gameState.BankLoanInterestRate = 10; - gameState.Park.Value = 0; - gameState.CompanyValue = 0; - gameState.HistoricalProfit = 0; - gameState.ScenarioCompletedCompanyValue = kMoney64Undefined; - gameState.TotalAdmissions = 0; - gameState.TotalIncomeFromAdmissions = 0; - gameState.ScenarioCompletedBy = std::string("?"); + gameState.bankLoanInterestRate = 10; + gameState.park.Value = 0; + gameState.companyValue = 0; + gameState.historicalProfit = 0; + gameState.scenarioCompletedCompanyValue = kMoney64Undefined; + gameState.totalAdmissions = 0; + gameState.totalIncomeFromAdmissions = 0; + gameState.scenarioCompletedBy = std::string("?"); } /** @@ -245,14 +245,14 @@ void FinanceInit() void FinanceUpdateDailyProfit() { PROFILED_FUNCTION(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - gameState.CurrentProfit = 7 * gameState.CurrentExpenditure; - gameState.CurrentExpenditure = 0; // Reset daily expenditure + gameState.currentProfit = 7 * gameState.currentExpenditure; + gameState.currentExpenditure = 0; // Reset daily expenditure money64 current_profit = 0; - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { // Staff costs for (auto peep : EntityList()) @@ -261,11 +261,11 @@ void FinanceUpdateDailyProfit() } // Research costs - uint8_t level = gameState.ResearchFundingLevel; + uint8_t level = gameState.researchFundingLevel; current_profit -= research_cost_table[level]; // Loan costs - auto current_loan = gameState.BankLoan; + auto current_loan = gameState.bankLoan; current_profit -= current_loan / 600; // Ride costs @@ -281,11 +281,11 @@ void FinanceUpdateDailyProfit() // This is not equivalent to / 4 due to rounding of negative numbers current_profit = current_profit >> 2; - gameState.CurrentProfit += current_profit; + gameState.currentProfit += current_profit; // These are related to weekly profit graph - gameState.WeeklyProfitAverageDividend += gameState.CurrentProfit; - gameState.WeeklyProfitAverageDivisor += 1; + gameState.weeklyProfitAverageDividend += gameState.currentProfit; + gameState.weeklyProfitAverageDivisor += 1; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::Finances); @@ -293,22 +293,22 @@ void FinanceUpdateDailyProfit() money64 FinanceGetInitialCash() { - return GetGameState().InitialCash; + return getGameState().initialCash; } money64 FinanceGetCurrentLoan() { - return GetGameState().BankLoan; + return getGameState().bankLoan; } money64 FinanceGetMaximumLoan() { - return GetGameState().MaxBankLoan; + return getGameState().maxBankLoan; } money64 FinanceGetCurrentCash() { - return GetGameState().Cash; + return getGameState().cash; } /** @@ -318,15 +318,15 @@ money64 FinanceGetCurrentCash() */ void FinanceShiftExpenditureTable() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // If kExpenditureTableMonthCount months have passed then is full, sum the oldest month if (GetDate().GetMonthsElapsed() >= kExpenditureTableMonthCount) { const money64 sum = std::accumulate( - std::cbegin(gameState.ExpenditureTable[kExpenditureTableMonthCount - 1]), - std::cend(gameState.ExpenditureTable[kExpenditureTableMonthCount - 1]), money64{}); + std::cbegin(gameState.expenditureTable[kExpenditureTableMonthCount - 1]), + std::cend(gameState.expenditureTable[kExpenditureTableMonthCount - 1]), money64{}); - gameState.HistoricalProfit += sum; + gameState.historicalProfit += sum; } // Shift the table @@ -334,14 +334,14 @@ void FinanceShiftExpenditureTable() { for (size_t j = 0; j < static_cast(ExpenditureType::Count); j++) { - gameState.ExpenditureTable[i][j] = gameState.ExpenditureTable[i - 1][j]; + gameState.expenditureTable[i][j] = gameState.expenditureTable[i - 1][j]; } } // Zero the beginning of the table, which is the new month for (uint32_t i = 0; i < static_cast(ExpenditureType::Count); i++) { - gameState.ExpenditureTable[0][i] = 0; + gameState.expenditureTable[0][i] = 0; } auto* windowMgr = Ui::GetWindowManager(); @@ -354,8 +354,8 @@ void FinanceShiftExpenditureTable() */ void FinanceResetCashToInitial() { - auto& gameState = GetGameState(); - gameState.Cash = gameState.InitialCash; + auto& gameState = getGameState(); + gameState.cash = gameState.initialCash; } /** @@ -366,7 +366,7 @@ money64 FinanceGetLastMonthShopProfit() money64 profit = 0; if (GetDate().GetMonthsElapsed() != 0) { - const auto* lastMonthExpenditure = GetGameState().ExpenditureTable[1]; + const auto* lastMonthExpenditure = getGameState().expenditureTable[1]; profit += lastMonthExpenditure[EnumValue(ExpenditureType::ShopSales)]; profit += lastMonthExpenditure[EnumValue(ExpenditureType::ShopStock)]; diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index 8892e1c0db..8d4e65cbc3 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -112,12 +112,12 @@ void MarketingUpdate() { PROFILED_FUNCTION(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.Cheats.neverendingMarketing) + if (gameState.cheats.neverendingMarketing) return; - for (auto it = gameState.MarketingCampaigns.begin(); it != gameState.MarketingCampaigns.end();) + for (auto it = gameState.marketingCampaigns.begin(); it != gameState.marketingCampaigns.end();) { auto& campaign = *it; if (campaign.Flags & MarketingCampaignFlags::FIRST_WEEK) @@ -134,7 +134,7 @@ void MarketingUpdate() if (campaign.WeeksLeft == 0) { MarketingRaiseFinishedNotification(campaign); - it = gameState.MarketingCampaigns.erase(it); + it = gameState.marketingCampaigns.erase(it); } else { @@ -234,7 +234,7 @@ bool MarketingIsCampaignTypeApplicable(int32_t campaignType) MarketingCampaign* MarketingGetCampaign(int32_t campaignType) { - for (auto& campaign : GetGameState().MarketingCampaigns) + for (auto& campaign : getGameState().marketingCampaigns) { if (campaign.Type == campaignType) { @@ -254,7 +254,7 @@ void MarketingNewCampaign(const MarketingCampaign& campaign) } else { - GetGameState().MarketingCampaigns.push_back(campaign); + getGameState().marketingCampaigns.push_back(campaign); } } @@ -268,7 +268,7 @@ void MarketingCancelCampaignsForRide(const RideId rideId) return false; }; - auto& v = GetGameState().MarketingCampaigns; + auto& v = getGameState().marketingCampaigns; auto removedIt = std::remove_if(v.begin(), v.end(), isCampaignForRideFn); v.erase(removedIt, v.end()); } diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index 36410fb566..14033d8708 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -53,7 +53,7 @@ bool News::IsValidIndex(int32_t index) News::Item* News::GetItem(int32_t index) { - return GetGameState().NewsItems.At(index); + return getGameState().newsItems.At(index); } News::Item& News::ItemQueues::operator[](size_t index) @@ -86,7 +86,7 @@ const News::Item* News::ItemQueues::At(int32_t index) const bool News::IsQueueEmpty() { - return GetGameState().NewsItems.IsEmpty(); + return getGameState().newsItems.IsEmpty(); } bool News::ItemQueues::IsEmpty() const @@ -106,11 +106,11 @@ void News::ItemQueues::Clear() void News::InitQueue(GameState_t& gameState) { - gameState.NewsItems.Clear(); - assert(gameState.NewsItems.IsEmpty()); + gameState.newsItems.Clear(); + assert(gameState.newsItems.IsEmpty()); // Throttles for warning types (PEEP_*_WARNING) - for (auto& warningThrottle : gameState.PeepWarningThrottle) + for (auto& warningThrottle : gameState.peepWarningThrottle) { warningThrottle = 0; } @@ -126,7 +126,7 @@ uint16_t News::ItemQueues::IncrementTicks() static void TickCurrent() { - int32_t ticks = GetGameState().NewsItems.IncrementTicks(); + int32_t ticks = getGameState().newsItems.IncrementTicks(); // Only play news item sound when in normal playing mode if (ticks == 1 && (gLegacyScene == LegacyScene::playing)) { @@ -157,9 +157,9 @@ void News::UpdateCurrentItem() { PROFILED_FUNCTION(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Check if there is a current news item - if (gameState.NewsItems.IsEmpty()) + if (gameState.newsItems.IsEmpty()) return; auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS); @@ -169,8 +169,8 @@ void News::UpdateCurrentItem() TickCurrent(); // Removal of current news item - if (gameState.NewsItems.CurrentShouldBeArchived()) - gameState.NewsItems.ArchiveCurrent(); + if (gameState.newsItems.CurrentShouldBeArchived()) + gameState.newsItems.ArchiveCurrent(); } /** @@ -179,7 +179,7 @@ void News::UpdateCurrentItem() */ void News::CloseCurrentItem() { - GetGameState().NewsItems.ArchiveCurrent(); + getGameState().newsItems.ArchiveCurrent(); } void News::ItemQueues::ArchiveCurrent() @@ -326,7 +326,7 @@ News::Item* News::AddItemToQueue(ItemType type, StringId string_id, EntityId ass News::Item* News::AddItemToQueue(News::ItemType type, const utf8* text, uint32_t assoc) { auto& date = GetDate(); - News::Item* newsItem = GetGameState().NewsItems.FirstOpenOrNewSlot(); + News::Item* newsItem = getGameState().newsItems.FirstOpenOrNewSlot(); newsItem->Type = type; newsItem->Flags = 0; newsItem->Assoc = assoc; // Make optional for Award, Money, Graph and Null @@ -436,13 +436,13 @@ void News::OpenSubject(News::ItemType type, int32_t subject) */ void News::DisableNewsItems(News::ItemType type, uint32_t assoc) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // TODO: write test invalidating windows - gameState.NewsItems.ForeachRecentNews([type, assoc, &gameState](auto& newsItem) { + gameState.newsItems.ForeachRecentNews([type, assoc, &gameState](auto& newsItem) { if (type == newsItem.Type && assoc == newsItem.Assoc) { newsItem.SetFlags(News::ItemFlags::HasButton); - if (&newsItem == &gameState.NewsItems.Current()) + if (&newsItem == &gameState.newsItems.Current()) { auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS); ContextBroadcastIntent(&intent); @@ -450,7 +450,7 @@ void News::DisableNewsItems(News::ItemType type, uint32_t assoc) } }); - gameState.NewsItems.ForeachArchivedNews([type, assoc](auto& newsItem) { + gameState.newsItems.ForeachArchivedNews([type, assoc](auto& newsItem) { if (type == newsItem.Type && assoc == newsItem.Assoc) { newsItem.SetFlags(News::ItemFlags::HasButton); @@ -462,7 +462,7 @@ void News::DisableNewsItems(News::ItemType type, uint32_t assoc) void News::AddItemToQueue(News::Item* newNewsItem) { - News::Item* newsItem = GetGameState().NewsItems.FirstOpenOrNewSlot(); + News::Item* newsItem = getGameState().newsItems.FirstOpenOrNewSlot(); *newsItem = *newNewsItem; } @@ -471,30 +471,30 @@ void News::RemoveItem(int32_t index) if (index < 0 || index >= News::MaxItems) return; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // News item is already null, no need to remove it - if (gameState.NewsItems[index].Type == News::ItemType::Null) + if (gameState.newsItems[index].Type == News::ItemType::Null) return; size_t newsBoundary = index < News::ItemHistoryStart ? News::ItemHistoryStart : News::MaxItems; for (size_t i = index; i < newsBoundary - 1; i++) { - gameState.NewsItems[i] = gameState.NewsItems[i + 1]; + gameState.newsItems[i] = gameState.newsItems[i + 1]; } - gameState.NewsItems[newsBoundary - 1].Type = News::ItemType::Null; + gameState.newsItems[newsBoundary - 1].Type = News::ItemType::Null; } void News::importNewsItems( GameState_t& gameState, const std::span recent, const std::span archived) { - gameState.NewsItems.Clear(); + gameState.newsItems.Clear(); for (size_t i = 0; i < std::min(recent.size(), News::ItemHistoryStart); i++) { - gameState.NewsItems[i] = recent[i]; + gameState.newsItems[i] = recent[i]; } for (size_t i = 0; i < std::min(archived.size(), News::MaxItemsArchive); i++) { - gameState.NewsItems[News::ItemHistoryStart + i] = archived[i]; + gameState.newsItems[News::ItemHistoryStart + i] = archived[i]; } } diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index 1c780fd5e0..d5c1b9df81 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -72,8 +72,8 @@ const StringId kResearchFundingLevelNames[] = { */ void ResearchResetItems(GameState_t& gameState) { - gameState.ResearchItemsUninvented.clear(); - gameState.ResearchItemsInvented.clear(); + gameState.researchItemsUninvented.clear(); + gameState.researchItemsInvented.clear(); } /** @@ -82,15 +82,15 @@ void ResearchResetItems(GameState_t& gameState) */ void ResearchUpdateUncompletedTypes() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); int32_t uncompletedResearchTypes = 0; - for (auto const& researchItem : gameState.ResearchItemsUninvented) + for (auto const& researchItem : gameState.researchItemsUninvented) { uncompletedResearchTypes |= EnumToFlag(researchItem.category); } - gameState.ResearchUncompletedCategories = uncompletedResearchTypes; + gameState.researchUncompletedCategories = uncompletedResearchTypes; } /** @@ -99,19 +99,19 @@ void ResearchUpdateUncompletedTypes() */ static void ResearchCalculateExpectedDate() { - auto& gameState = GetGameState(); - if (gameState.ResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH - || gameState.ResearchFundingLevel == RESEARCH_FUNDING_NONE) + auto& gameState = getGameState(); + if (gameState.researchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH + || gameState.researchFundingLevel == RESEARCH_FUNDING_NONE) { - gameState.ResearchExpectedDay = 255; + gameState.researchExpectedDay = 255; } else { auto& date = GetDate(); - int32_t progressRemaining = gameState.ResearchProgressStage == RESEARCH_STAGE_COMPLETING_DESIGN ? 0x10000 : 0x20000; - progressRemaining -= gameState.ResearchProgress; - int32_t daysRemaining = (progressRemaining / _researchRate[gameState.ResearchFundingLevel]) * 128; + int32_t progressRemaining = gameState.researchProgressStage == RESEARCH_STAGE_COMPLETING_DESIGN ? 0x10000 : 0x20000; + progressRemaining -= gameState.researchProgress; + int32_t daysRemaining = (progressRemaining / _researchRate[gameState.researchFundingLevel]) * 128; int32_t expectedDay = date.GetMonthTicks() + (daysRemaining & 0xFFFF); int32_t dayQuotient = expectedDay / 0x10000; @@ -120,8 +120,8 @@ static void ResearchCalculateExpectedDate() int32_t expectedMonth = DateGetMonth(date.GetMonthsElapsed() + dayQuotient + (daysRemaining >> 16)); expectedDay = (dayRemainder * Date::GetDaysInMonth(expectedMonth)) >> 16; - gameState.ResearchExpectedDay = expectedDay; - gameState.ResearchExpectedMonth = expectedMonth; + gameState.researchExpectedDay = expectedDay; + gameState.researchExpectedMonth = expectedMonth; } } @@ -134,12 +134,12 @@ static void ResearchInvalidateRelatedWindows() static void ResearchMarkAsFullyCompleted() { - auto& gameState = GetGameState(); - gameState.ResearchProgress = 0; - gameState.ResearchProgressStage = RESEARCH_STAGE_FINISHED_ALL; + auto& gameState = getGameState(); + gameState.researchProgress = 0; + gameState.researchProgressStage = RESEARCH_STAGE_FINISHED_ALL; ResearchInvalidateRelatedWindows(); // Reset funding to 0 if no more rides. - auto gameAction = ParkSetResearchFundingAction(gameState.ResearchPriorities, 0); + auto gameAction = ParkSetResearchFundingAction(gameState.researchPriorities, 0); GameActions::Execute(&gameAction); } @@ -149,8 +149,8 @@ static void ResearchMarkAsFullyCompleted() */ static void ResearchNextDesign() { - auto& gameState = GetGameState(); - if (gameState.ResearchItemsUninvented.empty()) + auto& gameState = getGameState(); + if (gameState.researchItemsUninvented.empty()) { ResearchMarkAsFullyCompleted(); return; @@ -158,31 +158,31 @@ static void ResearchNextDesign() // Try to find a research item of a matching type, if none found, use any first item auto it = std::find_if( - gameState.ResearchItemsUninvented.begin(), gameState.ResearchItemsUninvented.end(), - [&gameState](const auto& e) { return (gameState.ResearchPriorities & EnumToFlag(e.category)) != 0; }); - if (it == gameState.ResearchItemsUninvented.end()) + gameState.researchItemsUninvented.begin(), gameState.researchItemsUninvented.end(), + [&gameState](const auto& e) { return (gameState.researchPriorities & EnumToFlag(e.category)) != 0; }); + if (it == gameState.researchItemsUninvented.end()) { - it = gameState.ResearchItemsUninvented.begin(); + it = gameState.researchItemsUninvented.begin(); } - gameState.ResearchNextItem = *it; - gameState.ResearchProgress = 0; - gameState.ResearchProgressStage = RESEARCH_STAGE_DESIGNING; + gameState.researchNextItem = *it; + gameState.researchProgress = 0; + gameState.researchProgressStage = RESEARCH_STAGE_DESIGNING; ResearchInvalidateRelatedWindows(); } static void MarkResearchItemInvented(const ResearchItem& researchItem) { - auto& gameState = GetGameState(); - gameState.ResearchItemsUninvented.erase( - std::remove(gameState.ResearchItemsUninvented.begin(), gameState.ResearchItemsUninvented.end(), researchItem), - gameState.ResearchItemsUninvented.end()); + auto& gameState = getGameState(); + gameState.researchItemsUninvented.erase( + std::remove(gameState.researchItemsUninvented.begin(), gameState.researchItemsUninvented.end(), researchItem), + gameState.researchItemsUninvented.end()); - if (std::find(gameState.ResearchItemsInvented.begin(), gameState.ResearchItemsInvented.end(), researchItem) - == gameState.ResearchItemsInvented.end()) + if (std::find(gameState.researchItemsInvented.begin(), gameState.researchItemsInvented.end(), researchItem) + == gameState.researchItemsInvented.end()) { - gameState.ResearchItemsInvented.push_back(researchItem); + gameState.researchItemsInvented.push_back(researchItem); } } @@ -192,8 +192,8 @@ static void MarkResearchItemInvented(const ResearchItem& researchItem) */ void ResearchFinishItem(const ResearchItem& researchItem) { - auto& gameState = GetGameState(); - gameState.ResearchLastItem = researchItem; + auto& gameState = getGameState(); + gameState.researchLastItem = researchItem; ResearchInvalidateRelatedWindows(); if (researchItem.type == Research::EntryType::Ride) @@ -216,7 +216,7 @@ void ResearchFinishItem(const ResearchItem& researchItem) RideEntrySetInvented(rideEntryIndex); bool seenRideEntry[kMaxRideObjects]{}; - for (auto const& researchItem3 : gameState.ResearchItemsUninvented) + for (auto const& researchItem3 : gameState.researchItemsUninvented) { ObjectEntryIndex index = researchItem3.entryIndex; seenRideEntry[index] = true; @@ -320,52 +320,52 @@ void ResearchUpdate() return; } - auto& gameState = GetGameState(); - if (gameState.CurrentTicks % 32 != 0) + auto& gameState = getGameState(); + if (gameState.currentTicks % 32 != 0) { return; } - if ((gameState.Park.Flags & 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; } else { - researchLevel = gameState.ResearchFundingLevel; + researchLevel = gameState.researchFundingLevel; } - currentResearchProgress = gameState.ResearchProgress; + currentResearchProgress = gameState.researchProgress; currentResearchProgress += _researchRate[researchLevel]; if (currentResearchProgress <= 0xFFFF) { - gameState.ResearchProgress = currentResearchProgress; + gameState.researchProgress = currentResearchProgress; } else { - switch (gameState.ResearchProgressStage) + switch (gameState.researchProgressStage) { case RESEARCH_STAGE_INITIAL_RESEARCH: ResearchNextDesign(); ResearchCalculateExpectedDate(); break; case RESEARCH_STAGE_DESIGNING: - gameState.ResearchProgress = 0; - gameState.ResearchProgressStage = RESEARCH_STAGE_COMPLETING_DESIGN; + gameState.researchProgress = 0; + gameState.researchProgressStage = RESEARCH_STAGE_COMPLETING_DESIGN; ResearchCalculateExpectedDate(); ResearchInvalidateRelatedWindows(); break; case RESEARCH_STAGE_COMPLETING_DESIGN: - MarkResearchItemInvented(*gameState.ResearchNextItem); - ResearchFinishItem(*gameState.ResearchNextItem); - gameState.ResearchProgress = 0; - gameState.ResearchProgressStage = RESEARCH_STAGE_INITIAL_RESEARCH; + MarkResearchItemInvented(*gameState.researchNextItem); + ResearchFinishItem(*gameState.researchNextItem); + gameState.researchProgress = 0; + gameState.researchProgressStage = RESEARCH_STAGE_INITIAL_RESEARCH; ResearchCalculateExpectedDate(); ResearchUpdateUncompletedTypes(); ResearchInvalidateRelatedWindows(); break; case RESEARCH_STAGE_FINISHED_ALL: - gameState.ResearchFundingLevel = RESEARCH_FUNDING_NONE; + gameState.researchFundingLevel = RESEARCH_FUNDING_NONE; break; } } @@ -377,7 +377,7 @@ void ResearchUpdate() */ void ResearchResetCurrentItem() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); SetEveryRideTypeNotInvented(); SetEveryRideEntryNotInvented(); @@ -385,14 +385,14 @@ void ResearchResetCurrentItem() SetAllSceneryItemsInvented(); SetAllSceneryGroupsNotInvented(); - for (const auto& researchItem : gameState.ResearchItemsInvented) + for (const auto& researchItem : gameState.researchItemsInvented) { ResearchFinishItem(researchItem); } - gameState.ResearchLastItem = std::nullopt; - gameState.ResearchProgressStage = RESEARCH_STAGE_INITIAL_RESEARCH; - gameState.ResearchProgress = 0; + gameState.researchLastItem = std::nullopt; + gameState.researchProgressStage = RESEARCH_STAGE_INITIAL_RESEARCH; + gameState.researchProgress = 0; } /** @@ -401,14 +401,14 @@ void ResearchResetCurrentItem() */ static void ResearchInsertUnresearched(ResearchItem&& item) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // First check to make sure that entry is not already accounted for if (item.Exists()) { return; } - gameState.ResearchItemsUninvented.push_back(std::move(item)); + gameState.researchItemsUninvented.push_back(std::move(item)); } /** @@ -417,14 +417,14 @@ static void ResearchInsertUnresearched(ResearchItem&& item) */ static void ResearchInsertResearched(ResearchItem&& item) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // First check to make sure that entry is not already accounted for if (item.Exists()) { return; } - gameState.ResearchItemsInvented.push_back(std::move(item)); + gameState.researchItemsInvented.push_back(std::move(item)); } /** @@ -433,13 +433,13 @@ static void ResearchInsertResearched(ResearchItem&& item) */ void ResearchRemove(const ResearchItem& researchItem) { - auto& gameState = GetGameState(); - gameState.ResearchItemsUninvented.erase( - std::remove(gameState.ResearchItemsUninvented.begin(), gameState.ResearchItemsUninvented.end(), researchItem), - gameState.ResearchItemsUninvented.end()); - gameState.ResearchItemsInvented.erase( - std::remove(gameState.ResearchItemsInvented.begin(), gameState.ResearchItemsInvented.end(), researchItem), - gameState.ResearchItemsInvented.end()); + auto& gameState = getGameState(); + gameState.researchItemsUninvented.erase( + std::remove(gameState.researchItemsUninvented.begin(), gameState.researchItemsUninvented.end(), researchItem), + gameState.researchItemsUninvented.end()); + gameState.researchItemsInvented.erase( + std::remove(gameState.researchItemsInvented.begin(), gameState.researchItemsInvented.end(), researchItem), + gameState.researchItemsInvented.end()); } void ResearchInsert(ResearchItem&& item, bool researched) @@ -460,7 +460,7 @@ void ResearchInsert(ResearchItem&& item, bool researched) */ void ResearchPopulateListRandom() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); ResearchResetItems(gameState); // Rides @@ -625,7 +625,7 @@ void ScenerySetNotInvented(const ScenerySelection& sceneryItem) bool SceneryGroupIsInvented(int32_t sgIndex) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto sgEntry = OpenRCT2::ObjectManager::GetObjectEntry(sgIndex); if (sgEntry == nullptr || sgEntry->SceneryEntries.empty()) { @@ -638,13 +638,13 @@ bool SceneryGroupIsInvented(int32_t sgIndex) return true; } - if (GetGameState().Cheats.ignoreResearchStatus) + if (getGameState().cheats.ignoreResearchStatus) { return true; } return std::none_of( - std::begin(gameState.ResearchItemsUninvented), std::end(gameState.ResearchItemsUninvented), + std::begin(gameState.researchItemsUninvented), std::end(gameState.researchItemsUninvented), [sgIndex](const ResearchItem& item) { return item.type == Research::EntryType::Scenery && item.entryIndex == sgIndex; }); @@ -749,12 +749,12 @@ StringId ResearchItem::GetName() const */ void ResearchRemoveFlags() { - auto& gameState = GetGameState(); - for (auto& researchItem : gameState.ResearchItemsUninvented) + auto& gameState = getGameState(); + for (auto& researchItem : gameState.researchItemsUninvented) { researchItem.flags &= ~(RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED | RESEARCH_ENTRY_FLAG_SCENERY_SET_ALWAYS_RESEARCHED); } - for (auto& researchItem : gameState.ResearchItemsInvented) + for (auto& researchItem : gameState.researchItemsInvented) { researchItem.flags &= ~(RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED | RESEARCH_ENTRY_FLAG_SCENERY_SET_ALWAYS_RESEARCHED); } @@ -807,18 +807,18 @@ static void ResearchMarkItemAsResearched(const ResearchItem& item) static void ResearchRebuildInventedTables() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); SetEveryRideTypeNotInvented(); SetEveryRideEntryInvented(); SetEveryRideEntryNotInvented(); SetAllSceneryItemsNotInvented(); - for (const auto& item : gameState.ResearchItemsInvented) + for (const auto& item : gameState.researchItemsInvented) { // Ignore item, if the research of it is in progress - if (gameState.ResearchProgressStage == RESEARCH_STAGE_DESIGNING - || gameState.ResearchProgressStage == RESEARCH_STAGE_COMPLETING_DESIGN) + if (gameState.researchProgressStage == RESEARCH_STAGE_DESIGNING + || gameState.researchProgressStage == RESEARCH_STAGE_COMPLETING_DESIGN) { - if (item == gameState.ResearchNextItem) + if (item == gameState.researchNextItem) { continue; } @@ -831,10 +831,10 @@ static void ResearchRebuildInventedTables() static void ResearchAddAllMissingItems(bool isResearched) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Mark base ridetypes as seen if they exist in the invented research list. bool seenBaseEntry[kMaxRideObjects]{}; - for (auto const& researchItem : gameState.ResearchItemsInvented) + for (auto const& researchItem : gameState.researchItemsInvented) { ObjectEntryIndex index = researchItem.baseRideType; seenBaseEntry[index] = true; @@ -859,7 +859,7 @@ static void ResearchAddAllMissingItems(bool isResearched) } // Mark base ridetypes as seen if they exist in the uninvented research list. - for (auto const& researchItem : gameState.ResearchItemsUninvented) + for (auto const& researchItem : gameState.researchItemsUninvented) { ObjectEntryIndex index = researchItem.baseRideType; seenBaseEntry[index] = true; @@ -900,14 +900,14 @@ static void ResearchAddAllMissingItems(bool isResearched) void ResearchFix() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Remove null entries from the research list - ResearchRemoveNullItems(gameState.ResearchItemsInvented); - ResearchRemoveNullItems(gameState.ResearchItemsUninvented); + ResearchRemoveNullItems(gameState.researchItemsInvented); + ResearchRemoveNullItems(gameState.researchItemsUninvented); // Add missing entries to the research list // If research is complete, mark all the missing items as available - ResearchAddAllMissingItems(gameState.ResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL); + ResearchAddAllMissingItems(gameState.researchProgressStage == RESEARCH_STAGE_FINISHED_ALL); // Now rebuild all the tables that say whether a ride or scenery item is invented ResearchRebuildInventedTables(); @@ -916,20 +916,20 @@ void ResearchFix() void ResearchItemsMakeAllUnresearched() { - auto& gameState = GetGameState(); - gameState.ResearchItemsUninvented.insert( - gameState.ResearchItemsUninvented.end(), std::make_move_iterator(gameState.ResearchItemsInvented.begin()), - std::make_move_iterator(gameState.ResearchItemsInvented.end())); - gameState.ResearchItemsInvented.clear(); + auto& gameState = getGameState(); + gameState.researchItemsUninvented.insert( + gameState.researchItemsUninvented.end(), std::make_move_iterator(gameState.researchItemsInvented.begin()), + std::make_move_iterator(gameState.researchItemsInvented.end())); + gameState.researchItemsInvented.clear(); } void ResearchItemsMakeAllResearched() { - auto& gameState = GetGameState(); - gameState.ResearchItemsInvented.insert( - gameState.ResearchItemsInvented.end(), std::make_move_iterator(gameState.ResearchItemsUninvented.begin()), - std::make_move_iterator(gameState.ResearchItemsUninvented.end())); - gameState.ResearchItemsUninvented.clear(); + auto& gameState = getGameState(); + gameState.researchItemsInvented.insert( + gameState.researchItemsInvented.end(), std::make_move_iterator(gameState.researchItemsUninvented.begin()), + std::make_move_iterator(gameState.researchItemsUninvented.end())); + gameState.researchItemsUninvented.clear(); } /** @@ -938,9 +938,9 @@ void ResearchItemsMakeAllResearched() */ void ResearchItemsShuffle() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); std::shuffle( - std::begin(gameState.ResearchItemsUninvented), std::end(gameState.ResearchItemsUninvented), + std::begin(gameState.researchItemsUninvented), std::end(gameState.researchItemsUninvented), std::default_random_engine{}); } @@ -961,15 +961,15 @@ void ResearchItem::SetNull() bool ResearchItem::Exists() const { - auto& gameState = GetGameState(); - for (auto const& researchItem : gameState.ResearchItemsUninvented) + auto& gameState = getGameState(); + for (auto const& researchItem : gameState.researchItemsUninvented) { if (researchItem == *this) { return true; } } - for (auto const& researchItem : gameState.ResearchItemsInvented) + for (auto const& researchItem : gameState.researchItemsInvented) { if (researchItem == *this) { @@ -1062,10 +1062,10 @@ static void ResearchMarkRideTypeAsSeen(const ResearchItem& researchItem) void ResearchDetermineFirstOfType() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); _seenRideType.reset(); - for (const auto& researchItem : gameState.ResearchItemsInvented) + for (const auto& researchItem : gameState.researchItemsInvented) { if (researchItem.type != Research::EntryType::Ride) continue; @@ -1078,40 +1078,40 @@ void ResearchDetermineFirstOfType() if (rtd.HasFlag(RtdFlag::listVehiclesSeparately)) continue; - // The last research item will also be present in gameState.ResearchItemsInvented. + // The last research item will also be present in gameState.researchItemsInvented. // Avoid marking its ride type as "invented" prematurely. - if (gameState.ResearchLastItem.has_value() && !gameState.ResearchLastItem->IsNull() - && researchItem == gameState.ResearchLastItem.value()) + if (gameState.researchLastItem.has_value() && !gameState.researchLastItem->IsNull() + && researchItem == gameState.researchLastItem.value()) continue; - // The next research item is (sometimes?) also present in gameState.ResearchItemsInvented, even though it isn't invented + // The next research item is (sometimes?) also present in gameState.researchItemsInvented, even though it isn't invented // yet(!) - if (gameState.ResearchNextItem.has_value() && !gameState.ResearchNextItem->IsNull() - && researchItem == gameState.ResearchNextItem.value()) + if (gameState.researchNextItem.has_value() && !gameState.researchNextItem->IsNull() + && researchItem == gameState.researchNextItem.value()) continue; ResearchMarkRideTypeAsSeen(researchItem); } - if (gameState.ResearchLastItem.has_value()) + if (gameState.researchLastItem.has_value()) { - ResearchUpdateFirstOfType(&gameState.ResearchLastItem.value()); - ResearchMarkRideTypeAsSeen(gameState.ResearchLastItem.value()); + ResearchUpdateFirstOfType(&gameState.researchLastItem.value()); + ResearchMarkRideTypeAsSeen(gameState.researchLastItem.value()); } - if (gameState.ResearchNextItem.has_value()) + if (gameState.researchNextItem.has_value()) { - ResearchUpdateFirstOfType(&gameState.ResearchNextItem.value()); - ResearchMarkRideTypeAsSeen(gameState.ResearchNextItem.value()); + ResearchUpdateFirstOfType(&gameState.researchNextItem.value()); + ResearchMarkRideTypeAsSeen(gameState.researchNextItem.value()); } - for (auto& researchItem : gameState.ResearchItemsUninvented) + for (auto& researchItem : gameState.researchItemsUninvented) { - // The next research item is (sometimes?) also present in gameState.ResearchItemsUninvented - if (gameState.ResearchNextItem.has_value() && !gameState.ResearchNextItem->IsNull() - && researchItem.baseRideType == gameState.ResearchNextItem.value().baseRideType) + // The next research item is (sometimes?) also present in gameState.researchItemsUninvented + if (gameState.researchNextItem.has_value() && !gameState.researchNextItem->IsNull() + && researchItem.baseRideType == gameState.researchNextItem.value().baseRideType) { // Copy the "first of type" flag. - researchItem.flags = gameState.ResearchNextItem->flags; + researchItem.flags = gameState.researchNextItem->flags; continue; } diff --git a/src/openrct2/network/DiscordService.cpp b/src/openrct2/network/DiscordService.cpp index 40660ccc0a..5b5eb687f9 100644 --- a/src/openrct2/network/DiscordService.cpp +++ b/src/openrct2/network/DiscordService.cpp @@ -66,8 +66,8 @@ DiscordService::~DiscordService() static std::string GetParkName() { - auto& gameState = GetGameState(); - return gameState.Park.Name; + auto& gameState = getGameState(); + return gameState.park.Name; } void DiscordService::Tick() diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 0179c6496a..3b3bcf65bf 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -841,7 +841,7 @@ bool NetworkBase::IsDesynchronised() const noexcept bool NetworkBase::CheckDesynchronizaton() { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; // Check synchronisation if (GetMode() == NETWORK_MODE_CLIENT && _serverState.state != NetworkServerStatus::Desynced @@ -1556,7 +1556,7 @@ void NetworkBase::Client_Send_GAME_ACTION(const GameAction* action) DataSerialiser stream(true); action->Serialise(stream); - packet << GetGameState().CurrentTicks << action->GetType() << stream; + packet << getGameState().currentTicks << action->GetType() << stream; _serverConnection->QueuePacket(std::move(packet)); } @@ -1567,7 +1567,7 @@ void NetworkBase::ServerSendGameAction(const GameAction* action) DataSerialiser stream(true); action->Serialise(stream); - packet << GetGameState().CurrentTicks << action->GetType() << stream; + packet << getGameState().currentTicks << action->GetType() << stream; SendPacketToClients(packet); } @@ -1575,7 +1575,7 @@ void NetworkBase::ServerSendGameAction(const GameAction* action) void NetworkBase::ServerSendTick() { NetworkPacket packet(NetworkCommand::Tick); - packet << GetGameState().CurrentTicks << ScenarioRandState().s0; + packet << getGameState().currentTicks << ScenarioRandState().s0; uint32_t flags = 0; // Simple counter which limits how often a sprite checksum gets sent. // This can get somewhat expensive, so we don't want to push it every tick in release, @@ -1602,7 +1602,7 @@ void NetworkBase::ServerSendTick() void NetworkBase::ServerSendPlayerInfo(int32_t playerId) { NetworkPacket packet(NetworkCommand::PlayerInfo); - packet << GetGameState().CurrentTicks; + packet << getGameState().currentTicks; auto* player = GetPlayerByID(playerId); if (player == nullptr) @@ -1615,7 +1615,7 @@ void NetworkBase::ServerSendPlayerInfo(int32_t playerId) void NetworkBase::ServerSendPlayerList() { NetworkPacket packet(NetworkCommand::PlayerList); - packet << GetGameState().CurrentTicks << static_cast(player_list.size()); + packet << getGameState().currentTicks << static_cast(player_list.size()); for (auto& player : player_list) { player->Write(packet); @@ -1909,7 +1909,7 @@ void NetworkBase::ProcessPlayerList() auto itPending = _pendingPlayerLists.begin(); while (itPending != _pendingPlayerLists.end()) { - if (itPending->first > GetGameState().CurrentTicks) + if (itPending->first > getGameState().currentTicks) break; // List of active players found in the list. @@ -1981,7 +1981,7 @@ void NetworkBase::ProcessPlayerList() void NetworkBase::ProcessPlayerInfo() { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; auto range = _pendingPlayerInfo.equal_range(currentTicks); for (auto it = range.first; it != range.second; it++) @@ -2807,7 +2807,7 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti GameLoadInit(); GameLoadScripts(); GameNotifyMapChanged(); - _serverState.tick = GetGameState().CurrentTicks; + _serverState.tick = getGameState().currentTicks; // NetworkStatusOpen("Loaded new map from network"); _serverState.state = NetworkServerStatus::Ok; _clientMapLoaded = true; @@ -2849,7 +2849,7 @@ bool NetworkBase::LoadMap(IStream* stream) objManager.LoadObjects(loadResult.RequiredObjects); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); importer->Import(gameState); EntityTweener::Get().Reset(); @@ -2874,7 +2874,7 @@ bool NetworkBase::SaveMap(IStream* stream, const std::vector(); exporter->ExportObjectsList = objects; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); exporter->Export(gameState, *stream); result = true; } @@ -4098,7 +4098,7 @@ NetworkAuth NetworkGetAuthstatus() } uint32_t NetworkGetServerTick() { - return GetGameState().CurrentTicks; + return getGameState().currentTicks; } void NetworkFlush() { diff --git a/src/openrct2/network/NetworkServerAdvertiser.cpp b/src/openrct2/network/NetworkServerAdvertiser.cpp index cf702f2be0..75293e0a66 100644 --- a/src/openrct2/network/NetworkServerAdvertiser.cpp +++ b/src/openrct2/network/NetworkServerAdvertiser.cpp @@ -303,20 +303,20 @@ private: { "players", numPlayers }, }; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); const auto& date = GetDate(); - json_t mapSize = { { "x", gameState.MapSize.x - 2 }, { "y", gameState.MapSize.y - 2 } }; + json_t mapSize = { { "x", gameState.mapSize.x - 2 }, { "y", gameState.mapSize.y - 2 } }; json_t gameInfo = { { "mapSize", mapSize }, { "day", date.GetMonthTicks() }, { "month", date.GetMonthsElapsed() }, - { "guests", gameState.NumGuestsInPark }, - { "parkValue", gameState.Park.Value }, + { "guests", gameState.numGuestsInPark }, + { "parkValue", gameState.park.Value }, }; - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY)) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY)) { - gameInfo["cash"] = gameState.Cash; + gameInfo["cash"] = gameState.cash; } root["gameInfo"] = gameInfo; diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 400f394d05..4fc85a9d35 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -87,7 +87,7 @@ void Painter::PaintReplayNotice(DrawPixelInfo& dpi, const char* text) auto stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium); screenCoords.x = screenCoords.x - stringWidth; - if (((GetGameState().CurrentTicks >> 1) & 0xF) > 4) + if (((getGameState().currentTicks >> 1) & 0xF) > 4) DrawText(dpi, screenCoords, { COLOUR_SATURATED_RED }, buffer); // Make area dirty so the text doesn't get drawn over the last diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 65d5947223..205cf2fa54 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -247,7 +247,7 @@ static void VirtualFloorGetTileProperties( *tileOwned = MapIsLocationOwned({ loc, height }); - if (GetGameState().Cheats.sandboxMode) + if (getGameState().cheats.sandboxMode) *tileOwned = true; // Iterate through the map elements of the current tile to find: diff --git a/src/openrct2/paint/tile_element/Paint.Banner.cpp b/src/openrct2/paint/tile_element/Paint.Banner.cpp index 023b1d3a4e..938fc49ce9 100644 --- a/src/openrct2/paint/tile_element/Paint.Banner.cpp +++ b/src/openrct2/paint/tile_element/Paint.Banner.cpp @@ -68,7 +68,7 @@ static void PaintBannerScrollingText( } auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); - auto scroll = stringWidth > 0 ? (GetGameState().CurrentTicks / 2) % stringWidth : 0; + auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK); PaintAddImageAsChild(session, imageId, { 0, 0, height + 22 }, { bbOffset, { 1, 1, 21 } }); } diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index faa7aabde1..beadb0aef7 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -76,7 +76,7 @@ static void PaintRideEntranceExitScrollingText( FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data()); } auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); - auto scroll = stringWidth > 0 ? (GetGameState().CurrentTicks / 2) % stringWidth : 0; + auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; PaintAddImageAsChild( session, ScrollingTextSetup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, stationObj.ScrollingMode, COLOUR_BLACK), @@ -222,10 +222,10 @@ static void PaintParkEntranceScrollingText( return; auto ft = Formatter(); - auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) + auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_PARK_OPEN) { - const auto& park = gameState.Park; + const auto& park = gameState.park; auto name = park.Name.c_str(); ft.Add(STR_STRING); ft.Add(name); @@ -247,7 +247,7 @@ static void PaintParkEntranceScrollingText( } auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); - auto scroll = stringWidth > 0 ? (gameState.CurrentTicks / 2) % stringWidth : 0; + auto scroll = stringWidth > 0 ? (gameState.currentTicks / 2) % stringWidth : 0; auto imageIndex = ScrollingTextSetup( session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode + direction / 2, COLOUR_BLACK); auto textHeight = height + entrance.GetTextHeight(); diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index b8c74bf5c9..a5eb7e293b 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -329,7 +329,7 @@ static void PaintLargeSceneryScrollingText( auto scrollMode = sceneryEntry.scrolling_mode + ((direction + 1) & 3); auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); - auto scroll = stringWidth > 0 ? (GetGameState().CurrentTicks / 2) % stringWidth : 0; + auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollMode, textPaletteIndex); PaintAddImageAsChild(session, imageId, { 0, 0, height + 25 }, { bbOffset, { 1, 1, 21 } }); } diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index cbe60647ac..f6b63b8106 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -176,7 +176,7 @@ static void PathPaintQueueBanner( } uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::Tiny); - uint16_t scroll = stringWidth > 0 ? (GetGameState().CurrentTicks / 2) % stringWidth : 0; + uint16_t scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; PaintAddImageAsChild( session, ScrollingTextSetup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK), diff --git a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp index 065a5c8c2f..c0925b36bf 100644 --- a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp @@ -219,7 +219,7 @@ static void PaintSmallSceneryBody( if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ANIMATED)) { - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED) || (session.DPI.zoom_level <= ZoomLevel{ 1 })) { diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index adef3062fb..f44387713c 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1126,13 +1126,13 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con PaintPatrolArea(session, tileElement, height, surfaceShape); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Draw Peep Spawns - if ((gLegacyScene == LegacyScene::scenarioEditor || gameState.Cheats.sandboxMode) + if ((gLegacyScene == LegacyScene::scenarioEditor || gameState.cheats.sandboxMode) && session.ViewFlags & VIEWPORT_FLAG_LAND_OWNERSHIP) { const CoordsXY& pos = session.MapPosition; - for (auto& spawn : gameState.PeepSpawns) + for (auto& spawn : gameState.peepSpawns) { if ((spawn.x & 0xFFE0) == pos.x && (spawn.y & 0xFFE0) == pos.y) { diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index b57a2ae3ec..dcdd5a8e07 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -139,7 +139,7 @@ static void PaintWallWall( { PROFILED_FUNCTION(); - auto frameNum = (wallEntry.flags2 & WALL_SCENERY_2_ANIMATED) ? (GetGameState().CurrentTicks & 7) * 2 : 0; + auto frameNum = (wallEntry.flags2 & WALL_SCENERY_2_ANIMATED) ? (getGameState().currentTicks & 7) * 2 : 0; auto imageIndex = wallEntry.image + imageOffset + frameNum; PaintAddImageAsParent(session, imageTemplate.WithIndex(imageIndex), offset, boundBox); if ((wallEntry.flags & WALL_SCENERY_HAS_GLASS) && !isGhost) @@ -186,7 +186,7 @@ static void PaintWallScrollingText( } auto stringWidth = GfxGetStringWidth(signString, FontStyle::Tiny); - auto scroll = stringWidth > 0 ? (GetGameState().CurrentTicks / 2) % stringWidth : 0; + auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollingMode, textPaletteIndex); PaintAddImageAsChild(session, imageId, { 0, 0, height + 8 }, { boundsOffset, { 1, 1, 13 } }); } diff --git a/src/openrct2/paint/track/water/RiverRapids.cpp b/src/openrct2/paint/track/water/RiverRapids.cpp index 85eec1da5f..4b1c594c0e 100644 --- a/src/openrct2/paint/track/water/RiverRapids.cpp +++ b/src/openrct2/paint/track/water/RiverRapids.cpp @@ -526,7 +526,7 @@ static void PaintRiverRapidsTrackWaterfall( { ImageId imageId; - uint16_t frameNum = (GetGameState().CurrentTicks / 2) & 7; + uint16_t frameNum = (getGameState().currentTicks / 2) & 7; if (direction & 1) { @@ -597,7 +597,7 @@ static void PaintRiverRapidsTrackRapids( { ImageId imageId; - uint16_t frameNum = (GetGameState().CurrentTicks / 2) & 7; + uint16_t frameNum = (getGameState().currentTicks / 2) & 7; if (direction & 1) { @@ -649,7 +649,7 @@ static void PaintRiverRapidsTrackWhirlpool( { ImageId imageId; - uint8_t frameNum = (GetGameState().CurrentTicks / 4) % 16; + uint8_t frameNum = (getGameState().currentTicks / 4) % 16; if (direction & 1) { diff --git a/src/openrct2/paint/vehicle/VehiclePaint.cpp b/src/openrct2/paint/vehicle/VehiclePaint.cpp index 67ceb5127b..fbab6a8c50 100644 --- a/src/openrct2/paint/vehicle/VehiclePaint.cpp +++ b/src/openrct2/paint/vehicle/VehiclePaint.cpp @@ -4155,7 +4155,7 @@ static void vehicle_visual_splash1_effect(PaintSession& session, int32_t z, cons return; } int32_t image_id = SPR_SPLASH_EFFECT_1_NE_0 + ((((vehicle->Orientation / 8) + session.CurrentRotation) & 3) * 8) - + ((GetGameState().CurrentTicks / 2) & 7); + + ((getGameState().currentTicks / 2) & 7); PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { { 0, 0, z }, { 0, 0, 0 } }); } @@ -4178,7 +4178,7 @@ static void vehicle_visual_splash2_effect(PaintSession& session, int32_t z, cons return; } int32_t image_id = SPR_SPLASH_EFFECT_3_NE_0 + ((((vehicle->Orientation / 8) + session.CurrentRotation) & 3) * 8) - + ((GetGameState().CurrentTicks / 2) & 7); + + ((getGameState().currentTicks / 2) & 7); PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { { 0, 0, z }, { 0, 0, 0 } }); } @@ -4201,7 +4201,7 @@ static void vehicle_visual_splash3_effect(PaintSession& session, int32_t z, cons return; } int32_t image_id = SPR_SPLASH_EFFECT_1_NE_0 + ((((vehicle->Orientation / 8) + session.CurrentRotation) & 3) * 8) - + ((GetGameState().CurrentTicks / 2) & 7); + + ((getGameState().currentTicks / 2) & 7); PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { { 0, 0, z }, { 0, 0, 0 } }); } @@ -4229,7 +4229,7 @@ static void vehicle_visual_splash4_effect(PaintSession& session, int32_t z, cons return; } int32_t image_id = SPR_SPLASH_EFFECT_5_NE_0 + ((((vehicle->Orientation / 8) + session.CurrentRotation) & 3) * 8) - + ((GetGameState().CurrentTicks / 2) & 7); + + ((getGameState().currentTicks / 2) & 7); PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { { 0, 0, z }, { 1, 1, 0 } }); } @@ -4261,7 +4261,7 @@ static void vehicle_visual_splash5_effect(PaintSession& session, int32_t z, cons return; } int32_t image_id = SPR_SPLASH_EFFECT_5_NE_0 + ((((vehicle->Orientation / 8) + session.CurrentRotation) & 3) * 8) - + ((GetGameState().CurrentTicks / 2) & 7); + + ((getGameState().currentTicks / 2) & 7); PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { { 0, 0, z }, { 1, 1, 0 } }); } diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 6c5c1d27c4..ba5e64fcdf 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -170,7 +170,7 @@ namespace OpenRCT2 } // Initial cash will eventually be removed - gameState.InitialCash = gameState.Cash; + gameState.initialCash = gameState.cash; } void Save(GameState_t& gameState, IStream& stream) @@ -476,27 +476,27 @@ namespace OpenRCT2 void ReadWriteScenarioChunk(GameState_t& gameState, OrcaStream& os) { os.ReadWriteChunk(ParkFileChunkType::SCENARIO, [&gameState, &os](OrcaStream::ChunkStream& cs) { - cs.ReadWrite(gameState.ScenarioCategory); - ReadWriteStringTable(cs, gameState.ScenarioName, "en-GB"); - ReadWriteStringTable(cs, gameState.Park.Name, "en-GB"); - ReadWriteStringTable(cs, gameState.ScenarioDetails, "en-GB"); + cs.ReadWrite(gameState.scenarioCategory); + ReadWriteStringTable(cs, gameState.scenarioName, "en-GB"); + ReadWriteStringTable(cs, gameState.park.Name, "en-GB"); + ReadWriteStringTable(cs, gameState.scenarioDetails, "en-GB"); - cs.ReadWrite(gameState.ScenarioObjective.Type); - cs.ReadWrite(gameState.ScenarioObjective.Year); - cs.ReadWrite(gameState.ScenarioObjective.NumGuests); - cs.ReadWrite(gameState.ScenarioObjective.Currency); + cs.ReadWrite(gameState.scenarioObjective.Type); + cs.ReadWrite(gameState.scenarioObjective.Year); + cs.ReadWrite(gameState.scenarioObjective.NumGuests); + cs.ReadWrite(gameState.scenarioObjective.Currency); - cs.ReadWrite(gameState.ScenarioParkRatingWarningDays); + cs.ReadWrite(gameState.scenarioParkRatingWarningDays); - cs.ReadWrite(gameState.ScenarioCompletedCompanyValue); - if (gameState.ScenarioCompletedCompanyValue == kMoney64Undefined - || gameState.ScenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) + cs.ReadWrite(gameState.scenarioCompletedCompanyValue); + if (gameState.scenarioCompletedCompanyValue == kMoney64Undefined + || gameState.scenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) { cs.Write(""); } else { - cs.ReadWrite(gameState.ScenarioCompletedBy); + cs.ReadWrite(gameState.scenarioCompletedBy); } if (cs.GetMode() == OrcaStream::Mode::READING) @@ -514,7 +514,7 @@ namespace OpenRCT2 if (os.GetHeader().TargetVersion >= 1) { - cs.ReadWrite(gameState.ScenarioFileName); + cs.ReadWrite(gameState.scenarioFileName); } }); } @@ -562,14 +562,14 @@ namespace OpenRCT2 const uint8_t isPaused = (gGamePaused & GAME_PAUSED_NORMAL); cs.Write(isPaused); } - cs.ReadWrite(gameState.CurrentTicks); + cs.ReadWrite(gameState.currentTicks); if (cs.GetMode() == OrcaStream::Mode::READING) { uint16_t monthTicks; uint32_t monthsElapsed; cs.ReadWrite(monthTicks); cs.ReadWrite(monthsElapsed); - gameState.Date = Date{ monthsElapsed, monthTicks }; + gameState.date = Date{ monthsElapsed, monthTicks }; } else { @@ -584,31 +584,31 @@ namespace OpenRCT2 cs.ReadWrite(s0); cs.ReadWrite(s1); Random::RCT2::Seed s{ s0, s1 }; - gameState.ScenarioRand.seed(s); + gameState.scenarioRand.seed(s); } else { - auto randState = gameState.ScenarioRand.state(); + auto randState = gameState.scenarioRand.state(); cs.Write(randState.s0); cs.Write(randState.s1); } - cs.ReadWrite(gameState.GuestInitialHappiness); + cs.ReadWrite(gameState.guestInitialHappiness); if (version <= 18) { money16 tempGuestInitialCash{}; cs.ReadWrite(tempGuestInitialCash); - gameState.GuestInitialCash = ToMoney64(tempGuestInitialCash); + gameState.guestInitialCash = ToMoney64(tempGuestInitialCash); } else { - cs.ReadWrite(gameState.GuestInitialCash); + cs.ReadWrite(gameState.guestInitialCash); } - cs.ReadWrite(gameState.GuestInitialHunger); - cs.ReadWrite(gameState.GuestInitialThirst); + cs.ReadWrite(gameState.guestInitialHunger); + cs.ReadWrite(gameState.guestInitialThirst); - cs.ReadWrite(gameState.NextGuestNumber); - cs.ReadWriteVector(gameState.PeepSpawns, [&cs](PeepSpawn& spawn) { + cs.ReadWrite(gameState.nextGuestNumber); + cs.ReadWriteVector(gameState.peepSpawns, [&cs](PeepSpawn& spawn) { cs.ReadWrite(spawn.x); cs.ReadWrite(spawn.y); cs.ReadWrite(spawn.z); @@ -621,18 +621,18 @@ namespace OpenRCT2 money16 tempConstructionRightPrice{}; cs.ReadWrite(tempLandPrice); cs.ReadWrite(tempConstructionRightPrice); - gameState.LandPrice = ToMoney64(tempLandPrice); - gameState.ConstructionRightsPrice = ToMoney64(tempConstructionRightPrice); + gameState.landPrice = ToMoney64(tempLandPrice); + gameState.constructionRightsPrice = ToMoney64(tempConstructionRightPrice); } else { - cs.ReadWrite(gameState.LandPrice); - cs.ReadWrite(gameState.ConstructionRightsPrice); + cs.ReadWrite(gameState.landPrice); + cs.ReadWrite(gameState.constructionRightsPrice); } - cs.ReadWrite(gameState.GrassSceneryTileLoopPosition); - cs.ReadWrite(gameState.WidePathTileLoopPosition); + cs.ReadWrite(gameState.grassSceneryTileLoopPosition); + cs.ReadWrite(gameState.widePathTileLoopPosition); - auto& rideRatings = gameState.RideRatingUpdateStates; + auto& rideRatings = gameState.rideRatingUpdateStates; if (os.GetHeader().TargetVersion >= 21) { cs.ReadWriteArray(rideRatings, [this, &cs](RideRatingUpdateState& calcData) { @@ -685,20 +685,20 @@ namespace OpenRCT2 void ReadWriteInterfaceChunk(GameState_t& gameState, OrcaStream& os) { os.ReadWriteChunk(ParkFileChunkType::INTERFACE, [&gameState](OrcaStream::ChunkStream& cs) { - cs.ReadWrite(gameState.SavedView.x); - cs.ReadWrite(gameState.SavedView.y); + cs.ReadWrite(gameState.savedView.x); + cs.ReadWrite(gameState.savedView.y); if (cs.GetMode() == OrcaStream::Mode::READING) { auto savedZoomlevel = static_cast(cs.Read()); - gameState.SavedViewZoom = std::clamp(savedZoomlevel, ZoomLevel::min(), ZoomLevel::max()); + gameState.savedViewZoom = std::clamp(savedZoomlevel, ZoomLevel::min(), ZoomLevel::max()); } else { - cs.Write(static_cast(gameState.SavedViewZoom)); + cs.Write(static_cast(gameState.savedViewZoom)); } - cs.ReadWrite(gameState.SavedViewRotation); - cs.ReadWrite(gameState.LastEntranceStyle); - cs.ReadWrite(gameState.EditorStep); + cs.ReadWrite(gameState.savedViewRotation); + cs.ReadWrite(gameState.lastEntranceStyle); + cs.ReadWrite(gameState.editorStep); }); } @@ -739,9 +739,9 @@ namespace OpenRCT2 #ifdef ENABLE_SCRIPTING // Dump the plugin storage to JSON (stored in park) auto& scriptEngine = GetContext()->GetScriptEngine(); - gameState.PluginStorage = scriptEngine.GetParkStorageAsJSON(); + gameState.pluginStorage = scriptEngine.GetParkStorageAsJSON(); #endif - if (gameState.PluginStorage.empty() || gameState.PluginStorage == "{}") + if (gameState.pluginStorage.empty() || gameState.pluginStorage == "{}") { // Don't write the chunk if there is no plugin storage return; @@ -749,14 +749,14 @@ namespace OpenRCT2 } os.ReadWriteChunk(ParkFileChunkType::PLUGIN_STORAGE, [&gameState](OrcaStream::ChunkStream& cs) { - cs.ReadWrite(gameState.PluginStorage); + cs.ReadWrite(gameState.pluginStorage); }); if (os.GetMode() == OrcaStream::Mode::READING) { #ifdef ENABLE_SCRIPTING auto& scriptEngine = GetContext()->GetScriptEngine(); - scriptEngine.SetParkStorageFromJSON(gameState.PluginStorage); + scriptEngine.SetParkStorageFromJSON(gameState.pluginStorage); #endif } } @@ -867,9 +867,9 @@ namespace OpenRCT2 cs.Ignore(); } - cs.ReadWrite(gameState.WeatherUpdateTimer); + cs.ReadWrite(gameState.weatherUpdateTimer); - for (auto* cl : { &gameState.WeatherCurrent, &gameState.WeatherNext }) + for (auto* cl : { &gameState.weatherCurrent, &gameState.weatherNext }) { cs.ReadWrite(cl->weatherType); cs.ReadWrite(cl->temperature); @@ -884,27 +884,27 @@ namespace OpenRCT2 { os.ReadWriteChunk( ParkFileChunkType::PARK, [version = os.GetHeader().TargetVersion, &gameState](OrcaStream::ChunkStream& cs) { - cs.ReadWrite(gameState.Park.Name); - cs.ReadWrite(gameState.Cash); - cs.ReadWrite(gameState.BankLoan); - cs.ReadWrite(gameState.MaxBankLoan); - cs.ReadWrite(gameState.BankLoanInterestRate); - cs.ReadWrite(gameState.Park.Flags); + cs.ReadWrite(gameState.park.Name); + cs.ReadWrite(gameState.cash); + cs.ReadWrite(gameState.bankLoan); + cs.ReadWrite(gameState.maxBankLoan); + cs.ReadWrite(gameState.bankLoanInterestRate); + cs.ReadWrite(gameState.park.Flags); if (version <= 18) { money16 tempParkEntranceFee{}; cs.ReadWrite(tempParkEntranceFee); - gameState.Park.EntranceFee = ToMoney64(tempParkEntranceFee); + gameState.park.EntranceFee = ToMoney64(tempParkEntranceFee); } else { - cs.ReadWrite(gameState.Park.EntranceFee); + cs.ReadWrite(gameState.park.EntranceFee); } - cs.ReadWrite(gameState.StaffHandymanColour); - cs.ReadWrite(gameState.StaffMechanicColour); - cs.ReadWrite(gameState.StaffSecurityColour); - cs.ReadWrite(gameState.SamePriceThroughoutPark); + cs.ReadWrite(gameState.staffHandymanColour); + cs.ReadWrite(gameState.staffMechanicColour); + cs.ReadWrite(gameState.staffSecurityColour); + cs.ReadWrite(gameState.samePriceThroughoutPark); // Finances if (cs.GetMode() == OrcaStream::Mode::READING) @@ -915,7 +915,7 @@ namespace OpenRCT2 { for (uint32_t j = 0; j < numTypes; j++) { - gameState.ExpenditureTable[i][j] = cs.Read(); + gameState.expenditureTable[i][j] = cs.Read(); } } } @@ -930,14 +930,14 @@ namespace OpenRCT2 { for (uint32_t j = 0; j < numTypes; j++) { - cs.Write(gameState.ExpenditureTable[i][j]); + cs.Write(gameState.expenditureTable[i][j]); } } } - cs.ReadWrite(gameState.HistoricalProfit); + cs.ReadWrite(gameState.historicalProfit); // Marketing - cs.ReadWriteVector(gameState.MarketingCampaigns, [&cs](MarketingCampaign& campaign) { + cs.ReadWriteVector(gameState.marketingCampaigns, [&cs](MarketingCampaign& campaign) { cs.ReadWrite(campaign.Type); cs.ReadWrite(campaign.WeeksLeft); cs.ReadWrite(campaign.Flags); @@ -945,7 +945,7 @@ namespace OpenRCT2 }); // Awards - auto& currentAwards = gameState.CurrentAwards; + auto& currentAwards = gameState.currentAwards; if (version <= 6) { Award awards[RCT2::Limits::kMaxAwards]{}; @@ -968,35 +968,35 @@ namespace OpenRCT2 cs.ReadWrite(award.Type); }); } - cs.ReadWrite(gameState.Park.Value); - cs.ReadWrite(gameState.CompanyValue); - cs.ReadWrite(gameState.Park.Size); - cs.ReadWrite(gameState.NumGuestsInPark); - cs.ReadWrite(gameState.NumGuestsHeadingForPark); - cs.ReadWrite(gameState.Park.Rating); - cs.ReadWrite(gameState.Park.RatingCasualtyPenalty); - cs.ReadWrite(gameState.CurrentExpenditure); - cs.ReadWrite(gameState.CurrentProfit); - cs.ReadWrite(gameState.WeeklyProfitAverageDividend); - cs.ReadWrite(gameState.WeeklyProfitAverageDivisor); - cs.ReadWrite(gameState.TotalAdmissions); - cs.ReadWrite(gameState.TotalIncomeFromAdmissions); + cs.ReadWrite(gameState.park.Value); + cs.ReadWrite(gameState.companyValue); + cs.ReadWrite(gameState.park.Size); + cs.ReadWrite(gameState.numGuestsInPark); + cs.ReadWrite(gameState.numGuestsHeadingForPark); + cs.ReadWrite(gameState.park.Rating); + cs.ReadWrite(gameState.park.RatingCasualtyPenalty); + cs.ReadWrite(gameState.currentExpenditure); + cs.ReadWrite(gameState.currentProfit); + cs.ReadWrite(gameState.weeklyProfitAverageDividend); + cs.ReadWrite(gameState.weeklyProfitAverageDivisor); + cs.ReadWrite(gameState.totalAdmissions); + cs.ReadWrite(gameState.totalIncomeFromAdmissions); if (version <= 16) { money16 legacyTotalRideValueForMoney = 0; cs.ReadWrite(legacyTotalRideValueForMoney); - gameState.TotalRideValueForMoney = legacyTotalRideValueForMoney; + gameState.totalRideValueForMoney = legacyTotalRideValueForMoney; } else { - cs.ReadWrite(gameState.TotalRideValueForMoney); + cs.ReadWrite(gameState.totalRideValueForMoney); } - cs.ReadWrite(gameState.NumGuestsInParkLastWeek); - cs.ReadWrite(gameState.GuestChangeModifier); - cs.ReadWrite(gameState.GuestGenerationProbability); - cs.ReadWrite(gameState.SuggestedGuestMaximum); + cs.ReadWrite(gameState.numGuestsInParkLastWeek); + cs.ReadWrite(gameState.guestChangeModifier); + cs.ReadWrite(gameState.guestGenerationProbability); + cs.ReadWrite(gameState.suggestedGuestMaximum); - cs.ReadWriteArray(gameState.PeepWarningThrottle, [&cs](uint8_t& value) { + cs.ReadWriteArray(gameState.peepWarningThrottle, [&cs](uint8_t& value) { cs.ReadWrite(value); return true; }); @@ -1013,10 +1013,10 @@ namespace OpenRCT2 for (int i = 0; i < kParkRatingHistorySize; i++) { if (smallHistory[i] == RCT12ParkHistoryUndefined) - gameState.Park.RatingHistory[i] = kParkRatingHistoryUndefined; + gameState.park.RatingHistory[i] = kParkRatingHistoryUndefined; else { - gameState.Park.RatingHistory[i] = static_cast( + gameState.park.RatingHistory[i] = static_cast( smallHistory[i] * RCT12ParkRatingHistoryFactor); } } @@ -1026,12 +1026,12 @@ namespace OpenRCT2 uint8_t smallHistory[kParkRatingHistorySize]; for (int i = 0; i < kParkRatingHistorySize; i++) { - if (gameState.Park.RatingHistory[i] == kParkRatingHistoryUndefined) + if (gameState.park.RatingHistory[i] == kParkRatingHistoryUndefined) smallHistory[i] = RCT12ParkHistoryUndefined; else { smallHistory[i] = static_cast( - gameState.Park.RatingHistory[i] / RCT12ParkRatingHistoryFactor); + gameState.park.RatingHistory[i] / RCT12ParkRatingHistoryFactor); } } cs.ReadWriteArray(smallHistory, [&cs](uint8_t& value) { @@ -1042,26 +1042,26 @@ namespace OpenRCT2 } else { - cs.ReadWriteArray(gameState.Park.RatingHistory, [&cs](uint16_t& value) { + cs.ReadWriteArray(gameState.park.RatingHistory, [&cs](uint16_t& value) { cs.ReadWrite(value); return true; }); } - cs.ReadWriteArray(gameState.GuestsInParkHistory, [&cs](uint32_t& value) { + cs.ReadWriteArray(gameState.guestsInParkHistory, [&cs](uint32_t& value) { cs.ReadWrite(value); return true; }); - cs.ReadWriteArray(gameState.CashHistory, [&cs](money64& value) { + cs.ReadWriteArray(gameState.cashHistory, [&cs](money64& value) { cs.ReadWrite(value); return true; }); - cs.ReadWriteArray(gameState.WeeklyProfitHistory, [&cs](money64& value) { + cs.ReadWriteArray(gameState.weeklyProfitHistory, [&cs](money64& value) { cs.ReadWrite(value); return true; }); - cs.ReadWriteArray(gameState.Park.ValueHistory, [&cs](money64& value) { + cs.ReadWriteArray(gameState.park.ValueHistory, [&cs](money64& value) { cs.ReadWrite(value); return true; }); @@ -1072,20 +1072,20 @@ namespace OpenRCT2 { os.ReadWriteChunk(ParkFileChunkType::RESEARCH, [&gameState](OrcaStream::ChunkStream& cs) { // Research status - cs.ReadWrite(gameState.ResearchFundingLevel); - cs.ReadWrite(gameState.ResearchPriorities); - cs.ReadWrite(gameState.ResearchProgressStage); - cs.ReadWrite(gameState.ResearchProgress); - cs.ReadWrite(gameState.ResearchExpectedMonth); - cs.ReadWrite(gameState.ResearchExpectedDay); - ReadWriteResearchItem(cs, gameState.ResearchLastItem); - ReadWriteResearchItem(cs, gameState.ResearchNextItem); + cs.ReadWrite(gameState.researchFundingLevel); + cs.ReadWrite(gameState.researchPriorities); + cs.ReadWrite(gameState.researchProgressStage); + cs.ReadWrite(gameState.researchProgress); + cs.ReadWrite(gameState.researchExpectedMonth); + cs.ReadWrite(gameState.researchExpectedDay); + ReadWriteResearchItem(cs, gameState.researchLastItem); + ReadWriteResearchItem(cs, gameState.researchNextItem); // Invention list cs.ReadWriteVector( - gameState.ResearchItemsUninvented, [&cs](ResearchItem& item) { ReadWriteResearchItem(cs, item); }); + gameState.researchItemsUninvented, [&cs](ResearchItem& item) { ReadWriteResearchItem(cs, item); }); cs.ReadWriteVector( - gameState.ResearchItemsInvented, [&cs](ResearchItem& item) { ReadWriteResearchItem(cs, item); }); + gameState.researchItemsInvented, [&cs](ResearchItem& item) { ReadWriteResearchItem(cs, item); }); }); } @@ -1140,11 +1140,11 @@ namespace OpenRCT2 else { std::vector recent( - std::begin(gameState.NewsItems.GetRecent()), std::end(gameState.NewsItems.GetRecent())); + std::begin(gameState.newsItems.GetRecent()), std::end(gameState.newsItems.GetRecent())); cs.ReadWriteVector(recent, [&cs](News::Item& item) { ReadWriteNewsItem(cs, item); }); std::vector archived( - std::begin(gameState.NewsItems.GetArchived()), std::end(gameState.NewsItems.GetArchived())); + std::begin(gameState.newsItems.GetArchived()), std::end(gameState.newsItems.GetArchived())); cs.ReadWriteVector(archived, [&cs](News::Item& item) { ReadWriteNewsItem(cs, item); }); } }); @@ -1178,12 +1178,12 @@ namespace OpenRCT2 auto found = os.ReadWriteChunk( ParkFileChunkType::TILES, [pathToSurfaceMap, pathToQueueSurfaceMap, pathToRailingsMap, &os, &gameState](OrcaStream::ChunkStream& cs) { - cs.ReadWrite(gameState.MapSize.x); - cs.ReadWrite(gameState.MapSize.y); + cs.ReadWrite(gameState.mapSize.x); + cs.ReadWrite(gameState.mapSize.y); if (cs.GetMode() == OrcaStream::Mode::READING) { - gameStateInitAll(gameState, gameState.MapSize); + gameStateInitAll(gameState, gameState.mapSize); auto numElements = cs.Read(); @@ -1265,10 +1265,10 @@ namespace OpenRCT2 void UpdateTrackElementsRideType() { - auto& gameState = GetGameState(); - for (int32_t y = 0; y < gameState.MapSize.y; y++) + auto& gameState = getGameState(); + for (int32_t y = 0; y < gameState.mapSize.y; y++) { - for (int32_t x = 0; x < gameState.MapSize.x; x++) + for (int32_t x = 0; x < gameState.mapSize.x; x++) { TileElement* tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y }); if (tileElement == nullptr) diff --git a/src/openrct2/park/ParkPreview.cpp b/src/openrct2/park/ParkPreview.cpp index ee60ee3c5f..204fc644b5 100644 --- a/src/openrct2/park/ParkPreview.cpp +++ b/src/openrct2/park/ParkPreview.cpp @@ -31,15 +31,15 @@ namespace OpenRCT2 ParkPreview generatePreviewFromGameState(const GameState_t& gameState) { ParkPreview preview{ - .parkName = gameState.Park.Name, - .parkRating = gameState.Park.Rating, - .year = gameState.Date.GetYear(), - .month = gameState.Date.GetMonth(), - .day = gameState.Date.GetDay(), - .parkUsesMoney = !(gameState.Park.Flags & PARK_FLAGS_NO_MONEY), - .cash = gameState.Cash, + .parkName = gameState.park.Name, + .parkRating = gameState.park.Rating, + .year = gameState.date.GetYear(), + .month = gameState.date.GetMonth(), + .day = gameState.date.GetDay(), + .parkUsesMoney = !(gameState.park.Flags & PARK_FLAGS_NO_MONEY), + .cash = gameState.cash, .numRides = static_cast(RideManager().size()), - .numGuests = static_cast(gameState.NumGuestsInPark), + .numGuests = static_cast(gameState.numGuestsInPark), }; if (auto image = generatePreviewMap(); image != std::nullopt) @@ -114,9 +114,9 @@ namespace OpenRCT2 // 0x0046DB4C static std::optional generatePreviewMap() { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); const auto previewSize = 128; - const auto longEdgeSize = std::max(gameState.MapSize.x, gameState.MapSize.y); + const auto longEdgeSize = std::max(gameState.mapSize.x, gameState.mapSize.y); const auto nearestPower = Numerics::ceil2(longEdgeSize, previewSize); const auto mapSkipFactor = nearestPower / previewSize; const auto offset = mapSkipFactor > 0 ? (nearestPower - longEdgeSize) / mapSkipFactor : 1; @@ -131,7 +131,7 @@ namespace OpenRCT2 { for (auto x = 0u; x < image.width; x++) { - auto pos = TileCoordsXY(gameState.MapSize.x - (x + 1) * mapSkipFactor + 1, y * mapSkipFactor + 1); + auto pos = TileCoordsXY(gameState.mapSize.x - (x + 1) * mapSkipFactor + 1, y * mapSkipFactor + 1); image.pixels[(y + offset) * previewSize + (x + offset)] = getPreviewColourByTilePos(pos); } @@ -145,7 +145,7 @@ namespace OpenRCT2 if (gOpenRCT2NoGraphics) return std::nullopt; - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); const auto mainWindow = WindowGetMain(); const auto mainViewport = WindowGetViewport(mainWindow); @@ -157,9 +157,9 @@ namespace OpenRCT2 const auto mapPos = ViewportPosToMapPos(centre, 24, mainViewport->rotation); mapPosXYZ = CoordsXYZ(mapPos.x, mapPos.y, int32_t{ TileElementHeight(mapPos) }); } - else if (!gameState.Park.Entrances.empty()) + else if (!gameState.park.Entrances.empty()) { - const auto& entrance = gameState.Park.Entrances[0]; + const auto& entrance = gameState.park.Entrances[0]; mapPosXYZ = CoordsXYZ{ entrance.x + 16, entrance.y + 16, entrance.z + 32 }; } else diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 39e5095936..f880ff009f 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -1572,7 +1572,7 @@ namespace OpenRCT2::PathFinding { std::optional chosenEntrance = std::nullopt; uint16_t nearestDist = 0xFFFF; - for (const auto& parkEntrance : GetGameState().Park.Entrances) + for (const auto& parkEntrance : getGameState().park.Entrances) { auto dist = abs(parkEntrance.x - loc.x) + abs(parkEntrance.y - loc.y); if (dist < nearestDist) @@ -1610,14 +1610,14 @@ namespace OpenRCT2::PathFinding * Gets the nearest peep spawn relative to point, by using Manhattan distance. * @param x x coordinate of location * @param y y coordinate of location - * @return Index of gameState.PeepSpawns (or 0xFF if no peep spawns exist). + * @return Index of gameState.peepSpawns (or 0xFF if no peep spawns exist). */ static uint8_t GetNearestPeepSpawnIndex(uint16_t x, uint16_t y) { uint8_t chosenSpawn = 0xFF; uint16_t nearestDist = 0xFFFF; uint8_t i = 0; - for (const auto& spawn : GetGameState().PeepSpawns) + for (const auto& spawn : getGameState().peepSpawns) { uint16_t dist = abs(spawn.x - x) + abs(spawn.y - y); if (dist < nearestDist) @@ -1643,7 +1643,7 @@ namespace OpenRCT2::PathFinding if (chosenSpawn == 0xFF) return GuestPathfindAimless(peep, edges); - const auto peepSpawnLoc = GetGameState().PeepSpawns[chosenSpawn].ToTileStart(); + const auto peepSpawnLoc = getGameState().peepSpawns[chosenSpawn].ToTileStart(); Direction direction = peepSpawnLoc.direction; if (peepSpawnLoc.x == peep.NextLoc.x && peepSpawnLoc.y == peep.NextLoc.y) diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 7c865e427d..6777c63e5a 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -182,7 +182,7 @@ static bool OnCrash( auto& objManager = ctx->GetObjectManager(); exporter->ExportObjectsList = objManager.GetPackableObjects(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); exporter->Export(gameState, saveFilePathUTF8.c_str()); savedGameDumped = true; } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 23f4d75ce4..8b7804b9e0 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -355,13 +355,13 @@ namespace OpenRCT2::RCT1 uint16_t mapSize = _s4.MapSize == 0 ? Limits::kMaxMapSize : _s4.MapSize; - gameState.ScenarioFileName = GetRCT1ScenarioName(); + gameState.scenarioFileName = GetRCT1ScenarioName(); // Do map initialisation, same kind of stuff done when loading scenario editor gameStateInitAll(gameState, { mapSize, mapSize }); - gameState.EditorStep = EditorStep::ObjectSelection; - gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; - gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; + gameState.editorStep = EditorStep::ObjectSelection; + gameState.park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + gameState.scenarioCategory = SCENARIO_CATEGORY_OTHER; } std::string GetRCT1ScenarioName() @@ -1461,54 +1461,54 @@ namespace OpenRCT2::RCT1 void ImportPeepSpawns(GameState_t& gameState) { - gameState.PeepSpawns.clear(); + gameState.peepSpawns.clear(); for (size_t i = 0; i < Limits::kMaxPeepSpawns; i++) { if (_s4.PeepSpawn[i].x != RCT12_PEEP_SPAWN_UNDEFINED) { PeepSpawn spawn = { _s4.PeepSpawn[i].x, _s4.PeepSpawn[i].y, _s4.PeepSpawn[i].z * 16, _s4.PeepSpawn[i].direction }; - gameState.PeepSpawns.push_back(spawn); + gameState.peepSpawns.push_back(spawn); } } } void ImportFinance(GameState_t& gameState) { - gameState.Park.EntranceFee = _s4.ParkEntranceFee; - gameState.LandPrice = ToMoney64(_s4.LandPrice); - gameState.ConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice); + gameState.park.EntranceFee = _s4.ParkEntranceFee; + gameState.landPrice = ToMoney64(_s4.LandPrice); + gameState.constructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice); - gameState.Cash = ToMoney64(_s4.Cash); - gameState.BankLoan = ToMoney64(_s4.Loan); - gameState.MaxBankLoan = ToMoney64(_s4.MaxLoan); + gameState.cash = ToMoney64(_s4.Cash); + gameState.bankLoan = ToMoney64(_s4.Loan); + gameState.maxBankLoan = ToMoney64(_s4.MaxLoan); // It's more like 1.33%, but we can only use integers. Can be fixed once we have our own save format. - gameState.BankLoanInterestRate = 1; - gameState.InitialCash = ToMoney64(_s4.Cash); + gameState.bankLoanInterestRate = 1; + gameState.initialCash = ToMoney64(_s4.Cash); - gameState.CompanyValue = ToMoney64(_s4.CompanyValue); - gameState.Park.Value = CorrectRCT1ParkValue(_s4.ParkValue); - gameState.CurrentProfit = ToMoney64(_s4.Profit); + gameState.companyValue = ToMoney64(_s4.CompanyValue); + gameState.park.Value = CorrectRCT1ParkValue(_s4.ParkValue); + gameState.currentProfit = ToMoney64(_s4.Profit); for (size_t i = 0; i < Limits::kFinanceGraphSize; i++) { - gameState.CashHistory[i] = ToMoney64(_s4.CashHistory[i]); - gameState.Park.ValueHistory[i] = CorrectRCT1ParkValue(_s4.ParkValueHistory[i]); - gameState.WeeklyProfitHistory[i] = ToMoney64(_s4.WeeklyProfitHistory[i]); + gameState.cashHistory[i] = ToMoney64(_s4.CashHistory[i]); + gameState.park.ValueHistory[i] = CorrectRCT1ParkValue(_s4.ParkValueHistory[i]); + gameState.weeklyProfitHistory[i] = ToMoney64(_s4.WeeklyProfitHistory[i]); } for (size_t i = 0; i < Limits::kExpenditureTableMonthCount; i++) { for (size_t j = 0; j < Limits::kExpenditureTypeCount; j++) { - gameState.ExpenditureTable[i][j] = ToMoney64(_s4.Expenditure[i][j]); + gameState.expenditureTable[i][j] = ToMoney64(_s4.Expenditure[i][j]); } } - gameState.CurrentExpenditure = ToMoney64(_s4.TotalExpenditure); + gameState.currentExpenditure = ToMoney64(_s4.TotalExpenditure); - gameState.ScenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s4.CompletedCompanyValue); - gameState.TotalAdmissions = _s4.NumAdmissions; - gameState.TotalIncomeFromAdmissions = ToMoney64(_s4.AdmissionTotalIncome); + gameState.scenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s4.CompletedCompanyValue); + gameState.totalAdmissions = _s4.NumAdmissions; + gameState.totalIncomeFromAdmissions = ToMoney64(_s4.AdmissionTotalIncome); // TODO marketing campaigns not working static_assert( @@ -1529,7 +1529,7 @@ namespace OpenRCT2::RCT1 { campaign.ShopItemType = ShopItem(_s4.MarketingAssoc[i]); } - gameState.MarketingCampaigns.push_back(campaign); + gameState.marketingCampaigns.push_back(campaign); } } } @@ -2095,41 +2095,41 @@ namespace OpenRCT2::RCT1 { activeResearchTypes |= EnumToFlag(ResearchCategory::SceneryGroup); } - gameState.ResearchPriorities = activeResearchTypes; - gameState.ResearchFundingLevel = _s4.ResearchLevel; + gameState.researchPriorities = activeResearchTypes; + gameState.researchFundingLevel = _s4.ResearchLevel; // This will mark items as researched/unresearched according to the research list. // This needs to be called before importing progress, as it will reset it. ResearchResetCurrentItem(); // Research history - gameState.ResearchProgress = _s4.ResearchProgress; - gameState.ResearchProgressStage = _s4.ResearchProgressStage; - gameState.ResearchExpectedDay = _s4.NextResearchExpectedDay; - gameState.ResearchExpectedMonth = _s4.NextResearchExpectedMonth; + gameState.researchProgress = _s4.ResearchProgress; + gameState.researchProgressStage = _s4.ResearchProgressStage; + gameState.researchExpectedDay = _s4.NextResearchExpectedDay; + gameState.researchExpectedMonth = _s4.NextResearchExpectedMonth; if (_s4.LastResearchFlags == 0xFF) { - gameState.ResearchLastItem = std::nullopt; + gameState.researchLastItem = std::nullopt; } else { ::ResearchItem researchItem = {}; ConvertResearchEntry(&researchItem, _s4.LastResearchItem, _s4.LastResearchType); - gameState.ResearchLastItem = researchItem; + gameState.researchLastItem = researchItem; } if (_s4.NextResearchFlags == 0xFF) { - gameState.ResearchNextItem = std::nullopt; - gameState.ResearchProgressStage = RESEARCH_STAGE_INITIAL_RESEARCH; - gameState.ResearchProgress = 0; + gameState.researchNextItem = std::nullopt; + gameState.researchProgressStage = RESEARCH_STAGE_INITIAL_RESEARCH; + gameState.researchProgress = 0; } else { ::ResearchItem researchItem = {}; ConvertResearchEntry(&researchItem, _s4.NextResearchItem, _s4.NextResearchType); - gameState.ResearchNextItem = researchItem; + gameState.researchNextItem = researchItem; } } @@ -2188,7 +2188,7 @@ namespace OpenRCT2::RCT1 } } - auto& park = gameState.Park; + auto& park = gameState.park; park.Name = std::move(parkName); } @@ -2235,31 +2235,31 @@ namespace OpenRCT2::RCT1 void ImportParkFlags(GameState_t& gameState) { // Date and srand - gameState.CurrentTicks = _s4.Ticks; + gameState.currentTicks = _s4.Ticks; ScenarioRandSeed(_s4.RandomA, _s4.RandomB); - gameState.Date = Date{ _s4.Month, _s4.Day }; + gameState.date = Date{ _s4.Month, _s4.Day }; // Park rating - gameState.Park.Rating = _s4.ParkRating; + gameState.park.Rating = _s4.ParkRating; Park::ResetHistories(gameState); for (size_t i = 0; i < std::size(_s4.ParkRatingHistory); i++) { if (_s4.ParkRatingHistory[i] != RCT12ParkHistoryUndefined) { - gameState.Park.RatingHistory[i] = _s4.ParkRatingHistory[i] * RCT12ParkRatingHistoryFactor; + gameState.park.RatingHistory[i] = _s4.ParkRatingHistory[i] * RCT12ParkRatingHistoryFactor; } } for (size_t i = 0; i < std::size(_s4.GuestsInParkHistory); i++) { if (_s4.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined) { - gameState.GuestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; + gameState.guestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; } } // Awards - auto& currentAwards = gameState.CurrentAwards; + auto& currentAwards = gameState.currentAwards; for (auto& src : _s4.Awards) { if (src.Time != 0) @@ -2270,13 +2270,13 @@ namespace OpenRCT2::RCT1 // Number of guests history std::fill( - std::begin(gameState.GuestsInParkHistory), std::end(gameState.GuestsInParkHistory), + std::begin(gameState.guestsInParkHistory), std::end(gameState.guestsInParkHistory), std::numeric_limits::max()); for (size_t i = 0; i < std::size(_s4.GuestsInParkHistory); i++) { if (_s4.GuestsInParkHistory[i] != std::numeric_limits::max()) { - gameState.GuestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * 20; + gameState.guestsInParkHistory[i] = _s4.GuestsInParkHistory[i] * 20; } } @@ -2286,35 +2286,35 @@ namespace OpenRCT2::RCT1 News::importNewsItems(gameState, recentMessages, archivedMessages); // Initial guest status - gameState.GuestInitialCash = ToMoney64(_s4.GuestInitialCash); - gameState.GuestInitialHunger = _s4.GuestInitialHunger; - gameState.GuestInitialThirst = _s4.GuestInitialThirst; - gameState.GuestInitialHappiness = _s4.GuestInitialHappiness; + gameState.guestInitialCash = ToMoney64(_s4.GuestInitialCash); + gameState.guestInitialHunger = _s4.GuestInitialHunger; + gameState.guestInitialThirst = _s4.GuestInitialThirst; + gameState.guestInitialHappiness = _s4.GuestInitialHappiness; - gameState.GuestGenerationProbability = _s4.GuestGenerationProbability; + gameState.guestGenerationProbability = _s4.GuestGenerationProbability; // Staff colours - gameState.StaffHandymanColour = RCT1::GetColour(_s4.HandymanColour); - gameState.StaffMechanicColour = RCT1::GetColour(_s4.MechanicColour); - gameState.StaffSecurityColour = RCT1::GetColour(_s4.SecurityGuardColour); + gameState.staffHandymanColour = RCT1::GetColour(_s4.HandymanColour); + gameState.staffMechanicColour = RCT1::GetColour(_s4.MechanicColour); + gameState.staffSecurityColour = RCT1::GetColour(_s4.SecurityGuardColour); // Flags - gameState.Park.Flags = _s4.ParkFlags; - gameState.Park.Flags &= ~PARK_FLAGS_ANTI_CHEAT_DEPRECATED; - gameState.Park.Flags |= PARK_FLAGS_RCT1_INTEREST; + gameState.park.Flags = _s4.ParkFlags; + gameState.park.Flags &= ~PARK_FLAGS_ANTI_CHEAT_DEPRECATED; + gameState.park.Flags |= PARK_FLAGS_RCT1_INTEREST; // 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 (!(_s4.ParkFlags & RCT1_PARK_FLAGS_PARK_ENTRY_LOCKED_AT_FREE)) { - gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; } - gameState.Park.Size = _s4.ParkSize; - gameState.TotalRideValueForMoney = _s4.TotalRideValueForMoney; - gameState.SamePriceThroughoutPark = 0; + gameState.park.Size = _s4.ParkSize; + gameState.totalRideValueForMoney = _s4.TotalRideValueForMoney; + gameState.samePriceThroughoutPark = 0; if (_gameVersion == FILE_VERSION_RCT1_LL) { - gameState.SamePriceThroughoutPark = _s4.SamePriceThroughout; + gameState.samePriceThroughoutPark = _s4.SamePriceThroughout; } } @@ -2376,15 +2376,15 @@ namespace OpenRCT2::RCT1 void ImportClimate(GameState_t& gameState) { - gameState.WeatherUpdateTimer = _s4.WeatherUpdateTimer; - gameState.WeatherCurrent = { + gameState.weatherUpdateTimer = _s4.WeatherUpdateTimer; + gameState.weatherCurrent = { .weatherType = WeatherType{ _s4.Weather }, .temperature = static_cast(_s4.Temperature), .weatherEffect = WeatherEffectType::None, .weatherGloom = _s4.WeatherGloom, .level = static_cast(_s4.Rain), }; - gameState.WeatherNext = { + gameState.weatherNext = { .weatherType = WeatherType{ _s4.TargetWeather }, .temperature = static_cast(_s4.TargetTemperature), .weatherEffect = WeatherEffectType::None, @@ -2425,39 +2425,39 @@ namespace OpenRCT2::RCT1 } } - gameState.ScenarioName = std::move(name); - gameState.ScenarioDetails = std::move(details); + gameState.scenarioName = std::move(name); + gameState.scenarioDetails = std::move(details); if (_isScenario && !parkName.empty()) { - auto& park = GetGameState().Park; + auto& park = getGameState().park; park.Name = std::move(parkName); } } void ImportScenarioObjective(GameState_t& gameState) { - gameState.ScenarioObjective.Type = _s4.ScenarioObjectiveType; - gameState.ScenarioObjective.Year = _s4.ScenarioObjectiveYears; - gameState.ScenarioObjective.NumGuests = _s4.ScenarioObjectiveNumGuests; + gameState.scenarioObjective.Type = _s4.ScenarioObjectiveType; + gameState.scenarioObjective.Year = _s4.ScenarioObjectiveYears; + gameState.scenarioObjective.NumGuests = _s4.ScenarioObjectiveNumGuests; // RCT1 used a different way of calculating the park value. // This is corrected here, but since scenario_objective_currency doubles as minimum excitement rating, // we need to check the goal to avoid affecting scenarios like Volcania. if (_s4.ScenarioObjectiveType == OBJECTIVE_PARK_VALUE_BY) - gameState.ScenarioObjective.Currency = CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency); + gameState.scenarioObjective.Currency = CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency); else - gameState.ScenarioObjective.Currency = ToMoney64(_s4.ScenarioObjectiveCurrency); + gameState.scenarioObjective.Currency = ToMoney64(_s4.ScenarioObjectiveCurrency); // This does not seem to be saved in the objective arguments, so look up the ID from the available rides instead. if (_s4.ScenarioObjectiveType == OBJECTIVE_BUILD_THE_BEST) - gameState.ScenarioObjective.RideId = GetBuildTheBestRideId(); + gameState.scenarioObjective.RideId = GetBuildTheBestRideId(); } void ImportSavedView(GameState_t& gameState) { - gameState.SavedView = ScreenCoordsXY{ _s4.ViewX, _s4.ViewY }; - gameState.SavedViewZoom = ZoomLevel{ static_cast(_s4.ViewZoom) }; - gameState.SavedViewRotation = _s4.ViewRotation; + gameState.savedView = ScreenCoordsXY{ _s4.ViewX, _s4.ViewY }; + gameState.savedViewZoom = ZoomLevel{ static_cast(_s4.ViewZoom) }; + gameState.savedViewRotation = _s4.ViewRotation; } void ConvertWall(const int32_t& type, colour_t* colourA, colour_t* colourB) @@ -2523,10 +2523,10 @@ namespace OpenRCT2::RCT1 void FixEntrancePositions(GameState_t& gameState) { - gameState.Park.Entrances.clear(); + gameState.park.Entrances.clear(); TileElementIterator it; TileElementIteratorBegin(&it); - while (TileElementIteratorNext(&it) && gameState.Park.Entrances.size() < Limits::kMaxParkEntrances) + while (TileElementIteratorNext(&it) && gameState.park.Entrances.size() < Limits::kMaxParkEntrances) { TileElement* element = it.element; @@ -2538,7 +2538,7 @@ namespace OpenRCT2::RCT1 continue; CoordsXYZD entrance = { TileCoordsXY(it.x, it.y).ToCoordsXY(), element->GetBaseZ(), element->GetDirection() }; - gameState.Park.Entrances.push_back(entrance); + gameState.park.Entrances.push_back(entrance); } } @@ -2607,7 +2607,7 @@ namespace OpenRCT2::RCT1 nextGuestNumber = std::max(nextGuestNumber, peep->PeepId); } - gameState.NextGuestNumber = nextGuestNumber + 1; + gameState.nextGuestNumber = nextGuestNumber + 1; } /** diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index e5ca347c5f..c4982fd4d3 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -356,8 +356,8 @@ namespace OpenRCT2::RCT2 { Initialise(gameState); - gameState.EditorStep = _s6.Info.EditorStep; - gameState.ScenarioCategory = static_cast(_s6.Info.Category); + gameState.editorStep = _s6.Info.EditorStep; + gameState.scenarioCategory = static_cast(_s6.Info.Category); // Some scenarios have their scenario details in UTF-8, due to earlier bugs in OpenRCT2. auto loadMaybeUTF8 = [](std::string_view str) -> std::string { @@ -366,18 +366,18 @@ namespace OpenRCT2::RCT2 if (_s6.Header.Type == S6_TYPE_SCENARIO) { - gameState.ScenarioName = loadMaybeUTF8(_s6.Info.Name); - gameState.ScenarioDetails = loadMaybeUTF8(_s6.Info.Details); + gameState.scenarioName = loadMaybeUTF8(_s6.Info.Name); + gameState.scenarioDetails = loadMaybeUTF8(_s6.Info.Details); } else { // Saved games do not have an info chunk - gameState.ScenarioName = loadMaybeUTF8(_s6.ScenarioName); - gameState.ScenarioDetails = loadMaybeUTF8(_s6.ScenarioDescription); + gameState.scenarioName = loadMaybeUTF8(_s6.ScenarioName); + gameState.scenarioDetails = loadMaybeUTF8(_s6.ScenarioDescription); } - gameState.Date = OpenRCT2::Date{ _s6.ElapsedMonths, _s6.CurrentDay }; - gameState.CurrentTicks = _s6.GameTicks1; + gameState.date = OpenRCT2::Date{ _s6.ElapsedMonths, _s6.CurrentDay }; + gameState.currentTicks = _s6.GameTicks1; ScenarioRandSeed(_s6.ScenarioSrand0, _s6.ScenarioSrand1); @@ -386,21 +386,21 @@ namespace OpenRCT2::RCT2 ImportEntities(); ConvertPeepAnimationTypeToObjects(gameState); - gameState.InitialCash = ToMoney64(_s6.InitialCash); - gameState.BankLoan = ToMoney64(_s6.CurrentLoan); + gameState.initialCash = ToMoney64(_s6.InitialCash); + gameState.bankLoan = ToMoney64(_s6.CurrentLoan); - gameState.Park.Flags = _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 if (_s6.Header.Type == S6_TYPE_SCENARIO) { if (_s6.ParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) - gameState.Park.Flags |= PARK_FLAGS_NO_MONEY; + gameState.park.Flags |= PARK_FLAGS_NO_MONEY; else - gameState.Park.Flags &= ~PARK_FLAGS_NO_MONEY; + gameState.park.Flags &= ~PARK_FLAGS_NO_MONEY; } - gameState.Park.EntranceFee = _s6.ParkEntranceFee; + gameState.park.EntranceFee = _s6.ParkEntranceFee; // rct1_park_entranceX // rct1_park_entrance_y // Pad013573EE @@ -408,108 +408,108 @@ namespace OpenRCT2::RCT2 ImportPeepSpawns(gameState); - gameState.GuestChangeModifier = _s6.GuestCountChangeModifier; - gameState.ResearchFundingLevel = _s6.CurrentResearchLevel; + gameState.guestChangeModifier = _s6.GuestCountChangeModifier; + gameState.researchFundingLevel = _s6.CurrentResearchLevel; // Pad01357400 // _s6.ResearchedTrackTypesA // _s6.ResearchedTrackTypesB - gameState.NumGuestsInPark = _s6.GuestsInPark; - gameState.NumGuestsHeadingForPark = _s6.GuestsHeadingForPark; + gameState.numGuestsInPark = _s6.GuestsInPark; + gameState.numGuestsHeadingForPark = _s6.GuestsHeadingForPark; for (size_t i = 0; i < Limits::kExpenditureTableMonthCount; i++) { for (size_t j = 0; j < Limits::kExpenditureTypeCount; j++) { - gameState.ExpenditureTable[i][j] = ToMoney64(_s6.ExpenditureTable[i][j]); + gameState.expenditureTable[i][j] = ToMoney64(_s6.ExpenditureTable[i][j]); } } - gameState.NumGuestsInParkLastWeek = _s6.LastGuestsInPark; + gameState.numGuestsInParkLastWeek = _s6.LastGuestsInPark; // Pad01357BCA - gameState.StaffHandymanColour = _s6.HandymanColour; - gameState.StaffMechanicColour = _s6.MechanicColour; - gameState.StaffSecurityColour = _s6.SecurityColour; + gameState.staffHandymanColour = _s6.HandymanColour; + gameState.staffMechanicColour = _s6.MechanicColour; + gameState.staffSecurityColour = _s6.SecurityColour; - gameState.Park.Rating = _s6.ParkRating; + gameState.park.Rating = _s6.ParkRating; Park::ResetHistories(gameState); for (size_t i = 0; i < std::size(_s6.ParkRatingHistory); i++) { if (_s6.ParkRatingHistory[i] != RCT12ParkHistoryUndefined) { - gameState.Park.RatingHistory[i] = _s6.ParkRatingHistory[i] * RCT12ParkRatingHistoryFactor; + gameState.park.RatingHistory[i] = _s6.ParkRatingHistory[i] * RCT12ParkRatingHistoryFactor; } } for (size_t i = 0; i < std::size(_s6.GuestsInParkHistory); i++) { if (_s6.GuestsInParkHistory[i] != RCT12ParkHistoryUndefined) { - gameState.GuestsInParkHistory[i] = _s6.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; + gameState.guestsInParkHistory[i] = _s6.GuestsInParkHistory[i] * RCT12GuestsInParkHistoryFactor; } } - gameState.ResearchPriorities = _s6.ActiveResearchTypes; - gameState.ResearchProgressStage = _s6.ResearchProgressStage; + gameState.researchPriorities = _s6.ActiveResearchTypes; + gameState.researchProgressStage = _s6.ResearchProgressStage; if (_s6.LastResearchedItemSubject != RCT12_RESEARCHED_ITEMS_SEPARATOR) - gameState.ResearchLastItem = RCT12ResearchItem{ _s6.LastResearchedItemSubject, + gameState.researchLastItem = RCT12ResearchItem{ _s6.LastResearchedItemSubject, EnumValue(ResearchCategory::Transport) } .ToResearchItem(); else - gameState.ResearchLastItem = std::nullopt; + gameState.researchLastItem = std::nullopt; // Pad01357CF8 if (_s6.NextResearchItem != RCT12_RESEARCHED_ITEMS_SEPARATOR) - gameState.ResearchNextItem = RCT12ResearchItem{ _s6.NextResearchItem, _s6.NextResearchCategory } + gameState.researchNextItem = RCT12ResearchItem{ _s6.NextResearchItem, _s6.NextResearchCategory } .ToResearchItem(); else - gameState.ResearchNextItem = std::nullopt; + gameState.researchNextItem = std::nullopt; - gameState.ResearchProgress = _s6.ResearchProgress; - gameState.ResearchExpectedDay = _s6.NextResearchExpectedDay; - gameState.ResearchExpectedMonth = _s6.NextResearchExpectedMonth; - gameState.GuestInitialHappiness = _s6.GuestInitialHappiness; - gameState.Park.Size = _s6.ParkSize; - gameState.GuestGenerationProbability = _s6.GuestGenerationProbability; - gameState.TotalRideValueForMoney = _s6.TotalRideValueForMoney; - gameState.MaxBankLoan = ToMoney64(_s6.MaximumLoan); - gameState.GuestInitialCash = ToMoney64(_s6.GuestInitialCash); - gameState.GuestInitialHunger = _s6.GuestInitialHunger; - gameState.GuestInitialThirst = _s6.GuestInitialThirst; - gameState.ScenarioObjective.Type = _s6.ObjectiveType; - gameState.ScenarioObjective.Year = _s6.ObjectiveYear; + gameState.researchProgress = _s6.ResearchProgress; + gameState.researchExpectedDay = _s6.NextResearchExpectedDay; + gameState.researchExpectedMonth = _s6.NextResearchExpectedMonth; + gameState.guestInitialHappiness = _s6.GuestInitialHappiness; + gameState.park.Size = _s6.ParkSize; + gameState.guestGenerationProbability = _s6.GuestGenerationProbability; + gameState.totalRideValueForMoney = _s6.TotalRideValueForMoney; + gameState.maxBankLoan = ToMoney64(_s6.MaximumLoan); + gameState.guestInitialCash = ToMoney64(_s6.GuestInitialCash); + gameState.guestInitialHunger = _s6.GuestInitialHunger; + gameState.guestInitialThirst = _s6.GuestInitialThirst; + gameState.scenarioObjective.Type = _s6.ObjectiveType; + gameState.scenarioObjective.Year = _s6.ObjectiveYear; // Pad013580FA - gameState.ScenarioObjective.Currency = _s6.ObjectiveCurrency; + gameState.scenarioObjective.Currency = _s6.ObjectiveCurrency; // In RCT2, the ride string IDs start at index STR_0002 and are directly mappable. // This is not always the case in OpenRCT2, so we use the actual ride ID. - if (gameState.ScenarioObjective.Type == OBJECTIVE_BUILD_THE_BEST) - gameState.ScenarioObjective.RideId = _s6.ObjectiveGuests - kRCT2RideStringStart; + if (gameState.scenarioObjective.Type == OBJECTIVE_BUILD_THE_BEST) + gameState.scenarioObjective.RideId = _s6.ObjectiveGuests - kRCT2RideStringStart; else - gameState.ScenarioObjective.NumGuests = _s6.ObjectiveGuests; + gameState.scenarioObjective.NumGuests = _s6.ObjectiveGuests; ImportMarketingCampaigns(); - gameState.CurrentExpenditure = ToMoney64(_s6.CurrentExpenditure); - gameState.CurrentProfit = ToMoney64(_s6.CurrentProfit); - gameState.WeeklyProfitAverageDividend = ToMoney64(_s6.WeeklyProfitAverageDividend); - gameState.WeeklyProfitAverageDivisor = _s6.WeeklyProfitAverageDivisor; + gameState.currentExpenditure = ToMoney64(_s6.CurrentExpenditure); + gameState.currentProfit = ToMoney64(_s6.CurrentProfit); + gameState.weeklyProfitAverageDividend = ToMoney64(_s6.WeeklyProfitAverageDividend); + gameState.weeklyProfitAverageDivisor = _s6.WeeklyProfitAverageDivisor; // Pad0135833A - gameState.Park.Value = ToMoney64(_s6.ParkValue); + gameState.park.Value = ToMoney64(_s6.ParkValue); for (size_t i = 0; i < Limits::kFinanceGraphSize; i++) { - gameState.CashHistory[i] = ToMoney64(_s6.BalanceHistory[i]); - gameState.WeeklyProfitHistory[i] = ToMoney64(_s6.WeeklyProfitHistory[i]); - gameState.Park.ValueHistory[i] = ToMoney64(_s6.ParkValueHistory[i]); + gameState.cashHistory[i] = ToMoney64(_s6.BalanceHistory[i]); + gameState.weeklyProfitHistory[i] = ToMoney64(_s6.WeeklyProfitHistory[i]); + gameState.park.ValueHistory[i] = ToMoney64(_s6.ParkValueHistory[i]); } - gameState.ScenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s6.CompletedCompanyValue); - gameState.TotalAdmissions = _s6.TotalAdmissions; - gameState.TotalIncomeFromAdmissions = ToMoney64(_s6.IncomeFromAdmissions); - gameState.CompanyValue = ToMoney64(_s6.CompanyValue); - std::memcpy(gameState.PeepWarningThrottle, _s6.PeepWarningThrottle, sizeof(_s6.PeepWarningThrottle)); + gameState.scenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s6.CompletedCompanyValue); + gameState.totalAdmissions = _s6.TotalAdmissions; + gameState.totalIncomeFromAdmissions = ToMoney64(_s6.IncomeFromAdmissions); + gameState.companyValue = ToMoney64(_s6.CompanyValue); + std::memcpy(gameState.peepWarningThrottle, _s6.PeepWarningThrottle, sizeof(_s6.PeepWarningThrottle)); // Awards - auto& currentAwards = gameState.CurrentAwards; + auto& currentAwards = gameState.currentAwards; for (auto& src : _s6.Awards) { if (src.Time != 0) @@ -518,34 +518,34 @@ namespace OpenRCT2::RCT2 } } - gameState.LandPrice = ToMoney64(_s6.LandPrice); - gameState.ConstructionRightsPrice = ToMoney64(_s6.ConstructionRightsPrice); + gameState.landPrice = ToMoney64(_s6.LandPrice); + gameState.constructionRightsPrice = ToMoney64(_s6.ConstructionRightsPrice); // unk_01358774 // Pad01358776 // _s6.CdKey _gameVersion = _s6.GameVersionNumber; - gameState.ScenarioCompanyValueRecord = _s6.CompletedCompanyValueRecord; + gameState.scenarioCompanyValueRecord = _s6.CompletedCompanyValueRecord; // _s6.LoanHash; // Pad013587CA - gameState.HistoricalProfit = ToMoney64(_s6.HistoricalProfit); + gameState.historicalProfit = ToMoney64(_s6.HistoricalProfit); // Pad013587D4 - gameState.ScenarioCompletedBy = std::string_view(_s6.ScenarioCompletedName, sizeof(_s6.ScenarioCompletedName)); - gameState.Cash = ToMoney64(DECRYPT_MONEY(_s6.Cash)); + gameState.scenarioCompletedBy = std::string_view(_s6.ScenarioCompletedName, sizeof(_s6.ScenarioCompletedName)); + gameState.cash = ToMoney64(DECRYPT_MONEY(_s6.Cash)); // Pad013587FC - gameState.Park.RatingCasualtyPenalty = _s6.ParkRatingCasualtyPenalty; - gameState.MapSize = { _s6.MapSize, _s6.MapSize }; - gameState.SamePriceThroughoutPark = _s6.SamePriceThroughout + gameState.park.RatingCasualtyPenalty = _s6.ParkRatingCasualtyPenalty; + gameState.mapSize = { _s6.MapSize, _s6.MapSize }; + gameState.samePriceThroughoutPark = _s6.SamePriceThroughout | (static_cast(_s6.SamePriceThroughoutExtended) << 32); - gameState.SuggestedGuestMaximum = _s6.SuggestedMaxGuests; - gameState.ScenarioParkRatingWarningDays = _s6.ParkRatingWarningDays; - gameState.LastEntranceStyle = _s6.LastEntranceStyle; + gameState.suggestedGuestMaximum = _s6.SuggestedMaxGuests; + gameState.scenarioParkRatingWarningDays = _s6.ParkRatingWarningDays; + gameState.lastEntranceStyle = _s6.LastEntranceStyle; // rct1_water_colour // Pad01358842 ImportResearchList(gameState); - gameState.BankLoanInterestRate = _s6.CurrentInterestRate; + gameState.bankLoanInterestRate = _s6.CurrentInterestRate; // Pad0135934B // Preserve compatibility with vanilla RCT2's save format. - gameState.Park.Entrances.clear(); + gameState.park.Entrances.clear(); for (uint8_t i = 0; i < Limits::kMaxParkEntrances; i++) { if (_s6.ParkEntranceX[i] != kLocationNull) @@ -555,48 +555,48 @@ namespace OpenRCT2::RCT2 entrance.y = _s6.ParkEntranceY[i]; entrance.z = _s6.ParkEntranceZ[i]; entrance.direction = _s6.ParkEntranceDirection[i]; - gameState.Park.Entrances.push_back(entrance); + gameState.park.Entrances.push_back(entrance); } } if (_s6.Header.Type == S6_TYPE_SCENARIO) { // _s6.ScenarioFilename is wrong for some RCT2 expansion scenarios, so we use the real filename - gameState.ScenarioFileName = Path::GetFileName(_s6Path); + gameState.scenarioFileName = Path::GetFileName(_s6Path); } else { // For savegames the filename can be arbitrary, so we have no choice but to rely on the name provided - gameState.ScenarioFileName = std::string( + gameState.scenarioFileName = std::string( String::toStringView(_s6.ScenarioFilename, std::size(_s6.ScenarioFilename))); } gCurrentRealTimeTicks = 0; ImportRides(); - gameState.SavedView = ScreenCoordsXY{ _s6.SavedViewX, _s6.SavedViewY }; - gameState.SavedViewZoom = ZoomLevel{ static_cast(_s6.SavedViewZoom) }; - gameState.SavedViewRotation = _s6.SavedViewRotation; + gameState.savedView = ScreenCoordsXY{ _s6.SavedViewX, _s6.SavedViewY }; + gameState.savedViewZoom = ZoomLevel{ static_cast(_s6.SavedViewZoom) }; + gameState.savedViewRotation = _s6.SavedViewRotation; ImportRideRatingsCalcData(); ImportRideMeasurements(); - gameState.NextGuestNumber = _s6.NextGuestIndex; - gameState.GrassSceneryTileLoopPosition = _s6.GrassAndSceneryTilepos; + gameState.nextGuestNumber = _s6.NextGuestIndex; + gameState.grassSceneryTileLoopPosition = _s6.GrassAndSceneryTilepos; // unk_13CA73E // Pad13CA73F // unk_13CA740 - // gameState.Climate = ClimateType{ _s6.Climate }; + // gameState.climate = ClimateType{ _s6.Climate }; // Pad13CA741; // Byte13CA742 // Pad013CA747 - gameState.WeatherUpdateTimer = _s6.WeatherUpdateTimer; - gameState.WeatherCurrent = { + gameState.weatherUpdateTimer = _s6.WeatherUpdateTimer; + gameState.weatherCurrent = { .weatherType = WeatherType{ _s6.CurrentWeather }, .temperature = static_cast(_s6.Temperature), .weatherEffect = WeatherEffectType{ _s6.CurrentWeatherEffect }, .weatherGloom = _s6.CurrentWeatherGloom, .level = static_cast(_s6.CurrentWeatherLevel), }; - gameState.WeatherNext = { + gameState.weatherNext = { .weatherType = WeatherType{ _s6.NextWeather }, .temperature = static_cast(_s6.NextTemperature), .weatherEffect = WeatherEffectType{ _s6.NextWeatherEffect }, @@ -611,7 +611,7 @@ namespace OpenRCT2::RCT2 // Pad13CE730 // rct1_scenario_flags - gameState.WidePathTileLoopPosition = { _s6.WidePathTileLoopX, _s6.WidePathTileLoopY }; + gameState.widePathTileLoopPosition = { _s6.WidePathTileLoopX, _s6.WidePathTileLoopY }; // Pad13CE778 // Fix and set dynamic variables @@ -619,7 +619,7 @@ namespace OpenRCT2::RCT2 ConvertScenarioStringsToUTF8(gameState); DetermineRideEntranceAndExitLocations(); - gameState.Park.Name = GetUserString(_s6.ParkName); + gameState.park.Name = GetUserString(_s6.ParkName); if (_isScenario) { @@ -645,9 +645,9 @@ namespace OpenRCT2::RCT2 void ConvertScenarioStringsToUTF8(GameState_t& gameState) { // Scenario details - gameState.ScenarioCompletedBy = RCT2StringToUTF8(gameState.ScenarioCompletedBy, RCT2LanguageId::EnglishUK); - gameState.ScenarioName = RCT2StringToUTF8(gameState.ScenarioName, RCT2LanguageId::EnglishUK); - gameState.ScenarioDetails = RCT2StringToUTF8(gameState.ScenarioDetails, RCT2LanguageId::EnglishUK); + gameState.scenarioCompletedBy = RCT2StringToUTF8(gameState.scenarioCompletedBy, RCT2LanguageId::EnglishUK); + gameState.scenarioName = RCT2StringToUTF8(gameState.scenarioName, RCT2LanguageId::EnglishUK); + gameState.scenarioDetails = RCT2StringToUTF8(gameState.scenarioDetails, RCT2LanguageId::EnglishUK); } void ImportRides() @@ -1029,7 +1029,7 @@ namespace OpenRCT2::RCT2 const auto& src = _s6.RideRatingsCalcData; // S6 has only one state, ensure we reset all states before reading the first one. RideRatingResetUpdateStates(); - auto& rideRatingStates = GetGameState().RideRatingUpdateStates; + auto& rideRatingStates = getGameState().rideRatingUpdateStates; auto& dst = rideRatingStates[0]; dst = {}; dst.Proximity = { src.ProximityX, src.ProximityY, src.ProximityZ }; @@ -1106,9 +1106,9 @@ namespace OpenRCT2::RCT2 } if (invented) - gameState.ResearchItemsInvented.emplace_back(researchItem.ToResearchItem()); + gameState.researchItemsInvented.emplace_back(researchItem.ToResearchItem()); else - gameState.ResearchItemsUninvented.emplace_back(researchItem.ToResearchItem()); + gameState.researchItemsUninvented.emplace_back(researchItem.ToResearchItem()); } } @@ -1180,14 +1180,14 @@ namespace OpenRCT2::RCT2 _s6.PeepSpawns[0].z = 7; } - gameState.PeepSpawns.clear(); + gameState.peepSpawns.clear(); for (size_t i = 0; i < Limits::kMaxPeepSpawns; i++) { if (_s6.PeepSpawns[i].x != RCT12_PEEP_SPAWN_UNDEFINED) { PeepSpawn spawn = { _s6.PeepSpawns[i].x, _s6.PeepSpawns[i].y, _s6.PeepSpawns[i].z * 16, _s6.PeepSpawns[i].direction }; - gameState.PeepSpawns.push_back(spawn); + gameState.peepSpawns.push_back(spawn); } } } @@ -1590,7 +1590,7 @@ namespace OpenRCT2::RCT2 { campaign.ShopItemType = ShopItem(_s6.CampaignRideIndex[i]); } - GetGameState().MarketingCampaigns.push_back(campaign); + getGameState().marketingCampaigns.push_back(campaign); } } } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 0405470094..588ddccea9 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -133,10 +133,10 @@ static void RideShopConnected(const Ride& ride); RideId GetNextFreeRideId() { - auto& gameState = GetGameState(); - for (RideId::UnderlyingType i = 0; i < gameState.Rides.size(); i++) + auto& gameState = getGameState(); + for (RideId::UnderlyingType i = 0; i < gameState.rides.size(); i++) { - if (gameState.Rides[i].id.IsNull()) + if (gameState.rides[i].id.IsNull()) { return RideId::FromUnderlying(i); } @@ -148,10 +148,10 @@ Ride* RideAllocateAtIndex(RideId index) { const auto idx = index.ToUnderlying(); - auto& gs = GetGameState(); - gs.RidesEndOfUsedRange = std::max(idx + 1, gs.RidesEndOfUsedRange); + auto& gameState = getGameState(); + gameState.ridesEndOfUsedRange = std::max(idx + 1, gameState.ridesEndOfUsedRange); - auto result = &gs.Rides[idx]; + auto result = &gameState.rides[idx]; assert(result->id == RideId::GetNull()); // Initialize the ride to all the defaults. @@ -179,19 +179,19 @@ static void RideReset(Ride& ride) void RideDelete(RideId id) { - auto& gs = GetGameState(); + auto& gameState = getGameState(); const auto idx = id.ToUnderlying(); - assert(idx < gs.Rides.size()); - assert(gs.Rides[idx].type != kRideTypeNull); + assert(idx < gameState.rides.size()); + assert(gameState.rides[idx].type != kRideTypeNull); - auto& ride = gs.Rides[idx]; + auto& ride = gameState.rides[idx]; RideReset(ride); // Shrink maximum ride size. - while (gs.RidesEndOfUsedRange > 0 && gs.Rides[gs.RidesEndOfUsedRange - 1].id.IsNull()) + while (gameState.ridesEndOfUsedRange > 0 && gameState.rides[gameState.ridesEndOfUsedRange - 1].id.IsNull()) { - gs.RidesEndOfUsedRange--; + gameState.ridesEndOfUsedRange--; } } @@ -202,15 +202,15 @@ Ride* GetRide(RideId index) return nullptr; } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto idx = index.ToUnderlying(); - assert(idx < gameState.Rides.size()); - if (idx >= gameState.Rides.size()) + assert(idx < gameState.rides.size()); + if (idx >= gameState.rides.size()) { return nullptr; } - auto& ride = gameState.Rides[idx]; + auto& ride = gameState.rides[idx]; if (ride.type != kRideTypeNull) { assert(ride.id == index); @@ -927,9 +927,9 @@ bool Ride::supportsStatus(RideStatus s) const */ void RideInitAll() { - auto& gameState = GetGameState(); - std::for_each(std::begin(gameState.Rides), std::end(gameState.Rides), RideReset); - gameState.RidesEndOfUsedRange = 0; + auto& gameState = getGameState(); + std::for_each(std::begin(gameState.rides), std::end(gameState.rides), RideReset); + gameState.ridesEndOfUsedRange = 0; } /** @@ -963,7 +963,7 @@ void Ride::updateAll() // Remove all rides if scenario editor if (gLegacyScene == LegacyScene::scenarioEditor) { - switch (GetGameState().EditorStep) + switch (getGameState().editorStep) { case EditorStep::ObjectSelection: case EditorStep::LandscapeEditor: @@ -1115,7 +1115,7 @@ void Ride::update() // Breakdown updates originally were performed when (id == (gCurrentTicks / 2) & 0xFF) // with the increased MAX_RIDES the update is tied to the first byte of the id this allows // for identical balance with vanilla. - const auto updatingRideByte = static_cast((GetGameState().CurrentTicks / 2) & 0xFF); + const auto updatingRideByte = static_cast((getGameState().currentTicks / 2) & 0xFF); if (updatingRideByte == static_cast(id.ToUnderlying())) RideBreakdownStatusUpdate(*this); } @@ -1239,7 +1239,7 @@ static constexpr CoordsXY ride_spiral_slide_main_tile_offset[][4] = { void updateSpiralSlide(Ride& ride) { - if (GetGameState().CurrentTicks & 3) + if (getGameState().currentTicks & 3) return; if (ride.slideInUse == 0) return; @@ -1299,7 +1299,7 @@ static uint8_t _breakdownProblemProbabilities[] = { */ static void RideInspectionUpdate(Ride& ride) { - if (GetGameState().CurrentTicks & 2047) + if (getGameState().currentTicks & 2047) return; if (gLegacyScene == LegacyScene::trackDesigner) return; @@ -1364,8 +1364,8 @@ static int32_t getAgePenalty(const Ride& ride) */ static void RideBreakdownUpdate(Ride& ride) { - auto& gameState = GetGameState(); - const auto currentTicks = gameState.CurrentTicks; + auto& gameState = getGameState(); + const auto currentTicks = gameState.currentTicks; if (currentTicks & 255) return; @@ -1419,7 +1419,7 @@ static void RideBreakdownUpdate(Ride& ride) // continues. if ((ride.reliability == 0 || static_cast(ScenarioRand() & 0x2FFFFF) <= 1u + kRideInitialReliability - ride.reliability) - && !gameState.Cheats.disableAllBreakdowns) + && !gameState.cheats.disableAllBreakdowns) { int32_t breakdownReason = RideGetNewBreakdownProblem(ride); if (breakdownReason != -1) @@ -1477,7 +1477,7 @@ static int32_t RideGetNewBreakdownProblem(const Ride& ride) return -1; // If brakes failure is disabled, also take it out of the equation (see above comment why) - if (GetGameState().Cheats.disableBrakesFailure) + if (getGameState().cheats.disableBrakesFailure) return -1; auto monthsOld = ride.getAge(); @@ -1877,7 +1877,7 @@ static bool RideMusicBreakdownEffect(Ride& ride) { if (ride.breakdownReasonPending == BREAKDOWN_CONTROL_FAILURE) { - if (!(GetGameState().CurrentTicks & 7)) + if (!(getGameState().currentTicks & 7)) if (ride.breakdownSoundModifier != 255) ride.breakdownSoundModifier++; } @@ -2017,7 +2017,7 @@ static void RideMeasurementUpdate(Ride& ride, RideMeasurement& measurement) if (measurement.current_item >= RideMeasurement::kMaxItems) return; - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if (measurement.flags & RIDE_MEASUREMENT_FLAG_G_FORCES) { @@ -2152,7 +2152,7 @@ std::pair Ride::getMeasurement() assert(measurement != nullptr); } - measurement->last_use_tick = GetGameState().CurrentTicks; + measurement->last_use_tick = getGameState().currentTicks; if (measurement->flags & 1) { return { measurement.get(), { kStringIdEmpty, {} } }; @@ -5105,7 +5105,7 @@ void Ride::updateMaxVehicles() } int32_t newCarsPerTrain = std::max(proposedNumCarsPerTrain, rideEntry->min_cars_in_train); newMaxCarsPerTrain = std::max(newMaxCarsPerTrain, static_cast(rideEntry->min_cars_in_train)); - if (!GetGameState().Cheats.disableTrainLengthLimit) + if (!getGameState().cheats.disableTrainLengthLimit) { newCarsPerTrain = std::min(newMaxCarsPerTrain, newCarsPerTrain); } @@ -5194,7 +5194,7 @@ void Ride::updateMaxVehicles() maxNumTrains = rideEntry->cars_per_flat_ride; } - if (GetGameState().Cheats.disableTrainLengthLimit) + if (getGameState().cheats.disableTrainLengthLimit) { maxNumTrains = OpenRCT2::Limits::kMaxTrainsPerRide; } @@ -5345,7 +5345,7 @@ bool Ride::isRide() const money64 RideGetPrice(const Ride& ride) { - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) + if (getGameState().park.Flags & PARK_FLAGS_NO_MONEY) return 0; if (ride.isRide()) { @@ -5530,7 +5530,7 @@ ObjectEntryIndex RideGetEntryIndex(ride_type_t rideType, ObjectEntryIndex rideSu } // Can happen in select-by-track-type mode - if (!RideEntryIsInvented(rideEntryIndex) && !GetGameState().Cheats.ignoreResearchStatus) + if (!RideEntryIsInvented(rideEntryIndex) && !getGameState().cheats.ignoreResearchStatus) { continue; } @@ -5619,10 +5619,10 @@ void DetermineRideEntranceAndExitLocations() // Search the map to find it. Skip the outer ring of invisible tiles. bool alreadyFoundEntrance = false; bool alreadyFoundExit = false; - auto& gameState = GetGameState(); - for (int32_t y = 1; y < gameState.MapSize.y - 1; y++) + auto& gameState = getGameState(); + for (int32_t y = 1; y < gameState.mapSize.y - 1; y++) { - for (int32_t x = 1; x < gameState.MapSize.x - 1; x++) + for (int32_t x = 1; x < gameState.mapSize.x - 1; x++) { TileElement* tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y }); @@ -5706,10 +5706,10 @@ void DetermineRideEntranceAndExitLocations() void RideClearLeftoverEntrances(const Ride& ride) { - auto& gameState = GetGameState(); - for (TileCoordsXY tilePos = {}; tilePos.x < gameState.MapSize.x; ++tilePos.x) + auto& gameState = getGameState(); + for (TileCoordsXY tilePos = {}; tilePos.x < gameState.mapSize.x; ++tilePos.x) { - for (tilePos.y = 0; tilePos.y < gameState.MapSize.y; ++tilePos.y) + for (tilePos.y = 0; tilePos.y < gameState.mapSize.y; ++tilePos.y) { for (auto* entrance : TileElementsView(tilePos.ToCoordsXY())) { @@ -5759,7 +5759,7 @@ void Ride::formatNameTo(Formatter& ft) const uint64_t Ride::getAvailableModes() const { - if (GetGameState().Cheats.showAllOperatingModes) + if (getGameState().cheats.showAllOperatingModes) return kAllRideModesAvailable; return getRideTypeDescriptor().RideModes; @@ -5786,10 +5786,10 @@ void Ride::increaseNumShelteredSections() void Ride::updateRideTypeForAllPieces() { - auto& gameState = GetGameState(); - for (int32_t y = 0; y < gameState.MapSize.y; y++) + auto& gameState = getGameState(); + for (int32_t y = 0; y < gameState.mapSize.y; y++) { - for (int32_t x = 0; x < gameState.MapSize.x; x++) + for (int32_t x = 0; x < gameState.mapSize.x; x++) { auto* tileElement = MapGetFirstElementAt(TileCoordsXY(x, y)); if (tileElement == nullptr) @@ -5941,7 +5941,7 @@ ResultWithMessage Ride::changeStatusCheckTrackValidity(const CoordsXYE& trackEle } } - if (subtype != kObjectEntryIndexNull && !GetGameState().Cheats.enableAllDrawableTrackPieces) + if (subtype != kObjectEntryIndexNull && !getGameState().cheats.enableAllDrawableTrackPieces) { const auto* rideEntry = GetRideEntryByIndex(subtype); if (rideEntry == nullptr) diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 3327bc464a..8ce2b55d37 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -342,10 +342,10 @@ void Ride::removePeeps() void RideClearBlockedTiles(const Ride& ride) { - auto& gameState = GetGameState(); - for (TileCoordsXY tilePos = {}; tilePos.x < gameState.MapSize.x; ++tilePos.x) + auto& gameState = getGameState(); + for (TileCoordsXY tilePos = {}; tilePos.x < gameState.mapSize.x; ++tilePos.x) { - for (tilePos.y = 0; tilePos.y < gameState.MapSize.y; ++tilePos.y) + for (tilePos.y = 0; tilePos.y < gameState.mapSize.y; ++tilePos.y) { for (auto* trackElement : TileElementsView(tilePos.ToCoordsXY())) { @@ -644,7 +644,7 @@ void RideConstructionSetDefaultNextPiece() _previousTrackPitchEnd = slope; _currentTrackHasLiftHill = trackElement->HasChain() && ((slope != TrackPitch::Down25 && slope != TrackPitch::Down60) - || GetGameState().Cheats.enableChainLiftOnAllTrack); + || getGameState().cheats.enableChainLiftOnAllTrack); if (TrackTypeHasSpeedSetting(trackElement->GetTrackType())) _currentBrakeSpeed = trackElement->GetBrakeBoosterSpeed(); @@ -701,7 +701,7 @@ void RideConstructionSetDefaultNextPiece() // Set track slope and lift hill _currentTrackPitchEnd = slope; _previousTrackPitchEnd = slope; - if (!GetGameState().Cheats.enableChainLiftOnAllTrack) + if (!getGameState().cheats.enableChainLiftOnAllTrack) { _currentTrackHasLiftHill = trackElement->HasChain(); } @@ -966,7 +966,7 @@ bool RideModify(const CoordsXYE& input) if (rideEntry == nullptr || !ride_check_if_construction_allowed(*ride)) return false; - if (ride->lifecycleFlags & RIDE_LIFECYCLE_INDESTRUCTIBLE && !GetGameState().Cheats.makeAllDestructible) + if (ride->lifecycleFlags & RIDE_LIFECYCLE_INDESTRUCTIBLE && !getGameState().cheats.makeAllDestructible) { Formatter ft; ride->formatNameTo(ft); diff --git a/src/openrct2/ride/RideData.cpp b/src/openrct2/ride/RideData.cpp index 1d651f8e16..08ae7a49b1 100644 --- a/src/openrct2/ride/RideData.cpp +++ b/src/openrct2/ride/RideData.cpp @@ -411,7 +411,7 @@ void UpdateEnabledRideGroups(TrackDrawerDescriptor trackDrawerDescriptor) { trackDrawerDescriptor.Regular.GetAvailableTrackGroups(_enabledRideGroups); - if (!GetGameState().Cheats.enableAllDrawableTrackPieces) + if (!getGameState().cheats.enableAllDrawableTrackPieces) { _enabledRideGroups &= ~_disabledRideGroups; } @@ -425,14 +425,14 @@ void UpdateDisabledRideGroups(const RideTrackGroups& res) void TrackDrawerEntry::GetAvailableTrackGroups(RideTrackGroups& res) const { res = enabledTrackGroups; - if (GetGameState().Cheats.enableAllDrawableTrackPieces) + if (getGameState().cheats.enableAllDrawableTrackPieces) res |= extraTrackGroups; } bool TrackDrawerEntry::SupportsTrackGroup(const TrackGroup trackGroup) const { return enabledTrackGroups.get(EnumValue(trackGroup)) - || (GetGameState().Cheats.enableAllDrawableTrackPieces && extraTrackGroups.get(EnumValue(trackGroup))); + || (getGameState().cheats.enableAllDrawableTrackPieces && extraTrackGroups.get(EnumValue(trackGroup))); } bool TrackDrawerDescriptor::HasCoveredPieces() const diff --git a/src/openrct2/ride/RideManager.cpp b/src/openrct2/ride/RideManager.cpp index d843e278f7..44fc958b89 100644 --- a/src/openrct2/ride/RideManager.cpp +++ b/src/openrct2/ride/RideManager.cpp @@ -14,7 +14,7 @@ namespace OpenRCT2 { RideManager::RideManager() - : _gameState(GetGameState()) {}; + : _gameState(getGameState()) {}; RideManager::RideManager(GameState_t& gameState) : _gameState(gameState) {}; @@ -22,9 +22,9 @@ namespace OpenRCT2 size_t RideManager::size() const { size_t count = 0; - for (size_t i = 0; i < _gameState.RidesEndOfUsedRange; i++) + for (size_t i = 0; i < _gameState.ridesEndOfUsedRange; i++) { - if (!_gameState.Rides[i].id.IsNull()) + if (!_gameState.rides[i].id.IsNull()) { count++; } @@ -34,17 +34,17 @@ namespace OpenRCT2 RideManager::Iterator RideManager::begin() { - return RideManager::Iterator(*this, 0u, _gameState.RidesEndOfUsedRange); + return RideManager::Iterator(*this, 0u, _gameState.ridesEndOfUsedRange); } RideManager::Iterator RideManager::end() { - return RideManager::Iterator(*this, _gameState.RidesEndOfUsedRange, _gameState.RidesEndOfUsedRange); + return RideManager::Iterator(*this, _gameState.ridesEndOfUsedRange, _gameState.ridesEndOfUsedRange); } RideManager::Iterator RideManager::get(RideId rideId) { - return RideManager::Iterator(*this, rideId.ToUnderlying(), _gameState.RidesEndOfUsedRange); + return RideManager::Iterator(*this, rideId.ToUnderlying(), _gameState.ridesEndOfUsedRange); } RideManager GetRideManager() diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index 58769b7d58..354269fd8e 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -160,7 +160,7 @@ void RideRatingResetUpdateStates() RideRatingUpdateState nullState{}; nullState.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; - auto& updateStates = GetGameState().RideRatingUpdateStates; + auto& updateStates = getGameState().rideRatingUpdateStates; std::fill(updateStates.begin(), updateStates.end(), nullState); } @@ -195,7 +195,7 @@ void RideRatingsUpdateAll() if (gLegacyScene == LegacyScene::scenarioEditor) return; - for (auto& updateState : GetGameState().RideRatingUpdateStates) + for (auto& updateState : getGameState().rideRatingUpdateStates) { for (size_t i = 0; i < MaxRideRatingUpdateSubSteps; ++i) { @@ -235,7 +235,7 @@ static void ride_ratings_update_state(RideRatingUpdateState& state) static bool RideRatingIsUpdatingRide(RideId id) { - const auto& updateStates = GetGameState().RideRatingUpdateStates; + const auto& updateStates = getGameState().rideRatingUpdateStates; return std::any_of(updateStates.begin(), updateStates.end(), [id](auto& state) { return state.CurrentRide == id && state.State != RIDE_RATINGS_STATE_FIND_NEXT_RIDE; }); @@ -1143,7 +1143,7 @@ static void RideRatingsCalculateValue(Ride& ride) + (((ride.ratings.nausea * ratingsMultipliers.nausea) * 32) >> 15); int32_t monthsOld = 0; - if (!GetGameState().Cheats.disableRideValueAging) + if (!getGameState().cheats.disableRideValueAging) { monthsOld = ride.getAge(); } @@ -1791,10 +1791,10 @@ static int32_t ride_ratings_get_scenery_score(const Ride& ride) // Count surrounding scenery items int32_t numSceneryItems = 0; auto tileLocation = TileCoordsXY(location); - auto& gameState = GetGameState(); - for (int32_t yy = std::max(tileLocation.y - 5, 0); yy <= std::min(tileLocation.y + 5, gameState.MapSize.y - 1); yy++) + auto& gameState = getGameState(); + for (int32_t yy = std::max(tileLocation.y - 5, 0); yy <= std::min(tileLocation.y + 5, gameState.mapSize.y - 1); yy++) { - for (int32_t xx = std::max(tileLocation.x - 5, 0); xx <= std::min(tileLocation.x + 5, gameState.MapSize.x - 1); xx++) + for (int32_t xx = std::max(tileLocation.x - 5, 0); xx <= std::min(tileLocation.x + 5, gameState.mapSize.x - 1); xx++) { // Count scenery items on this tile TileElement* tileElement = MapGetFirstElementAt(TileCoordsXY{ xx, yy }); diff --git a/src/openrct2/ride/ShopItem.cpp b/src/openrct2/ride/ShopItem.cpp index 36ad580512..ecc2ff5d05 100644 --- a/src/openrct2/ride/ShopItem.cpp +++ b/src/openrct2/ride/ShopItem.cpp @@ -147,7 +147,7 @@ money64 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem) bool ShopItemHasCommonPrice(const ShopItem shopItem) { - return (GetGameState().SamePriceThroughoutPark & EnumToFlag(shopItem)) != 0; + return (getGameState().samePriceThroughoutPark & EnumToFlag(shopItem)) != 0; } bool ShopItemDescriptor::IsFood() const diff --git a/src/openrct2/ride/Station.cpp b/src/openrct2/ride/Station.cpp index a2498f424e..7faa4de6a1 100644 --- a/src/openrct2/ride/Station.cpp +++ b/src/openrct2/ride/Station.cpp @@ -155,7 +155,7 @@ static void RideUpdateStationNormal(Ride& ride, StationIndex stationIndex) { auto& station = ride.getStation(stationIndex); int32_t time = station.Depart & kStationDepartMask; - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; if ((ride.lifecycleFlags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) || (ride.status == RideStatus::closed && ride.numRiders == 0)) { diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 39829a0a9d..7eab5f0dec 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -727,7 +727,7 @@ static std::optional TrackDesignPlaceSceneryElementGetEntry(c { result.Type = obj->GetObjectType(); result.Index = objectMgr.GetLoadedObjectEntryIndex(obj); - if (!GetGameState().Cheats.ignoreResearchStatus) + if (!getGameState().cheats.ignoreResearchStatus) { objectUnavailable = !ResearchIsInvented(result.Type, result.Index); } @@ -1849,7 +1849,7 @@ int32_t TrackDesignGetZPlacement(const TrackDesign& td, Ride& ride, const Coords static money64 TrackDesignCreateRide(int32_t type, int32_t subType, int32_t flags, RideId* outRideIndex) { // Don't set colours as will be set correctly later. - auto gameAction = RideCreateAction(type, subType, 0, 0, GetGameState().LastEntranceStyle); + auto gameAction = RideCreateAction(type, subType, 0, 0, getGameState().lastEntranceStyle); gameAction.SetFlags(flags); auto res = GameActions::ExecuteNested(&gameAction); @@ -1877,7 +1877,7 @@ static bool TrackDesignPlacePreview( *outRide = nullptr; gameStateData.flags = 0; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto& objManager = GetContext()->GetObjectManager(); auto entry_index = objManager.GetLoadedObjectEntryIndex(td.trackAndVehicle.vehicleObject); @@ -1897,7 +1897,7 @@ static bool TrackDesignPlacePreview( ride->entranceStyle = objManager.GetLoadedObjectEntryIndex(td.appearance.stationObjectIdentifier); if (ride->entranceStyle == kObjectEntryIndexNull) { - ride->entranceStyle = gameState.LastEntranceStyle; + ride->entranceStyle = gameState.lastEntranceStyle; } for (size_t i = 0; i < std::min(std::size(ride->trackColours), std::size(td.appearance.trackColours)); i++) @@ -1917,9 +1917,9 @@ static bool TrackDesignPlacePreview( _trackDesignDrawingPreview = true; uint8_t backup_rotation = _currentTrackPieceDirection; - uint32_t backup_park_flags = gameState.Park.Flags; - gameState.Park.Flags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; - auto mapSize = TileCoordsXY{ gameState.MapSize.x * 16, gameState.MapSize.y * 16 }; + uint32_t backup_park_flags = gameState.park.Flags; + gameState.park.Flags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; + auto mapSize = TileCoordsXY{ gameState.mapSize.x * 16, gameState.mapSize.y * 16 }; _currentTrackPieceDirection = 0; int32_t z = TrackDesignGetZPlacement( @@ -1942,7 +1942,7 @@ static bool TrackDesignPlacePreview( auto res = TrackDesignPlaceVirtual( tds, td, TrackPlaceOperation::placeTrackPreview, placeScenery, *ride, { mapSize.x, mapSize.y, z, _currentTrackPieceDirection }); - gameState.Park.Flags = backup_park_flags; + gameState.park.Flags = backup_park_flags; if (res.Error == GameActions::Status::Ok) { @@ -1950,7 +1950,7 @@ static bool TrackDesignPlacePreview( { gameStateData.setFlag(TrackDesignGameStateFlag::VehicleUnavailable, true); } - else if (!RideEntryIsInvented(entry_index) && !GetGameState().Cheats.ignoreResearchStatus) + else if (!RideEntryIsInvented(entry_index) && !getGameState().cheats.ignoreResearchStatus) { gameStateData.setFlag(TrackDesignGameStateFlag::VehicleUnavailable, true); } @@ -2153,8 +2153,8 @@ static void TrackDesignPreviewClearMap() { auto numTiles = kMaximumMapSizeTechnical * kMaximumMapSizeTechnical; - auto& gameState = GetGameState(); - gameState.MapSize = TRACK_DESIGN_PREVIEW_MAP_SIZE; + auto& gameState = getGameState(); + gameState.mapSize = TRACK_DESIGN_PREVIEW_MAP_SIZE; // Reserve ~8 elements per tile std::vector tileElements; diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index 66cde62334..3ac10744e8 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -1726,7 +1726,7 @@ void TrackPaintUtilLeftQuarterTurn1TilePaint( void TrackPaintUtilSpinningTunnelPaint(PaintSession& session, int8_t thickness, int16_t height, Direction direction) { - int32_t frame = (GetGameState().CurrentTicks >> 2) & 3; + int32_t frame = (getGameState().currentTicks >> 2) & 3; auto colourFlags = session.SupportColours; auto colourFlags2 = session.TrackColours; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 4a05b51f36..1eb2715814 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -610,7 +610,7 @@ void VehicleUpdateAll() if (gLegacyScene == LegacyScene::scenarioEditor) return; - if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && getGameState().editorStep != EditorStep::RollercoasterDesigner) return; for (auto vehicle : TrainManager::View()) @@ -4354,7 +4354,7 @@ void Vehicle::UpdateHauntedHouseOperating() if (Pitch != 0) { - if (GetGameState().CurrentTicks & 1) + if (getGameState().currentTicks & 1) { Pitch++; Invalidate(); @@ -4556,10 +4556,10 @@ static void ride_train_crash(Ride& ride, uint16_t numFatalities) ride.id.ToUnderlying(), ft); } - auto& gameState = GetGameState(); - if (gameState.Park.RatingCasualtyPenalty < 500) + auto& gameState = getGameState(); + if (gameState.park.RatingCasualtyPenalty < 500) { - gameState.Park.RatingCasualtyPenalty += 200; + gameState.park.RatingCasualtyPenalty += 200; } } } @@ -4868,7 +4868,7 @@ void Vehicle::UpdateSound() frictionSound.volume = std::min(208 + (ecx & 0xFF), 255); } - const auto currentTicks = GetGameState().CurrentTicks; + const auto currentTicks = getGameState().currentTicks; switch (carEntry.sound_range) { case SOUND_RANGE_WHISTLE: @@ -5173,7 +5173,7 @@ int32_t Vehicle::UpdateMotionDodgems() if (!(curRide->lifecycleFlags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)) || curRide->breakdownReasonPending != BREAKDOWN_SAFETY_CUT_OUT) { - if ((GetGameState().CurrentTicks & 1) && var_34 != 0) + if ((getGameState().currentTicks & 1) && var_34 != 0) { if (var_34 > 0) { @@ -7129,7 +7129,7 @@ bool Vehicle::UpdateTrackMotionForwards(const CarEntry* carEntry, const Ride& cu { acceleration = -_vehicleVelocityF64E08 * 16; } - else if (!(GetGameState().CurrentTicks & 0x0F)) + else if (!(getGameState().currentTicks & 0x0F)) { if (_vehicleF64E2C == 0) { diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index d15b42ebb4..81411b0bf3 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -86,7 +86,7 @@ void ScenarioBegin(GameState_t& gameState) GameLoadInit(); ScenarioReset(gameState); - if (gameState.ScenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen) + if (gameState.scenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen) ContextOpenWindowView(WV_PARK_OBJECTIVE); gScreenAge = 0; @@ -96,7 +96,7 @@ void ScenarioReset(GameState_t& gameState) { // Set the scenario pseudo-random seeds Random::RCT2::Seed s{ 0x1234567F ^ Platform::GetTicks(), 0x789FABCD ^ Platform::GetTicks() }; - gameState.ScenarioRand.seed(s); + gameState.scenarioRand.seed(s); ResearchResetCurrentItem(); @@ -105,37 +105,37 @@ void ScenarioReset(GameState_t& gameState) News::InitQueue(gameState); - gameState.Park.Rating = Park::CalculateParkRating(); - gameState.Park.Value = Park::CalculateParkValue(); - gameState.CompanyValue = Park::CalculateCompanyValue(); - gameState.HistoricalProfit = gameState.InitialCash - gameState.BankLoan; - gameState.Cash = gameState.InitialCash; + gameState.park.Rating = Park::CalculateParkRating(); + gameState.park.Value = Park::CalculateParkValue(); + gameState.companyValue = Park::CalculateCompanyValue(); + gameState.historicalProfit = gameState.initialCash - gameState.bankLoan; + gameState.cash = gameState.initialCash; auto& objManager = GetContext()->GetObjectManager(); if (auto* object = objManager.GetLoadedObject(ObjectType::scenarioText, 0); object != nullptr) { auto* textObject = reinterpret_cast(object); - gameState.ScenarioName = textObject->GetScenarioName(); - gameState.Park.Name = textObject->GetParkName(); - gameState.ScenarioDetails = textObject->GetScenarioDetails(); + gameState.scenarioName = textObject->GetScenarioName(); + gameState.park.Name = textObject->GetParkName(); + gameState.scenarioDetails = textObject->GetScenarioDetails(); } // Set the last saved game path auto env = GetContext()->GetPlatformEnvironment(); auto savePath = env->GetDirectoryPath(DIRBASE::USER, DIRID::SAVE); - gScenarioSavePath = Path::Combine(savePath, gameState.Park.Name + u8".park"); + gScenarioSavePath = Path::Combine(savePath, gameState.park.Name + u8".park"); - gameState.CurrentExpenditure = 0; - gameState.CurrentProfit = 0; - gameState.WeeklyProfitAverageDividend = 0; - gameState.WeeklyProfitAverageDivisor = 0; - gameState.TotalAdmissions = 0; - gameState.TotalIncomeFromAdmissions = 0; + gameState.currentExpenditure = 0; + gameState.currentProfit = 0; + gameState.weeklyProfitAverageDividend = 0; + gameState.weeklyProfitAverageDivisor = 0; + gameState.totalAdmissions = 0; + gameState.totalIncomeFromAdmissions = 0; - gameState.Park.Flags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; - gameState.ScenarioCompletedCompanyValue = kMoney64Undefined; - gameState.ScenarioCompletedBy = "?"; + gameState.park.Flags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; + gameState.scenarioCompletedCompanyValue = kMoney64Undefined; + gameState.scenarioCompletedBy = "?"; Park::ResetHistories(gameState); FinanceResetHistory(); @@ -147,24 +147,24 @@ void ScenarioReset(GameState_t& gameState) MapCountRemainingLandRights(); Staff::ResetStats(); - gameState.LastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); - if (gameState.LastEntranceStyle == kObjectEntryIndexNull) + gameState.lastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain"); + if (gameState.lastEntranceStyle == kObjectEntryIndexNull) { // Fall back to first entrance object - gameState.LastEntranceStyle = 0; + gameState.lastEntranceStyle = 0; } - gameState.MarketingCampaigns.clear(); - gameState.Park.RatingCasualtyPenalty = 0; + gameState.marketingCampaigns.clear(); + gameState.park.RatingCasualtyPenalty = 0; // Open park with free entry when there is no money - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { - gameState.Park.Flags |= PARK_FLAGS_PARK_OPEN; - gameState.Park.EntranceFee = 0; + gameState.park.Flags |= PARK_FLAGS_PARK_OPEN; + gameState.park.EntranceFee = 0; } - gameState.Park.Flags |= PARK_FLAGS_SPRITES_INITIALISED; + gameState.park.Flags |= PARK_FLAGS_SPRITES_INITIALISED; gGamePaused = false; } @@ -185,7 +185,7 @@ static void ScenarioEnd() */ void ScenarioFailure(GameState_t& gameState) { - gameState.ScenarioCompletedCompanyValue = kCompanyValueOnFailedObjective; + gameState.scenarioCompletedCompanyValue = kCompanyValueOnFailedObjective; ScenarioEnd(); } @@ -195,16 +195,16 @@ void ScenarioFailure(GameState_t& gameState) */ void ScenarioSuccess(GameState_t& gameState) { - auto companyValue = gameState.CompanyValue; + auto companyValue = gameState.companyValue; - gameState.ScenarioCompletedCompanyValue = companyValue; + gameState.scenarioCompletedCompanyValue = companyValue; PeepApplause(); - if (ScenarioRepositoryTryRecordHighscore(gameState.ScenarioFileName.c_str(), companyValue, nullptr)) + if (ScenarioRepositoryTryRecordHighscore(gameState.scenarioFileName.c_str(), companyValue, nullptr)) { // Allow name entry - gameState.Park.Flags |= PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; - gameState.ScenarioCompanyValueRecord = companyValue; + gameState.park.Flags |= PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; + gameState.scenarioCompanyValueRecord = companyValue; } ScenarioEnd(); } @@ -215,11 +215,11 @@ void ScenarioSuccess(GameState_t& gameState) */ void ScenarioSuccessSubmitName(GameState_t& gameState, const char* name) { - if (ScenarioRepositoryTryRecordHighscore(gameState.ScenarioFileName.c_str(), gameState.ScenarioCompanyValueRecord, name)) + if (ScenarioRepositoryTryRecordHighscore(gameState.scenarioFileName.c_str(), gameState.scenarioCompanyValueRecord, name)) { - gameState.ScenarioCompletedBy = name; + gameState.scenarioCompletedBy = name; } - gameState.Park.Flags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; + gameState.park.Flags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; } /** @@ -228,14 +228,14 @@ void ScenarioSuccessSubmitName(GameState_t& gameState, const char* name) */ static void ScenarioCheckEntranceFeeTooHigh() { - const auto& gameState = GetGameState(); - const auto max_fee = AddClamp(gameState.TotalRideValueForMoney, gameState.TotalRideValueForMoney / 2); + const auto& gameState = getGameState(); + const auto max_fee = AddClamp(gameState.totalRideValueForMoney, gameState.totalRideValueForMoney / 2); - if ((gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) && Park::GetEntranceFee() > max_fee) + if ((gameState.park.Flags & PARK_FLAGS_PARK_OPEN) && Park::GetEntranceFee() > max_fee) { - if (!gameState.Park.Entrances.empty()) + if (!gameState.park.Entrances.empty()) { - const auto& entrance = gameState.Park.Entrances[0]; + const auto& entrance = gameState.park.Entrances[0]; auto x = entrance.x + 16; auto y = entrance.y + 16; @@ -289,7 +289,7 @@ static void ScenarioDayUpdate(GameState_t& gameState) { FinanceUpdateDailyProfit(); PeepUpdateDaysInQueue(); - switch (gameState.ScenarioObjective.Type) + switch (gameState.scenarioObjective.Type) { case OBJECTIVE_10_ROLLERCOASTERS: case OBJECTIVE_GUESTS_AND_RATING: @@ -305,8 +305,8 @@ static void ScenarioDayUpdate(GameState_t& gameState) } // Lower the casualty penalty - uint16_t casualtyPenaltyModifier = (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) ? 40 : 7; - gameState.Park.RatingCasualtyPenalty = std::max(0, gameState.Park.RatingCasualtyPenalty - casualtyPenaltyModifier); + uint16_t casualtyPenaltyModifier = (gameState.park.Flags & PARK_FLAGS_NO_MONEY) ? 40 : 7; + gameState.park.RatingCasualtyPenalty = std::max(0, gameState.park.RatingCasualtyPenalty - casualtyPenaltyModifier); auto intent = Intent(INTENT_ACTION_UPDATE_DATE); ContextBroadcastIntent(&intent); @@ -345,7 +345,7 @@ static void ScenarioFortnightUpdate() static void ScenarioMonthUpdate() { FinanceShiftExpenditureTable(); - ScenarioCheckObjective(GetGameState()); + ScenarioCheckObjective(getGameState()); ScenarioCheckEntranceFeeTooHigh(); AwardUpdateAll(); } @@ -429,9 +429,9 @@ bool ScenarioCreateDucks() constexpr int32_t SquareRadiusSize = SquareCentre * 32; CoordsXY centrePos; - auto& gameState = GetGameState(); - centrePos.x = SquareRadiusSize + (ScenarioRandMax(gameState.MapSize.x - SquareCentre) * 32); - centrePos.y = SquareRadiusSize + (ScenarioRandMax(gameState.MapSize.y - SquareCentre) * 32); + auto& gameState = getGameState(); + centrePos.x = SquareRadiusSize + (ScenarioRandMax(gameState.mapSize.x - SquareCentre) * 32); + centrePos.y = SquareRadiusSize + (ScenarioRandMax(gameState.mapSize.y - SquareCentre) * 32); Guard::Assert(MapIsLocationValid(centrePos)); @@ -490,13 +490,13 @@ bool ScenarioCreateDucks() const random_engine_t::state_type& ScenarioRandState() { - return GetGameState().ScenarioRand.state(); + return getGameState().scenarioRand.state(); }; void ScenarioRandSeed(random_engine_t::result_type s0, random_engine_t::result_type s1) { Random::RCT2::Seed s{ s0, s1 }; - GetGameState().ScenarioRand.seed(s); + getGameState().scenarioRand.seed(s); } /** @@ -507,7 +507,7 @@ void ScenarioRandSeed(random_engine_t::result_type s0, random_engine_t::result_t */ random_engine_t::result_type ScenarioRand() { - return GetGameState().ScenarioRand(); + return getGameState().scenarioRand(); } uint32_t ScenarioRandMax(uint32_t max) @@ -530,7 +530,7 @@ uint32_t ScenarioRandMax(uint32_t max) */ static ResultWithMessage ScenarioPrepareRidesForSave(GameState_t& gameState) { - int32_t isFiveCoasterObjective = gameState.ScenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS; + int32_t isFiveCoasterObjective = gameState.scenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS; uint8_t rcs = 0; for (auto& ride : GetRideManager()) @@ -596,8 +596,8 @@ ResultWithMessage ScenarioPrepareForSave(GameState_t& gameState) return { false, prepareRidesResult.Message }; } - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) - gameState.Park.Flags |= PARK_FLAGS_PARK_OPEN; + if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + gameState.park.Flags |= PARK_FLAGS_PARK_OPEN; ScenarioReset(gameState); @@ -606,12 +606,12 @@ ResultWithMessage ScenarioPrepareForSave(GameState_t& gameState) ObjectiveStatus Objective::CheckGuestsBy() const { - auto parkRating = GetGameState().Park.Rating; + auto parkRating = getGameState().park.Rating; int32_t currentMonthYear = GetDate().GetMonthsElapsed(); if (currentMonthYear == MONTH_COUNT * Year || AllowEarlyCompletion()) { - if (parkRating >= 600 && GetGameState().NumGuestsInPark >= NumGuests) + if (parkRating >= 600 && getGameState().numGuestsInPark >= NumGuests) { return ObjectiveStatus::Success; } @@ -629,7 +629,7 @@ ObjectiveStatus Objective::CheckParkValueBy() const { int32_t currentMonthYear = GetDate().GetMonthsElapsed(); money64 objectiveParkValue = Currency; - money64 parkValue = GetGameState().Park.Value; + money64 parkValue = getGameState().park.Value; if (currentMonthYear == MONTH_COUNT * Year || AllowEarlyCompletion()) { @@ -686,53 +686,53 @@ ObjectiveStatus Objective::Check10RollerCoasters() const */ ObjectiveStatus Objective::CheckGuestsAndRating() const { - auto& gameState = GetGameState(); - if (gameState.Park.Rating < 700 && GetDate().GetMonthsElapsed() >= 1) + auto& gameState = getGameState(); + if (gameState.park.Rating < 700 && GetDate().GetMonthsElapsed() >= 1) { - gameState.ScenarioParkRatingWarningDays++; - if (gameState.ScenarioParkRatingWarningDays == 1) + gameState.scenarioParkRatingWarningDays++; + if (gameState.scenarioParkRatingWarningDays == 1) { if (Config::Get().notifications.ParkRatingWarnings) { News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_4_WEEKS_REMAINING, 0, {}); } } - else if (gameState.ScenarioParkRatingWarningDays == 8) + else if (gameState.scenarioParkRatingWarningDays == 8) { if (Config::Get().notifications.ParkRatingWarnings) { News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_3_WEEKS_REMAINING, 0, {}); } } - else if (gameState.ScenarioParkRatingWarningDays == 15) + else if (gameState.scenarioParkRatingWarningDays == 15) { if (Config::Get().notifications.ParkRatingWarnings) { News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_2_WEEKS_REMAINING, 0, {}); } } - else if (gameState.ScenarioParkRatingWarningDays == 22) + else if (gameState.scenarioParkRatingWarningDays == 22) { if (Config::Get().notifications.ParkRatingWarnings) { News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_1_WEEK_REMAINING, 0, {}); } } - else if (gameState.ScenarioParkRatingWarningDays == 29) + else if (gameState.scenarioParkRatingWarningDays == 29) { News::AddItemToQueue(News::ItemType::Graph, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0, {}); - gameState.Park.Flags &= ~PARK_FLAGS_PARK_OPEN; - gameState.GuestInitialHappiness = 50; + gameState.park.Flags &= ~PARK_FLAGS_PARK_OPEN; + gameState.guestInitialHappiness = 50; return ObjectiveStatus::Failure; } } - else if (gameState.ScenarioCompletedCompanyValue != kCompanyValueOnFailedObjective) + else if (gameState.scenarioCompletedCompanyValue != kCompanyValueOnFailedObjective) { - gameState.ScenarioParkRatingWarningDays = 0; + gameState.scenarioParkRatingWarningDays = 0; } - if (gameState.Park.Rating >= 700) - if (gameState.NumGuestsInPark >= NumGuests) + if (gameState.park.Rating >= 700) + if (gameState.numGuestsInPark >= NumGuests) return ObjectiveStatus::Success; return ObjectiveStatus::Undecided; @@ -740,7 +740,7 @@ ObjectiveStatus Objective::CheckGuestsAndRating() const ObjectiveStatus Objective::CheckMonthlyRideIncome() const { - money64 lastMonthRideIncome = GetGameState().ExpenditureTable[1][EnumValue(ExpenditureType::ParkRideTickets)]; + money64 lastMonthRideIncome = getGameState().expenditureTable[1][EnumValue(ExpenditureType::ParkRideTickets)]; if (lastMonthRideIncome >= Currency) { return ObjectiveStatus::Success; @@ -815,9 +815,9 @@ ObjectiveStatus Objective::CheckFinish5RollerCoasters() const ObjectiveStatus Objective::CheckRepayLoanAndParkValue() const { - const auto& gameState = GetGameState(); - money64 parkValue = gameState.Park.Value; - money64 currentLoan = gameState.BankLoan; + const auto& gameState = getGameState(); + money64 parkValue = gameState.park.Value; + money64 currentLoan = gameState.bankLoan; if (currentLoan <= 0 && parkValue >= Currency) { @@ -829,7 +829,7 @@ ObjectiveStatus Objective::CheckRepayLoanAndParkValue() const ObjectiveStatus Objective::CheckMonthlyFoodIncome() const { - const auto* lastMonthExpenditure = GetGameState().ExpenditureTable[1]; + const auto* lastMonthExpenditure = getGameState().expenditureTable[1]; auto lastMonthProfit = lastMonthExpenditure[EnumValue(ExpenditureType::ShopSales)] + lastMonthExpenditure[EnumValue(ExpenditureType::ShopStock)] + lastMonthExpenditure[EnumValue(ExpenditureType::FoodDrinkSales)] @@ -862,7 +862,7 @@ bool AllowEarlyCompletion() static void ScenarioCheckObjective(GameState_t& gameState) { - auto status = gameState.ScenarioObjective.Check(gameState); + auto status = gameState.scenarioObjective.Check(gameState); if (status == ObjectiveStatus::Success) { ScenarioSuccess(gameState); @@ -879,7 +879,7 @@ static void ScenarioCheckObjective(GameState_t& gameState) */ ObjectiveStatus Objective::Check(GameState_t& gameState) const { - if (gameState.ScenarioCompletedCompanyValue != kMoney64Undefined) + if (gameState.scenarioCompletedCompanyValue != kMoney64Undefined) { return ObjectiveStatus::Undecided; } diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index fe66e88bf1..d7b302f74b 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -371,7 +371,7 @@ public: // Get scenario using RCTC style name of RCT2 scenario scenario = GetByFilename((scenarioBaseName + ".sea").c_str()); } - // GameState_t::ScenarioFileName .Park scenarios is the full file path instead of just , so need + // GameState_t::scenarioFileName .Park scenarios is the full file path instead of just , so need // to convert else if (String::iequals(scenarioExtension, ".park")) { diff --git a/src/openrct2/scenes/Scene.cpp b/src/openrct2/scenes/Scene.cpp index b2ce9d9db3..62f6462357 100644 --- a/src/openrct2/scenes/Scene.cpp +++ b/src/openrct2/scenes/Scene.cpp @@ -24,9 +24,9 @@ IContext& Scene::GetContext() return _context; } -GameState_t& Scene::GetGameState() +GameState_t& Scene::getGameState() { - return OpenRCT2::GetGameState(); + return OpenRCT2::getGameState(); } void Scene::FinishScene() diff --git a/src/openrct2/scenes/Scene.h b/src/openrct2/scenes/Scene.h index 222e711de9..86984b47d9 100644 --- a/src/openrct2/scenes/Scene.h +++ b/src/openrct2/scenes/Scene.h @@ -21,7 +21,7 @@ namespace OpenRCT2 public: virtual ~IScene() = default; - virtual GameState_t& GetGameState() = 0; + virtual GameState_t& getGameState() = 0; virtual IContext& GetContext() = 0; virtual void Load() = 0; @@ -36,7 +36,7 @@ namespace OpenRCT2 public: Scene(IContext& context); - GameState_t& GetGameState() override; + GameState_t& getGameState() override; IContext& GetContext() override; void SetOnComplete(std::function) override; diff --git a/src/openrct2/scenes/preloader/PreloaderScene.cpp b/src/openrct2/scenes/preloader/PreloaderScene.cpp index c4292e1bda..84b4e9f929 100644 --- a/src/openrct2/scenes/preloader/PreloaderScene.cpp +++ b/src/openrct2/scenes/preloader/PreloaderScene.cpp @@ -35,7 +35,7 @@ void PreloaderScene::Load() LOG_VERBOSE("PreloaderScene::Load()"); gLegacyScene = LegacyScene::playing; - gameStateInitAll(GetGameState(), kDefaultMapSize); + gameStateInitAll(getGameState(), kDefaultMapSize); ViewportInitAll(); ContextOpenWindow(WindowClass::MainWindow); WindowSetFlagForAllViewports(VIEWPORT_FLAG_RENDERING_INHIBITED, true); diff --git a/src/openrct2/scenes/title/TitleScene.cpp b/src/openrct2/scenes/title/TitleScene.cpp index 75de64a255..48a3448729 100644 --- a/src/openrct2/scenes/title/TitleScene.cpp +++ b/src/openrct2/scenes/title/TitleScene.cpp @@ -105,7 +105,7 @@ void TitleScene::Load() #ifndef DISABLE_NETWORK GetContext().GetNetwork().Close(); #endif - gameStateInitAll(GetGameState(), kDefaultMapSize); + gameStateInitAll(getGameState(), kDefaultMapSize); ViewportInitAll(); ContextOpenWindow(WindowClass::MainWindow); @@ -319,7 +319,7 @@ bool TitleScene::TryLoadSequence(bool loadPreview) _loadedTitleSequenceId = SIZE_MAX; if (!loadPreview) { - gameStateInitAll(GetGameState(), kDefaultMapSize); + gameStateInitAll(getGameState(), kDefaultMapSize); GameNotifyMapChanged(); } return false; diff --git a/src/openrct2/scripting/bindings/entity/ScGuest.cpp b/src/openrct2/scripting/bindings/entity/ScGuest.cpp index a8dce9ce69..fd49d36079 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.cpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.cpp @@ -512,9 +512,9 @@ namespace OpenRCT2::Scripting auto peep = GetGuest(); if (peep != nullptr) { - auto& gameState = GetGameState(); - if (value.type() == DukValue::Type::NUMBER && value.as_uint() < gameState.Rides.size() - && gameState.Rides[value.as_uint()].type != kRideTypeNull) + auto& gameState = getGameState(); + if (value.type() == DukValue::Type::NUMBER && value.as_uint() < gameState.rides.size() + && gameState.rides[value.as_uint()].type != kRideTypeNull) { peep->FavouriteRide = RideId::FromUnderlying(value.as_uint()); } diff --git a/src/openrct2/scripting/bindings/game/ScCheats.hpp b/src/openrct2/scripting/bindings/game/ScCheats.hpp index 2040a311dd..27c3ea6b3d 100644 --- a/src/openrct2/scripting/bindings/game/ScCheats.hpp +++ b/src/openrct2/scripting/bindings/game/ScCheats.hpp @@ -79,266 +79,266 @@ namespace OpenRCT2::Scripting private: bool allowArbitraryRideTypeChanges_get() { - return GetGameState().Cheats.allowArbitraryRideTypeChanges; + return getGameState().cheats.allowArbitraryRideTypeChanges; } void allowArbitraryRideTypeChanges_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.allowArbitraryRideTypeChanges = value; + getGameState().cheats.allowArbitraryRideTypeChanges = value; } bool allowTrackPlaceInvalidHeights_get() { - return GetGameState().Cheats.allowTrackPlaceInvalidHeights; + return getGameState().cheats.allowTrackPlaceInvalidHeights; } void allowTrackPlaceInvalidHeights_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.allowTrackPlaceInvalidHeights = value; + getGameState().cheats.allowTrackPlaceInvalidHeights = value; } bool buildInPauseMode_get() { - return GetGameState().Cheats.buildInPauseMode; + return getGameState().cheats.buildInPauseMode; } void buildInPauseMode_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.buildInPauseMode = value; + getGameState().cheats.buildInPauseMode = value; } bool disableAllBreakdowns_get() { - return GetGameState().Cheats.disableAllBreakdowns; + return getGameState().cheats.disableAllBreakdowns; } void disableAllBreakdowns_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableAllBreakdowns = value; + getGameState().cheats.disableAllBreakdowns = value; } bool disableBrakesFailure_get() { - return GetGameState().Cheats.disableBrakesFailure; + return getGameState().cheats.disableBrakesFailure; } void disableBrakesFailure_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableBrakesFailure = value; + getGameState().cheats.disableBrakesFailure = value; } bool disableClearanceChecks_get() { - return GetGameState().Cheats.disableClearanceChecks; + return getGameState().cheats.disableClearanceChecks; } void disableClearanceChecks_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableClearanceChecks = value; + getGameState().cheats.disableClearanceChecks = value; } bool disableLittering_get() { - return GetGameState().Cheats.disableLittering; + return getGameState().cheats.disableLittering; } void disableLittering_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableLittering = value; + getGameState().cheats.disableLittering = value; } bool disablePlantAging_get() { - return GetGameState().Cheats.disablePlantAging; + return getGameState().cheats.disablePlantAging; } void disablePlantAging_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disablePlantAging = value; + getGameState().cheats.disablePlantAging = value; } bool allowRegularPathAsQueue_get() { - return GetGameState().Cheats.allowRegularPathAsQueue; + return getGameState().cheats.allowRegularPathAsQueue; } void allowRegularPathAsQueue_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.allowRegularPathAsQueue = value; + getGameState().cheats.allowRegularPathAsQueue = value; } bool allowSpecialColourSchemes_get() { - return GetGameState().Cheats.allowSpecialColourSchemes; + return getGameState().cheats.allowSpecialColourSchemes; } void allowSpecialColourSchemes_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.allowSpecialColourSchemes = value; + getGameState().cheats.allowSpecialColourSchemes = value; } bool disableRideValueAging_get() { - return GetGameState().Cheats.disableRideValueAging; + return getGameState().cheats.disableRideValueAging; } void disableRideValueAging_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableRideValueAging = value; + getGameState().cheats.disableRideValueAging = value; } bool disableSupportLimits_get() { - return GetGameState().Cheats.disableSupportLimits; + return getGameState().cheats.disableSupportLimits; } void disableSupportLimits_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableSupportLimits = value; + getGameState().cheats.disableSupportLimits = value; } bool disableTrainLengthLimit_get() { - return GetGameState().Cheats.disableTrainLengthLimit; + return getGameState().cheats.disableTrainLengthLimit; } void disableTrainLengthLimit_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableTrainLengthLimit = value; + getGameState().cheats.disableTrainLengthLimit = value; } bool disableVandalism_get() { - return GetGameState().Cheats.disableVandalism; + return getGameState().cheats.disableVandalism; } void disableVandalism_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.disableVandalism = value; + getGameState().cheats.disableVandalism = value; } bool enableAllDrawableTrackPieces_get() { - return GetGameState().Cheats.enableAllDrawableTrackPieces; + return getGameState().cheats.enableAllDrawableTrackPieces; } void enableAllDrawableTrackPieces_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.enableAllDrawableTrackPieces = value; + getGameState().cheats.enableAllDrawableTrackPieces = value; } bool enableChainLiftOnAllTrack_get() { - return GetGameState().Cheats.enableChainLiftOnAllTrack; + return getGameState().cheats.enableChainLiftOnAllTrack; } void enableChainLiftOnAllTrack_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.enableChainLiftOnAllTrack = value; + getGameState().cheats.enableChainLiftOnAllTrack = value; } bool fastLiftHill_get() { - return GetGameState().Cheats.unlockOperatingLimits; + return getGameState().cheats.unlockOperatingLimits; } void fastLiftHill_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.unlockOperatingLimits = value; + getGameState().cheats.unlockOperatingLimits = value; } bool freezeWeather_get() { - return GetGameState().Cheats.freezeWeather; + return getGameState().cheats.freezeWeather; } void freezeWeather_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.freezeWeather = value; + getGameState().cheats.freezeWeather = value; } bool ignoreResearchStatus_get() { - return GetGameState().Cheats.ignoreResearchStatus; + return getGameState().cheats.ignoreResearchStatus; } void ignoreResearchStatus_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.ignoreResearchStatus = value; + getGameState().cheats.ignoreResearchStatus = value; } bool ignoreRideIntensity_get() { - return GetGameState().Cheats.ignoreRideIntensity; + return getGameState().cheats.ignoreRideIntensity; } void ignoreRideIntensity_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.ignoreRideIntensity = value; + getGameState().cheats.ignoreRideIntensity = value; } bool neverendingMarketing_get() { - return GetGameState().Cheats.neverendingMarketing; + return getGameState().cheats.neverendingMarketing; } void neverendingMarketing_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.neverendingMarketing = value; + getGameState().cheats.neverendingMarketing = value; } bool sandboxMode_get() { - return GetGameState().Cheats.sandboxMode; + return getGameState().cheats.sandboxMode; } void sandboxMode_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.sandboxMode = value; + getGameState().cheats.sandboxMode = value; } bool showAllOperatingModes_get() { - return GetGameState().Cheats.showAllOperatingModes; + return getGameState().cheats.showAllOperatingModes; } void showAllOperatingModes_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.showAllOperatingModes = value; + getGameState().cheats.showAllOperatingModes = value; } bool showVehiclesFromOtherTrackTypes_get() { - return GetGameState().Cheats.showVehiclesFromOtherTrackTypes; + return getGameState().cheats.showVehiclesFromOtherTrackTypes; } void showVehiclesFromOtherTrackTypes_set(bool value) { ThrowIfGameStateNotMutable(); - GetGameState().Cheats.showVehiclesFromOtherTrackTypes = value; + getGameState().cheats.showVehiclesFromOtherTrackTypes = value; } }; } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/scripting/bindings/world/ScClimate.hpp b/src/openrct2/scripting/bindings/world/ScClimate.hpp index 32b05c2bf1..2ad160f5eb 100644 --- a/src/openrct2/scripting/bindings/world/ScClimate.hpp +++ b/src/openrct2/scripting/bindings/world/ScClimate.hpp @@ -95,16 +95,16 @@ namespace OpenRCT2::Scripting std::shared_ptr current_get() const { - auto& gameState = GetGameState(); - std::string weatherType = WeatherTypeToString(gameState.WeatherCurrent.weatherType); - return std::make_shared(weatherType, gameState.WeatherCurrent.temperature); + auto& gameState = getGameState(); + std::string weatherType = WeatherTypeToString(gameState.weatherCurrent.weatherType); + return std::make_shared(weatherType, gameState.weatherCurrent.temperature); } std::shared_ptr future_get() const { - auto& gameState = GetGameState(); - std::string weatherType = WeatherTypeToString(gameState.WeatherNext.weatherType); - return std::make_shared(weatherType, gameState.WeatherNext.temperature); + auto& gameState = getGameState(); + std::string weatherType = WeatherTypeToString(gameState.weatherNext.weatherType); + return std::make_shared(weatherType, gameState.weatherNext.temperature); } static void Register(duk_context* ctx) diff --git a/src/openrct2/scripting/bindings/world/ScDate.hpp b/src/openrct2/scripting/bindings/world/ScDate.hpp index be762bd62e..5c4148f947 100644 --- a/src/openrct2/scripting/bindings/world/ScDate.hpp +++ b/src/openrct2/scripting/bindings/world/ScDate.hpp @@ -44,7 +44,7 @@ namespace OpenRCT2::Scripting void monthsElapsed_set(uint32_t value) { ThrowIfGameStateNotMutable(); - GetGameState().Date = Date{ value, GetDate().GetMonthTicks() }; + getGameState().date = Date{ value, GetDate().GetMonthTicks() }; } uint32_t monthProgress_get() const @@ -56,7 +56,7 @@ namespace OpenRCT2::Scripting void monthProgress_set(int32_t value) { ThrowIfGameStateNotMutable(); - GetGameState().Date = Date{ GetDate().GetMonthsElapsed(), static_cast(value) }; + getGameState().date = Date{ GetDate().GetMonthsElapsed(), static_cast(value) }; } uint32_t yearsElapsed_get() const @@ -67,22 +67,22 @@ namespace OpenRCT2::Scripting uint32_t ticksElapsed_get() const { - return GetGameState().CurrentTicks; + return getGameState().currentTicks; } int32_t day_get() const { - return GetGameState().Date.GetDay() + 1; + return getGameState().date.GetDay() + 1; } int32_t month_get() const { - return GetGameState().Date.GetMonth(); + return getGameState().date.GetMonth(); } int32_t year_get() const { - return GetGameState().Date.GetYear() + 1; + return getGameState().date.GetYear() + 1; } }; } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/scripting/bindings/world/ScMap.cpp b/src/openrct2/scripting/bindings/world/ScMap.cpp index dceb9addaf..217d66cee4 100644 --- a/src/openrct2/scripting/bindings/world/ScMap.cpp +++ b/src/openrct2/scripting/bindings/world/ScMap.cpp @@ -45,7 +45,7 @@ namespace OpenRCT2::Scripting DukValue ScMap::size_get() const { - return ToDuk(_context, GetGameState().MapSize); + return ToDuk(_context, getGameState().mapSize); } int32_t ScMap::numRides_get() const diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 1059c583fe..b15336d8a1 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -51,16 +51,16 @@ namespace OpenRCT2::Scripting money64 ScPark::cash_get() const { - return GetGameState().Cash; + return getGameState().cash; } void ScPark::cash_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.Cash != value) + auto& gameState = getGameState(); + if (gameState.cash != value) { - gameState.Cash = value; + gameState.cash = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); ContextBroadcastIntent(&intent); } @@ -68,17 +68,17 @@ namespace OpenRCT2::Scripting int32_t ScPark::rating_get() const { - return GetGameState().Park.Rating; + return getGameState().park.Rating; } void ScPark::rating_set(int32_t value) { ThrowIfGameStateNotMutable(); auto valueClamped = std::min(std::max(0, value), 999); - auto& gameState = GetGameState(); - if (gameState.Park.Rating != valueClamped) + auto& gameState = getGameState(); + if (gameState.park.Rating != valueClamped) { - gameState.Park.Rating = 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); ContextBroadcastIntent(&intent); } @@ -86,17 +86,17 @@ namespace OpenRCT2::Scripting money64 ScPark::bankLoan_get() const { - return GetGameState().BankLoan; + return getGameState().bankLoan; } void ScPark::bankLoan_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.BankLoan != value) + if (gameState.bankLoan != value) { - gameState.BankLoan = value; + gameState.bankLoan = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); ContextBroadcastIntent(&intent); } @@ -104,16 +104,16 @@ namespace OpenRCT2::Scripting money64 ScPark::maxBankLoan_get() const { - return GetGameState().MaxBankLoan; + return getGameState().maxBankLoan; } void ScPark::maxBankLoan_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.MaxBankLoan != value) + auto& gameState = getGameState(); + if (gameState.maxBankLoan != value) { - gameState.MaxBankLoan = value; + gameState.maxBankLoan = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); ContextBroadcastIntent(&intent); } @@ -121,16 +121,16 @@ namespace OpenRCT2::Scripting money64 ScPark::entranceFee_get() const { - return GetGameState().Park.EntranceFee; + return getGameState().park.EntranceFee; } void ScPark::entranceFee_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.Park.EntranceFee != value) + auto& gameState = getGameState(); + if (gameState.park.EntranceFee != value) { - gameState.Park.EntranceFee = value; + gameState.park.EntranceFee = value; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ParkInformation); } @@ -138,17 +138,17 @@ namespace OpenRCT2::Scripting uint32_t ScPark::guests_get() const { - return GetGameState().NumGuestsInPark; + return getGameState().numGuestsInPark; } uint32_t ScPark::suggestedGuestMaximum_get() const { - return GetGameState().SuggestedGuestMaximum; + return getGameState().suggestedGuestMaximum; } int32_t ScPark::guestGenerationProbability_get() const { - return GetGameState().GuestGenerationProbability; + return getGameState().guestGenerationProbability; } DukValue ScPark::generateGuest() @@ -160,36 +160,36 @@ namespace OpenRCT2::Scripting money64 ScPark::guestInitialCash_get() const { - return GetGameState().GuestInitialCash; + return getGameState().guestInitialCash; } uint8_t ScPark::guestInitialHappiness_get() const { - return GetGameState().GuestInitialHappiness; + return getGameState().guestInitialHappiness; } uint8_t ScPark::guestInitialHunger_get() const { - return GetGameState().GuestInitialHunger; + return getGameState().guestInitialHunger; } uint8_t ScPark::guestInitialThirst_get() const { - return GetGameState().GuestInitialThirst; + return getGameState().guestInitialThirst; } money64 ScPark::value_get() const { - return GetGameState().Park.Value; + return getGameState().park.Value; } void ScPark::value_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.Park.Value != value) + auto& gameState = getGameState(); + if (gameState.park.Value != value) { - gameState.Park.Value = value; + gameState.park.Value = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); ContextBroadcastIntent(&intent); } @@ -197,16 +197,16 @@ namespace OpenRCT2::Scripting money64 ScPark::companyValue_get() const { - return GetGameState().CompanyValue; + return getGameState().companyValue; } void ScPark::companyValue_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.CompanyValue != value) + if (gameState.companyValue != value) { - gameState.CompanyValue = value; + gameState.companyValue = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); ContextBroadcastIntent(&intent); } @@ -214,21 +214,21 @@ namespace OpenRCT2::Scripting money64 ScPark::totalRideValueForMoney_get() const { - return GetGameState().TotalRideValueForMoney; + return getGameState().totalRideValueForMoney; } uint32_t ScPark::totalAdmissions_get() const { - return GetGameState().TotalAdmissions; + return getGameState().totalAdmissions; } void ScPark::totalAdmissions_set(uint32_t value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.TotalAdmissions != value) + if (gameState.totalAdmissions != value) { - gameState.TotalAdmissions = value; + gameState.totalAdmissions = value; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ParkInformation); } @@ -236,16 +236,16 @@ namespace OpenRCT2::Scripting money64 ScPark::totalIncomeFromAdmissions_get() const { - return GetGameState().TotalIncomeFromAdmissions; + return getGameState().totalIncomeFromAdmissions; } void ScPark::totalIncomeFromAdmissions_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.TotalIncomeFromAdmissions != value) + if (gameState.totalIncomeFromAdmissions != value) { - gameState.TotalIncomeFromAdmissions = value; + gameState.totalIncomeFromAdmissions = value; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ParkInformation); } @@ -253,48 +253,48 @@ namespace OpenRCT2::Scripting money64 ScPark::landPrice_get() const { - return GetGameState().LandPrice; + return getGameState().landPrice; } void ScPark::landPrice_set(money64 value) { ThrowIfGameStateNotMutable(); - GetGameState().LandPrice = value; + getGameState().landPrice = value; } money64 ScPark::constructionRightsPrice_get() const { - return GetGameState().ConstructionRightsPrice; + return getGameState().constructionRightsPrice; } void ScPark::constructionRightsPrice_set(money64 value) { ThrowIfGameStateNotMutable(); - GetGameState().ConstructionRightsPrice = value; + getGameState().constructionRightsPrice = value; } int16_t ScPark::casualtyPenalty_get() const { - return GetGameState().Park.RatingCasualtyPenalty; + return getGameState().park.RatingCasualtyPenalty; } void ScPark::casualtyPenalty_set(int16_t value) { ThrowIfGameStateNotMutable(); - GetGameState().Park.RatingCasualtyPenalty = value; + getGameState().park.RatingCasualtyPenalty = value; } uint16_t ScPark::parkSize_get() const { - return GetGameState().Park.Size; + return getGameState().park.Size; } std::string ScPark::name_get() const { - return GetGameState().Park.Name; + return getGameState().park.Name; } void ScPark::name_set(std::string value) { ThrowIfGameStateNotMutable(); - auto& park = GetGameState().Park; + auto& park = getGameState().park; if (park.Name != value) { park.Name = std::move(value); @@ -305,18 +305,18 @@ namespace OpenRCT2::Scripting bool ScPark::getFlag(const std::string& key) const { auto mask = ParkFlagMap[key]; - return (GetGameState().Park.Flags & mask) != 0; + return (getGameState().park.Flags & mask) != 0; } void ScPark::setFlag(const std::string& key, bool value) { ThrowIfGameStateNotMutable(); auto mask = ParkFlagMap[key]; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (value) - gameState.Park.Flags |= mask; + gameState.park.Flags |= mask; else - gameState.Park.Flags &= ~mask; + gameState.park.Flags &= ~mask; GfxInvalidateScreen(); } @@ -328,12 +328,12 @@ namespace OpenRCT2::Scripting std::vector> ScPark::messages_get() const { std::vector> result; - auto& gameState = GetGameState(); - for (size_t i = 0, newsSize = gameState.NewsItems.GetRecent().size(); i < newsSize; i++) + auto& gameState = getGameState(); + for (size_t i = 0, newsSize = gameState.newsItems.GetRecent().size(); i < newsSize; i++) { result.push_back(std::make_shared(i)); } - for (size_t i = 0, newsSize = gameState.NewsItems.GetArchived().size(); i < newsSize; i++) + for (size_t i = 0, newsSize = gameState.newsItems.GetArchived().size(); i < newsSize; i++) { result.push_back(std::make_shared(i + News::ItemHistoryStart)); } @@ -344,7 +344,7 @@ namespace OpenRCT2::Scripting { int32_t index = 0; int32_t archiveIndex = News::ItemHistoryStart; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); for (const auto& item : value) { auto isArchived = item["isArchived"].as_bool(); @@ -353,7 +353,7 @@ namespace OpenRCT2::Scripting { if (archiveIndex < News::MaxItems) { - gameState.NewsItems[archiveIndex] = newsItem; + gameState.newsItems[archiveIndex] = newsItem; archiveIndex++; } } @@ -361,7 +361,7 @@ namespace OpenRCT2::Scripting { if (index < News::ItemHistoryStart) { - gameState.NewsItems[index] = newsItem; + gameState.newsItems[index] = newsItem; index++; } } @@ -370,11 +370,11 @@ namespace OpenRCT2::Scripting // End the lists by setting next item to null if (index < News::ItemHistoryStart) { - gameState.NewsItems[index].Type = News::ItemType::Null; + gameState.newsItems[index].Type = News::ItemType::Null; } if (archiveIndex < News::MaxItems) { - gameState.NewsItems[archiveIndex].Type = News::ItemType::Null; + gameState.newsItems[archiveIndex].Type = News::ItemType::Null; } } @@ -421,10 +421,10 @@ namespace OpenRCT2::Scripting auto type = ScriptEngine::StringToExpenditureType(expenditureType); if (type != ExpenditureType::Count) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); for (size_t i = 0; i < recordedMonths; ++i) { - result[i] = gameState.ExpenditureTable[i][EnumValue(type)]; + result[i] = gameState.expenditureTable[i][EnumValue(type)]; } } return result; diff --git a/src/openrct2/scripting/bindings/world/ScParkMessage.cpp b/src/openrct2/scripting/bindings/world/ScParkMessage.cpp index 81fc23fb03..65f19a4ee4 100644 --- a/src/openrct2/scripting/bindings/world/ScParkMessage.cpp +++ b/src/openrct2/scripting/bindings/world/ScParkMessage.cpp @@ -43,7 +43,7 @@ namespace OpenRCT2::Scripting News::Item* ScParkMessage::GetMessage() const { - return &GetGameState().NewsItems[_index]; + return &getGameState().newsItems[_index]; } bool ScParkMessage::isArchived_get() const diff --git a/src/openrct2/scripting/bindings/world/ScResearch.cpp b/src/openrct2/scripting/bindings/world/ScResearch.cpp index f58c5a6db8..4d1901b7c4 100644 --- a/src/openrct2/scripting/bindings/world/ScResearch.cpp +++ b/src/openrct2/scripting/bindings/world/ScResearch.cpp @@ -97,13 +97,13 @@ namespace OpenRCT2::Scripting uint8_t ScResearch::funding_get() const { - return GetGameState().ResearchFundingLevel; + return getGameState().researchFundingLevel; } void ScResearch::funding_set(uint8_t value) { ThrowIfGameStateNotMutable(); - GetGameState().ResearchFundingLevel = std::clamp(value, RESEARCH_FUNDING_NONE, RESEARCH_FUNDING_MAXIMUM); + getGameState().researchFundingLevel = std::clamp(value, RESEARCH_FUNDING_NONE, RESEARCH_FUNDING_MAXIMUM); } std::vector ScResearch::priorities_get() const @@ -112,7 +112,7 @@ namespace OpenRCT2::Scripting for (auto i = EnumValue(ResearchCategory::Transport); i <= EnumValue(ResearchCategory::SceneryGroup); i++) { auto category = static_cast(i); - if (GetGameState().ResearchPriorities & EnumToFlag(category)) + if (getGameState().researchPriorities & EnumToFlag(category)) { result.emplace_back(ResearchCategoryMap[category]); } @@ -133,12 +133,12 @@ namespace OpenRCT2::Scripting priorities |= EnumToFlag(*category); } } - GetGameState().ResearchPriorities = priorities; + getGameState().researchPriorities = priorities; } std::string ScResearch::stage_get() const { - return std::string(ResearchStageMap[GetGameState().ResearchProgressStage]); + return std::string(ResearchStageMap[getGameState().researchProgressStage]); } void ScResearch::stage_set(const std::string& value) @@ -147,57 +147,57 @@ namespace OpenRCT2::Scripting auto it = ResearchStageMap.find(value); if (it != ResearchStageMap.end()) { - GetGameState().ResearchProgressStage = it->second; + getGameState().researchProgressStage = it->second; } } uint16_t ScResearch::progress_get() const { - return GetGameState().ResearchProgress; + return getGameState().researchProgress; } void ScResearch::progress_set(uint16_t value) { ThrowIfGameStateNotMutable(); - GetGameState().ResearchProgress = value; + getGameState().researchProgress = value; } DukValue ScResearch::expectedMonth_get() const { - const auto& gameState = GetGameState(); - if (gameState.ResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH || gameState.ResearchExpectedDay == 255) + const auto& gameState = getGameState(); + if (gameState.researchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH || gameState.researchExpectedDay == 255) return ToDuk(_context, nullptr); - return ToDuk(_context, gameState.ResearchExpectedMonth); + return ToDuk(_context, gameState.researchExpectedMonth); } DukValue ScResearch::expectedDay_get() const { - const auto& gameState = GetGameState(); - if (gameState.ResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH || gameState.ResearchExpectedDay == 255) + const auto& gameState = getGameState(); + if (gameState.researchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH || gameState.researchExpectedDay == 255) return ToDuk(_context, nullptr); - return ToDuk(_context, gameState.ResearchExpectedDay + 1); + return ToDuk(_context, gameState.researchExpectedDay + 1); } DukValue ScResearch::lastResearchedItem_get() const { - const auto& gameState = GetGameState(); - if (!gameState.ResearchLastItem) + const auto& gameState = getGameState(); + if (!gameState.researchLastItem) return ToDuk(_context, nullptr); - return ToDuk(_context, *gameState.ResearchLastItem); + return ToDuk(_context, *gameState.researchLastItem); } DukValue ScResearch::expectedItem_get() const { - const auto& gameState = GetGameState(); - if (gameState.ResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH || !gameState.ResearchNextItem) + const auto& gameState = getGameState(); + if (gameState.researchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH || !gameState.researchNextItem) return ToDuk(_context, nullptr); - return ToDuk(_context, *gameState.ResearchNextItem); + return ToDuk(_context, *gameState.researchNextItem); } std::vector ScResearch::inventedItems_get() const { std::vector result; - for (auto& item : GetGameState().ResearchItemsInvented) + for (auto& item : getGameState().researchItemsInvented) { result.push_back(ToDuk(_context, item)); } @@ -208,14 +208,14 @@ namespace OpenRCT2::Scripting { ThrowIfGameStateNotMutable(); auto list = ConvertResearchList(value); - GetGameState().ResearchItemsInvented = std::move(list); + getGameState().researchItemsInvented = std::move(list); ResearchFix(); } std::vector ScResearch::uninventedItems_get() const { std::vector result; - for (auto& item : GetGameState().ResearchItemsUninvented) + for (auto& item : getGameState().researchItemsUninvented) { result.push_back(ToDuk(_context, item)); } @@ -226,7 +226,7 @@ namespace OpenRCT2::Scripting { ThrowIfGameStateNotMutable(); auto list = ConvertResearchList(value); - GetGameState().ResearchItemsUninvented = std::move(list); + getGameState().researchItemsUninvented = std::move(list); ResearchFix(); } diff --git a/src/openrct2/scripting/bindings/world/ScScenario.hpp b/src/openrct2/scripting/bindings/world/ScScenario.hpp index f4f8da52d4..345faeea75 100644 --- a/src/openrct2/scripting/bindings/world/ScScenario.hpp +++ b/src/openrct2/scripting/bindings/world/ScScenario.hpp @@ -40,22 +40,22 @@ namespace OpenRCT2::Scripting private: std::string type_get() { - return std::string(ScenarioObjectiveTypeMap[GetGameState().ScenarioObjective.Type]); + return std::string(ScenarioObjectiveTypeMap[getGameState().scenarioObjective.Type]); } void type_set(const std::string& value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioObjective.Type = ScenarioObjectiveTypeMap[value]; + getGameState().scenarioObjective.Type = ScenarioObjectiveTypeMap[value]; } uint16_t guests_get() { - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_BY - || gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY + || gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) { - return gameState.ScenarioObjective.NumGuests; + return gameState.scenarioObjective.NumGuests; } return 0; } @@ -63,42 +63,42 @@ namespace OpenRCT2::Scripting void guests_set(uint16_t value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_BY - || gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY + || gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) { - gameState.ScenarioObjective.NumGuests = value; + gameState.scenarioObjective.NumGuests = value; } } uint8_t year_get() { - const auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_BY - || gameState.ScenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY) + const auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY + || gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY) { - return gameState.ScenarioObjective.Year; + return gameState.scenarioObjective.Year; } return 0; } void year_set(uint8_t value) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); ThrowIfGameStateNotMutable(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_GUESTS_BY - || gameState.ScenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY) + if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY + || gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY) { - gameState.ScenarioObjective.Year = value; + gameState.scenarioObjective.Year = value; } } uint16_t length_get() { - const auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH) + const auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH) { - return gameState.ScenarioObjective.NumGuests; + return gameState.scenarioObjective.NumGuests; } return 0; } @@ -106,19 +106,19 @@ namespace OpenRCT2::Scripting void length_set(uint16_t value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH) { - gameState.ScenarioObjective.NumGuests = value; + gameState.scenarioObjective.NumGuests = value; } } money64 excitement_get() { - const auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS) + const auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS) { - return gameState.ScenarioObjective.Currency; + return gameState.scenarioObjective.Currency; } return 0; } @@ -126,20 +126,20 @@ namespace OpenRCT2::Scripting void excitement_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS) { - gameState.ScenarioObjective.Currency = value; + gameState.scenarioObjective.Currency = value; } } money64 parkValue_get() { - const auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY - || gameState.ScenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE) + const auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY + || gameState.scenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE) { - return gameState.ScenarioObjective.Currency; + return gameState.scenarioObjective.Currency; } return 0; } @@ -147,21 +147,21 @@ namespace OpenRCT2::Scripting void parkValue_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY - || gameState.ScenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY + || gameState.scenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE) { - gameState.ScenarioObjective.Currency = value; + gameState.scenarioObjective.Currency = value; } } money64 monthlyIncome_get() { - const auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_MONTHLY_RIDE_INCOME - || gameState.ScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME) + const auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_MONTHLY_RIDE_INCOME + || gameState.scenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME) { - return gameState.ScenarioObjective.Currency; + return gameState.scenarioObjective.Currency; } return 0; } @@ -169,11 +169,11 @@ namespace OpenRCT2::Scripting void monthlyIncome_set(money64 value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); - if (gameState.ScenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY - || gameState.ScenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE) + auto& gameState = getGameState(); + if (gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY + || gameState.scenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE) { - gameState.ScenarioObjective.Currency = value; + gameState.scenarioObjective.Currency = value; } } @@ -197,46 +197,46 @@ namespace OpenRCT2::Scripting public: std::string name_get() { - return GetGameState().ScenarioName; + return getGameState().scenarioName; } void name_set(const std::string& value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioName = value; + getGameState().scenarioName = value; } std::string details_get() { - return GetGameState().ScenarioDetails; + return getGameState().scenarioDetails; } void details_set(const std::string& value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioDetails = value; + getGameState().scenarioDetails = value; } std::string completedBy_get() { - return GetGameState().ScenarioCompletedBy; + return getGameState().scenarioCompletedBy; } void completedBy_set(const std::string& value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioCompletedBy = value; + getGameState().scenarioCompletedBy = value; } std::string filename_get() { - return GetGameState().ScenarioFileName; + return getGameState().scenarioFileName; } void filename_set(const std::string& value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioFileName = value; + getGameState().scenarioFileName = value; } std::shared_ptr objective_get() const @@ -246,61 +246,61 @@ namespace OpenRCT2::Scripting uint16_t parkRatingWarningDays_get() const { - return GetGameState().ScenarioParkRatingWarningDays; + return getGameState().scenarioParkRatingWarningDays; } void parkRatingWarningDays_set(uint16_t value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioParkRatingWarningDays = value; + getGameState().scenarioParkRatingWarningDays = value; } DukValue completedCompanyValue_get() const { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); auto ctx = GetContext()->GetScriptEngine().GetContext(); - if (gameState.ScenarioCompletedCompanyValue == kMoney64Undefined - || gameState.ScenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) + if (gameState.scenarioCompletedCompanyValue == kMoney64Undefined + || gameState.scenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) { return ToDuk(ctx, nullptr); } - return ToDuk(ctx, gameState.ScenarioCompletedCompanyValue); + return ToDuk(ctx, gameState.scenarioCompletedCompanyValue); } void completedCompanyValue_set(int32_t value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioCompletedCompanyValue = value; + getGameState().scenarioCompletedCompanyValue = value; } std::string status_get() const { - const auto& gameState = GetGameState(); - if (gameState.ScenarioCompletedCompanyValue == kMoney64Undefined) + const auto& gameState = getGameState(); + if (gameState.scenarioCompletedCompanyValue == kMoney64Undefined) return "inProgress"; - if (gameState.ScenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) + if (gameState.scenarioCompletedCompanyValue == kCompanyValueOnFailedObjective) return "failed"; return "completed"; } void status_set(const std::string& value) { ThrowIfGameStateNotMutable(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); if (value == "inProgress") - gameState.ScenarioCompletedCompanyValue = kMoney64Undefined; + gameState.scenarioCompletedCompanyValue = kMoney64Undefined; else if (value == "failed") - gameState.ScenarioCompletedCompanyValue = kCompanyValueOnFailedObjective; + gameState.scenarioCompletedCompanyValue = kCompanyValueOnFailedObjective; else if (value == "completed") - gameState.ScenarioCompletedCompanyValue = gameState.CompanyValue; + gameState.scenarioCompletedCompanyValue = gameState.companyValue; } money64 companyValueRecord_get() const { - return GetGameState().ScenarioCompanyValueRecord; + return getGameState().scenarioCompanyValueRecord; } void companyValueRecord_set(money64 value) { ThrowIfGameStateNotMutable(); - GetGameState().ScenarioCompanyValueRecord = value; + getGameState().scenarioCompanyValueRecord = value; } public: diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index 2b29b02650..2552475b9c 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -121,19 +121,19 @@ static RideId BannerGetRideIndexAt(const CoordsXYZ& bannerCoords) static BannerIndex BannerGetNewIndex() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); for (BannerIndex::UnderlyingType bannerIndex = 0; bannerIndex < MAX_BANNERS; bannerIndex++) { - if (bannerIndex < gameState.Banners.size()) + if (bannerIndex < gameState.banners.size()) { - if (gameState.Banners[bannerIndex].IsNull()) + if (gameState.banners[bannerIndex].IsNull()) { return BannerIndex::FromUnderlying(bannerIndex); } } else { - gameState.Banners.emplace_back(); + gameState.banners.emplace_back(); return BannerIndex::FromUnderlying(bannerIndex); } } @@ -146,7 +146,7 @@ static BannerIndex BannerGetNewIndex() */ void BannerInit(GameState_t& gameState) { - gameState.Banners.clear(); + gameState.banners.clear(); } TileElement* BannerGetTileElement(BannerIndex bannerIndex) @@ -254,11 +254,11 @@ struct BannerElementWithPos // Returns a list of BannerElement's with the tile position. static std::vector GetAllBannerElementsOnMap() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); std::vector banners; - for (int y = 0; y < gameState.MapSize.y; y++) + for (int y = 0; y < gameState.mapSize.y; y++) { - for (int x = 0; x < gameState.MapSize.x; x++) + for (int x = 0; x < gameState.mapSize.x; x++) { const auto tilePos = TileCoordsXY{ x, y }; for (auto* bannerElement : OpenRCT2::TileElementsView(tilePos.ToCoordsXY())) @@ -278,8 +278,8 @@ static std::vector GetAllBannerElementsOnMap() // has a tile with the banner index, if no tile is found then the banner element will be released. static void BannerDeallocateUnlinked() { - auto& gameState = GetGameState(); - for (BannerIndex::UnderlyingType index = 0; index < gameState.Banners.size(); index++) + auto& gameState = getGameState(); + for (BannerIndex::UnderlyingType index = 0; index < gameState.banners.size(); index++) { const auto bannerId = BannerIndex::FromUnderlying(index); auto* tileElement = BannerGetTileElement(bannerId); @@ -373,8 +373,8 @@ void BannerApplyFixes() void UnlinkAllRideBanners() { - auto& gameState = GetGameState(); - for (auto& banner : gameState.Banners) + auto& gameState = getGameState(); + for (auto& banner : gameState.banners) { if (!banner.IsNull()) { @@ -386,8 +386,8 @@ void UnlinkAllRideBanners() void UnlinkAllBannersForRide(RideId rideId) { - auto& gameState = GetGameState(); - for (auto& banner : gameState.Banners) + auto& gameState = getGameState(); + for (auto& banner : gameState.banners) { if (!banner.IsNull() && (banner.flags & BANNER_FLAG_LINKED_TO_RIDE) && banner.ride_index == rideId) { @@ -400,11 +400,11 @@ void UnlinkAllBannersForRide(RideId rideId) Banner* GetBanner(BannerIndex id) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto index = id.ToUnderlying(); - if (index < gameState.Banners.size()) + if (index < gameState.banners.size()) { - auto banner = &gameState.Banners[index]; + auto banner = &gameState.banners[index]; if (banner != nullptr && !banner->IsNull()) { return banner; @@ -415,16 +415,16 @@ Banner* GetBanner(BannerIndex id) Banner* GetOrCreateBanner(BannerIndex id) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); const auto index = id.ToUnderlying(); if (index < MAX_BANNERS) { - if (index >= gameState.Banners.size()) + if (index >= gameState.banners.size()) { - gameState.Banners.resize(index + 1); + gameState.banners.resize(index + 1); } // Create the banner - auto& banner = gameState.Banners[index]; + auto& banner = gameState.banners[index]; banner.id = id; return &banner; } @@ -458,24 +458,24 @@ void DeleteBanner(BannerIndex id) void TrimBanners() { - auto& gameState = GetGameState(); - if (gameState.Banners.size() > 0) + auto& gameState = getGameState(); + if (gameState.banners.size() > 0) { - auto lastBannerId = gameState.Banners.size() - 1; - while (lastBannerId != std::numeric_limits::max() && gameState.Banners[lastBannerId].IsNull()) + auto lastBannerId = gameState.banners.size() - 1; + while (lastBannerId != std::numeric_limits::max() && gameState.banners[lastBannerId].IsNull()) { lastBannerId--; } - gameState.Banners.resize(lastBannerId + 1); - gameState.Banners.shrink_to_fit(); + gameState.banners.resize(lastBannerId + 1); + gameState.banners.shrink_to_fit(); } } size_t GetNumBanners() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); size_t count = 0; - for (const auto& banner : gameState.Banners) + for (const auto& banner : gameState.banners) { if (!banner.IsNull()) { diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index ccfc6637a8..b4acceeede 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -115,12 +115,12 @@ void ClimateReset() auto weather = WeatherType::PartiallyCloudy; const WeatherTrait& trait = kClimateWeatherTraits[EnumValue(weather)]; - auto& gameState = GetGameState(); - gameState.WeatherCurrent.weatherType = weather; - gameState.WeatherCurrent.temperature = pattern.baseTemperature + trait.temperatureDelta; - gameState.WeatherCurrent.weatherEffect = trait.effectLevel; - gameState.WeatherCurrent.weatherGloom = trait.gloomLevel; - gameState.WeatherCurrent.level = trait.level; + auto& gameState = getGameState(); + gameState.weatherCurrent.weatherType = weather; + gameState.weatherCurrent.temperature = pattern.baseTemperature + trait.temperatureDelta; + gameState.weatherCurrent.weatherEffect = trait.effectLevel; + gameState.weatherCurrent.weatherGloom = trait.gloomLevel; + gameState.weatherCurrent.level = trait.level; _lightningTimer = 0; _thunderTimer = 0; @@ -141,58 +141,58 @@ void ClimateUpdate() { PROFILED_FUNCTION(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Only do climate logic if playing (not in scenario editor or title screen) if (gLegacyScene != LegacyScene::playing) return; - if (!GetGameState().Cheats.freezeWeather) + if (!getGameState().cheats.freezeWeather) { - if (gameState.WeatherUpdateTimer) + if (gameState.weatherUpdateTimer) { - if (gameState.WeatherUpdateTimer == 960) + if (gameState.weatherUpdateTimer == 960) { auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); ContextBroadcastIntent(&intent); } - gameState.WeatherUpdateTimer--; + gameState.weatherUpdateTimer--; } - else if (!(gameState.CurrentTicks & 0x7F)) + else if (!(gameState.currentTicks & 0x7F)) { - if (gameState.WeatherCurrent.temperature == gameState.WeatherNext.temperature) + if (gameState.weatherCurrent.temperature == gameState.weatherNext.temperature) { - if (gameState.WeatherCurrent.weatherGloom == gameState.WeatherNext.weatherGloom) + if (gameState.weatherCurrent.weatherGloom == gameState.weatherNext.weatherGloom) { - gameState.WeatherCurrent.weatherEffect = gameState.WeatherNext.weatherEffect; + gameState.weatherCurrent.weatherEffect = gameState.weatherNext.weatherEffect; _thunderTimer = 0; _lightningTimer = 0; - if (gameState.WeatherCurrent.level == gameState.WeatherNext.level) + if (gameState.weatherCurrent.level == gameState.weatherNext.level) { - gameState.WeatherCurrent.weatherType = gameState.WeatherNext.weatherType; + gameState.weatherCurrent.weatherType = gameState.weatherNext.weatherType; ClimateDetermineFutureWeather(ScenarioRand()); auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); ContextBroadcastIntent(&intent); } - else if (gameState.WeatherNext.level <= WeatherLevel::Heavy) + else if (gameState.weatherNext.level <= WeatherLevel::Heavy) { - gameState.WeatherCurrent.level = static_cast(ClimateStepWeatherLevel( - static_cast(gameState.WeatherCurrent.level), - static_cast(gameState.WeatherNext.level))); + gameState.weatherCurrent.level = static_cast(ClimateStepWeatherLevel( + static_cast(gameState.weatherCurrent.level), + static_cast(gameState.weatherNext.level))); } } else { - gameState.WeatherCurrent.weatherGloom = ClimateStepWeatherLevel( - gameState.WeatherCurrent.weatherGloom, gameState.WeatherNext.weatherGloom); + gameState.weatherCurrent.weatherGloom = ClimateStepWeatherLevel( + gameState.weatherCurrent.weatherGloom, gameState.weatherNext.weatherGloom); GfxInvalidateScreen(); } } else { - gameState.WeatherCurrent.temperature = ClimateStepWeatherLevel( - gameState.WeatherCurrent.temperature, gameState.WeatherNext.temperature); + gameState.weatherCurrent.temperature = ClimateStepWeatherLevel( + gameState.weatherCurrent.temperature, gameState.weatherNext.temperature); auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); ContextBroadcastIntent(&intent); } @@ -205,8 +205,8 @@ void ClimateUpdate() ClimateUpdateThunder(); } else if ( - gameState.WeatherCurrent.weatherEffect == WeatherEffectType::Storm - || gameState.WeatherCurrent.weatherEffect == WeatherEffectType::Blizzard) + gameState.weatherCurrent.weatherEffect == WeatherEffectType::Storm + || gameState.weatherCurrent.weatherEffect == WeatherEffectType::Blizzard) { // Create new thunder and lightning uint32_t randomNumber = UtilRand(); @@ -231,13 +231,13 @@ void ClimateForceWeather(WeatherType weather) const auto& trait = kClimateWeatherTraits[EnumValue(weather)]; - auto& gameState = GetGameState(); - gameState.WeatherCurrent.weatherType = weather; - gameState.WeatherCurrent.weatherGloom = trait.gloomLevel; - gameState.WeatherCurrent.level = trait.level; - gameState.WeatherCurrent.weatherEffect = trait.effectLevel; - gameState.WeatherCurrent.temperature = pattern.baseTemperature + trait.temperatureDelta; - gameState.WeatherUpdateTimer = 1920; + auto& gameState = getGameState(); + gameState.weatherCurrent.weatherType = weather; + gameState.weatherCurrent.weatherGloom = trait.gloomLevel; + gameState.weatherCurrent.level = trait.level; + gameState.weatherCurrent.weatherEffect = trait.effectLevel; + gameState.weatherCurrent.temperature = pattern.baseTemperature + trait.temperatureDelta; + gameState.weatherUpdateTimer = 1920; ClimateDetermineFutureWeather(ScenarioRand()); @@ -261,25 +261,25 @@ void ClimateUpdateSound() bool ClimateIsRaining() { - auto& weather = GetGameState().WeatherCurrent.weatherType; + auto& weather = getGameState().weatherCurrent.weatherType; return weather == WeatherType::Rain || weather == WeatherType::HeavyRain || weather == WeatherType::Thunder; } bool ClimateIsSnowing() { - auto& weather = GetGameState().WeatherCurrent.weatherType; + auto& weather = getGameState().weatherCurrent.weatherType; return weather == WeatherType::Snow || weather == WeatherType::HeavySnow || weather == WeatherType::Blizzard; } bool ClimateTransitioningToSnow() { - auto& weather = GetGameState().WeatherNext.weatherType; + auto& weather = getGameState().weatherNext.weatherType; return weather == WeatherType::Snow || weather == WeatherType::HeavySnow || weather == WeatherType::Blizzard; } bool ClimateIsSnowingHeavily() { - auto& weather = GetGameState().WeatherCurrent.weatherType; + auto& weather = getGameState().weatherCurrent.weatherType; return weather == WeatherType::HeavySnow || weather == WeatherType::Blizzard; } @@ -335,22 +335,22 @@ static void ClimateDetermineFutureWeather(uint32_t randomValue) const auto randomIndex = ((randomValue % 256) * pattern.randomBias) / 256; const auto nextWeather = pattern.distribution[randomIndex]; - auto& gameState = GetGameState(); - gameState.WeatherNext.weatherType = nextWeather; + auto& gameState = getGameState(); + gameState.weatherNext.weatherType = nextWeather; const auto& nextWeatherTrait = kClimateWeatherTraits[EnumValue(nextWeather)]; - gameState.WeatherNext.temperature = pattern.baseTemperature + nextWeatherTrait.temperatureDelta; - gameState.WeatherNext.weatherEffect = nextWeatherTrait.effectLevel; - gameState.WeatherNext.weatherGloom = nextWeatherTrait.gloomLevel; - gameState.WeatherNext.level = nextWeatherTrait.level; + gameState.weatherNext.temperature = pattern.baseTemperature + nextWeatherTrait.temperatureDelta; + gameState.weatherNext.weatherEffect = nextWeatherTrait.effectLevel; + gameState.weatherNext.weatherGloom = nextWeatherTrait.gloomLevel; + gameState.weatherNext.level = nextWeatherTrait.level; - gameState.WeatherUpdateTimer = 1920; + gameState.weatherUpdateTimer = 1920; } static void ClimateUpdateWeatherSound() { - if (GetGameState().WeatherCurrent.weatherEffect == WeatherEffectType::Rain - || GetGameState().WeatherCurrent.weatherEffect == WeatherEffectType::Storm) + if (getGameState().weatherCurrent.weatherEffect == WeatherEffectType::Rain + || getGameState().weatherCurrent.weatherEffect == WeatherEffectType::Storm) { // Start playing the weather sound if (_weatherSoundChannel == nullptr || _weatherSoundChannel->IsDone()) diff --git a/src/openrct2/world/ConstructionClearance.cpp b/src/openrct2/world/ConstructionClearance.cpp index e22084aff9..4d9132edd0 100644 --- a/src/openrct2/world/ConstructionClearance.cpp +++ b/src/openrct2/world/ConstructionClearance.cpp @@ -44,14 +44,14 @@ static int32_t MapPlaceClearFunc( auto* scenery = (*tile_element)->AsSmallScenery()->GetEntry(); - auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) + auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) { if (scenery != nullptr && scenery->HasFlag(SMALL_SCENERY_FLAG_IS_TREE)) return 1; } - if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY) && scenery != nullptr) + if (!(gameState.park.Flags & PARK_FLAGS_NO_MONEY) && scenery != nullptr) *price += scenery->removal_price; if (flags & GAME_COMMAND_FLAG_GHOST) @@ -146,7 +146,7 @@ GameActions::Result MapCanConstructWithClearAt( return res; } - if (GetGameState().Cheats.disableClearanceChecks) + if (getGameState().cheats.disableClearanceChecks) { res.SetData(ConstructClearResult{ groundFlags }); return res; @@ -198,7 +198,7 @@ GameActions::Result MapCanConstructWithClearAt( } } - if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION && !isTree) + if (getGameState().park.Flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION && !isTree) { const auto heightFromGround = pos.clearanceZ - tileElement->GetBaseZ(); diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 64005c57e9..f23bba538b 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -69,7 +69,7 @@ void ParkEntranceRemoveGhost() int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos) { int32_t i = 0; - for (const auto& entrance : GetGameState().Park.Entrances) + for (const auto& entrance : getGameState().park.Entrances) { if (entrancePos == entrance) { @@ -82,7 +82,7 @@ int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos) void ParkEntranceReset() { - GetGameState().Park.Entrances.clear(); + getGameState().park.Entrances.clear(); } void RideEntranceExitPlaceProvisionalGhost() @@ -211,19 +211,19 @@ void MazeEntranceHedgeRemoval(const CoordsXYE& entrance) void ParkEntranceFixLocations(void) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Fix ParkEntrance locations for which the tile_element no longer exists - gameState.Park.Entrances.erase( + gameState.park.Entrances.erase( std::remove_if( - gameState.Park.Entrances.begin(), gameState.Park.Entrances.end(), + gameState.park.Entrances.begin(), gameState.park.Entrances.end(), [](const auto& entrance) { return MapGetParkEntranceElementAt(entrance, false) == nullptr; }), - gameState.Park.Entrances.end()); + gameState.park.Entrances.end()); } void ParkEntranceUpdateLocations() { - auto& gameState = GetGameState(); - gameState.Park.Entrances.clear(); + auto& gameState = getGameState(); + gameState.park.Entrances.clear(); TileElementIterator it; TileElementIteratorBegin(&it); while (TileElementIteratorNext(&it)) @@ -233,7 +233,7 @@ void ParkEntranceUpdateLocations() && entranceElement->GetSequenceIndex() == 0 && !entranceElement->IsGhost()) { auto entrance = TileCoordsXYZD(it.x, it.y, it.element->BaseHeight, it.element->GetDirection()).ToCoordsXYZD(); - gameState.Park.Entrances.push_back(entrance); + gameState.park.Entrances.push_back(entrance); } } } diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 3f81b25cf7..390dcfcf37 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -560,7 +560,7 @@ static void Loc6A6D7E( FootpathNeighbourList* neighbourList) { auto targetPos = CoordsXY{ initialTileElementPos } + CoordsDirectionDelta[direction]; - if ((gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && MapIsEdge(targetPos)) + if ((gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode) && MapIsEdge(targetPos)) { if (query) { @@ -1807,7 +1807,7 @@ void FootpathRemoveEdgesAt(const CoordsXY& footpathPos, TileElement* tileElement static ObjectEntryIndex FootpathGetDefaultSurface(bool queue) { - bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode); for (ObjectEntryIndex i = 0; i < kMaxFootpathSurfaceObjects; i++) { auto pathEntry = GetPathSurfaceEntry(i); @@ -1831,7 +1831,7 @@ static bool FootpathIsSurfaceEntryOkay(ObjectEntryIndex index, bool queue) auto pathEntry = GetPathSurfaceEntry(index); if (pathEntry != nullptr) { - bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode); if (!showEditorPaths && (pathEntry->Flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR)) { return false; @@ -1859,7 +1859,7 @@ static ObjectEntryIndex FootpathGetDefaultRailings() static bool FootpathIsLegacyPathEntryOkay(ObjectEntryIndex index) { - bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || getGameState().cheats.sandboxMode); auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); auto footpathObj = objManager.GetLoadedObject(index); if (footpathObj != nullptr) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index dbf63bd70b..a78c7101ee 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -114,32 +114,32 @@ static TileCoordsXY _mapSizeStash; void StashMap() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); _tileIndexStash = std::move(_tileIndex); - _tileElementsStash = std::move(gameState.TileElements); - _mapSizeStash = gameState.MapSize; + _tileElementsStash = std::move(gameState.tileElements); + _mapSizeStash = gameState.mapSize; _tileElementsInUseStash = _tileElementsInUse; } void UnstashMap() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); _tileIndex = std::move(_tileIndexStash); - gameState.TileElements = std::move(_tileElementsStash); - gameState.MapSize = _mapSizeStash; + gameState.tileElements = std::move(_tileElementsStash); + gameState.mapSize = _mapSizeStash; _tileElementsInUse = _tileElementsInUseStash; } CoordsXY GetMapSizeUnits() { - auto& gameState = GetGameState(); - return { (gameState.MapSize.x - 1) * kCoordsXYStep, (gameState.MapSize.y - 1) * kCoordsXYStep }; + auto& gameState = getGameState(); + return { (gameState.mapSize.x - 1) * kCoordsXYStep, (gameState.mapSize.y - 1) * kCoordsXYStep }; } CoordsXY GetMapSizeMinus2() { - auto& gameState = GetGameState(); - return { (gameState.MapSize.x * kCoordsXYStep) + (8 * kCoordsXYStep - 2), - (gameState.MapSize.y * kCoordsXYStep) + (8 * kCoordsXYStep - 2) }; + auto& gameState = getGameState(); + return { (gameState.mapSize.x * kCoordsXYStep) + (8 * kCoordsXYStep - 2), + (gameState.mapSize.y * kCoordsXYStep) + (8 * kCoordsXYStep - 2) }; } CoordsXY GetMapSizeMaxXY() { @@ -148,15 +148,15 @@ CoordsXY GetMapSizeMaxXY() const std::vector& GetTileElements() { - return GetGameState().TileElements; + return getGameState().tileElements; } void SetTileElements(GameState_t& gameState, std::vector&& tileElements) { - gameState.TileElements = std::move(tileElements); + gameState.tileElements = std::move(tileElements); _tileIndex = TilePointerIndex( - kMaximumMapSizeTechnical, gameState.TileElements.data(), gameState.TileElements.size()); - _tileElementsInUse = gameState.TileElements.size(); + kMaximumMapSizeTechnical, gameState.tileElements.data(), gameState.tileElements.size()); + _tileElementsInUse = gameState.tileElements.size(); } static TileElement GetDefaultSurfaceElement() @@ -179,7 +179,7 @@ static TileElement GetDefaultSurfaceElement() std::vector GetReorganisedTileElementsWithoutGhosts() { std::vector newElements; - newElements.reserve(std::max(MIN_TILE_ELEMENTS, GetGameState().TileElements.size())); + newElements.reserve(std::max(MIN_TILE_ELEMENTS, getGameState().tileElements.size())); for (int32_t y = 0; y < kMaximumMapSizeTechnical; y++) { for (int32_t x = 0; x < kMaximumMapSizeTechnical; x++) @@ -244,14 +244,14 @@ static void ReorganiseTileElements(GameState_t& gameState, size_t capacity) static void ReorganiseTileElements(size_t capacity) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); ReorganiseTileElements(gameState, capacity); } void ReorganiseTileElements() { - auto& gameState = GetGameState(); - ReorganiseTileElements(gameState, gameState.TileElements.size()); + auto& gameState = getGameState(); + ReorganiseTileElements(gameState, gameState.tileElements.size()); } static bool MapCheckFreeElementsAndReorganise(size_t numElementsOnTile, size_t numNewElements) @@ -262,20 +262,20 @@ static bool MapCheckFreeElementsAndReorganise(size_t numElementsOnTile, size_t n return false; } - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto totalElementsRequired = numElementsOnTile + numNewElements; - auto freeElements = gameState.TileElements.capacity() - gameState.TileElements.size(); + auto freeElements = gameState.tileElements.capacity() - gameState.tileElements.size(); if (freeElements >= totalElementsRequired) { return true; } // if space issue is due to fragmentation then Reorg Tiles without increasing capacity - if (gameState.TileElements.size() > totalElementsRequired + _tileElementsInUse) + if (gameState.tileElements.size() > totalElementsRequired + _tileElementsInUse) { ReorganiseTileElements(); // This check is not expected to fail - freeElements = gameState.TileElements.capacity() - gameState.TileElements.size(); + freeElements = gameState.tileElements.capacity() - gameState.tileElements.size(); if (freeElements >= totalElementsRequired) { return true; @@ -283,7 +283,7 @@ static bool MapCheckFreeElementsAndReorganise(size_t numElementsOnTile, size_t n } // Capacity must increase to handle the space (Note capacity can go above kMaxTileElements) - auto newCapacity = gameState.TileElements.capacity() * 2; + auto newCapacity = gameState.tileElements.capacity() * 2; ReorganiseTileElements(newCapacity); return true; } @@ -319,15 +319,15 @@ int32_t TileElementIteratorNext(TileElementIterator* it) return 1; } - auto& gameState = GetGameState(); - if (it->y < (gameState.MapSize.y - 2)) + auto& gameState = getGameState(); + if (it->y < (gameState.mapSize.y - 2)) { it->y++; it->element = MapGetFirstElementAt(TileCoordsXY{ it->x, it->y }); return it->element == nullptr ? 0 : 1; } - if (it->x < (gameState.MapSize.x - 2)) + if (it->x < (gameState.mapSize.x - 2)) { it->y = 1; it->x++; @@ -465,12 +465,12 @@ void MapInit(const TileCoordsXY& size) { auto numTiles = kMaximumMapSizeTechnical * kMaximumMapSizeTechnical; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); SetTileElements(gameState, std::vector(numTiles, GetDefaultSurfaceElement())); - gameState.GrassSceneryTileLoopPosition = 0; - gameState.WidePathTileLoopPosition = {}; - gameState.MapSize = size; + gameState.grassSceneryTileLoopPosition = 0; + gameState.widePathTileLoopPosition = {}; + gameState.mapSize = size; MapRemoveOutOfRangeElements(); ClearMapAnimations(); @@ -487,11 +487,11 @@ void MapCountRemainingLandRights() { gLandRemainingOwnershipSales = 0; gLandRemainingConstructionSales = 0; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - for (int32_t y = 0; y < gameState.MapSize.y; y++) + for (int32_t y = 0; y < gameState.mapSize.y; y++) { - for (int32_t x = 0; x < gameState.MapSize.x; x++) + for (int32_t x = 0; x < gameState.mapSize.x; x++) { auto* surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }); // Surface elements are sometimes hacked out to save some space for other map elements @@ -531,8 +531,8 @@ void MapCountRemainingLandRights() */ void MapStripGhostFlagFromElements() { - auto& gameState = GetGameState(); - for (auto& element : gameState.TileElements) + auto& gameState = getGameState(); + for (auto& element : gameState.tileElements) { element.SetGhost(false); } @@ -764,13 +764,13 @@ void MapUpdatePathWideFlags() return; } - const int32_t kPracticalMapSizeBigX = GetGameState().MapSize.x * kCoordsXYStep; - const int32_t kPracticalMapSizeBigY = GetGameState().MapSize.y * kCoordsXYStep; + const int32_t kPracticalMapSizeBigX = getGameState().mapSize.x * kCoordsXYStep; + const int32_t kPracticalMapSizeBigY = getGameState().mapSize.y * kCoordsXYStep; // Presumably update_path_wide_flags is too computationally expensive to call for every // tile every update, so gWidePathTileLoopX and gWidePathTileLoopY store the x and y // progress. A maximum of 128 calls is done per update. - CoordsXY& loopPosition = GetGameState().WidePathTileLoopPosition; + CoordsXY& loopPosition = getGameState().widePathTileLoopPosition; for (int32_t i = 0; i < 128; i++) { FootpathUpdatePathWideFlags(loopPosition); @@ -829,7 +829,7 @@ bool MapCanBuildAt(const CoordsXYZ& loc) { if (gLegacyScene == LegacyScene::scenarioEditor) return true; - if (GetGameState().Cheats.sandboxMode) + if (getGameState().cheats.sandboxMode) return true; if (MapIsLocationOwned(loc)) return true; @@ -965,7 +965,7 @@ uint8_t MapGetLowestLandHeight(const MapRange& range) if (surfaceElement != nullptr && min_height > surfaceElement->BaseHeight) { - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { @@ -994,7 +994,7 @@ uint8_t MapGetHighestLandHeight(const MapRange& range) auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ xi, yi }); if (surfaceElement != nullptr) { - if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !getGameState().cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { @@ -1041,10 +1041,10 @@ void TileElementRemove(TileElement* tileElement) (tileElement - 1)->SetLastForTile(true); tileElement->BaseHeight = kMaxTileElementHeight; _tileElementsInUse--; - auto& gameState = GetGameState(); - if (tileElement == &gameState.TileElements.back()) + auto& gameState = getGameState(); + if (tileElement == &gameState.tileElements.back()) { - gameState.TileElements.pop_back(); + gameState.tileElements.pop_back(); } } @@ -1169,11 +1169,11 @@ static TileElement* AllocateTileElements(size_t numElementsOnTile, size_t numNew return nullptr; } - auto& gameState = GetGameState(); - auto oldSize = gameState.TileElements.size(); - gameState.TileElements.resize(gameState.TileElements.size() + numElementsOnTile + numNewElements); + auto& gameState = getGameState(); + auto oldSize = gameState.tileElements.size(); + gameState.tileElements.resize(gameState.tileElements.size() + numElementsOnTile + numNewElements); _tileElementsInUse += numNewElements; - return &gameState.TileElements[oldSize]; + return &gameState.tileElements[oldSize]; } /** @@ -1263,7 +1263,7 @@ void MapUpdateTiles() if (isInEditorMode()) return; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Update 43 more tiles (for each 256x256 block) for (int32_t j = 0; j < 43; j++) @@ -1271,7 +1271,7 @@ void MapUpdateTiles() int32_t x = 0; int32_t y = 0; - uint16_t interleaved_xy = gameState.GrassSceneryTileLoopPosition; + uint16_t interleaved_xy = gameState.grassSceneryTileLoopPosition; for (int32_t i = 0; i < 8; i++) { x = (x << 1) | (interleaved_xy & 1); @@ -1281,9 +1281,9 @@ void MapUpdateTiles() } // Repeat for each 256x256 block on the map - for (int32_t blockY = 0; blockY < gameState.MapSize.y; blockY += 256) + for (int32_t blockY = 0; blockY < gameState.mapSize.y; blockY += 256) { - for (int32_t blockX = 0; blockX < gameState.MapSize.x; blockX += 256) + for (int32_t blockX = 0; blockX < gameState.mapSize.x; blockX += 256) { auto mapPos = TileCoordsXY{ blockX + x, blockY + y }.ToCoordsXY(); if (MapIsEdge(mapPos)) @@ -1298,7 +1298,7 @@ void MapUpdateTiles() } } - gameState.GrassSceneryTileLoopPosition++; + gameState.grassSceneryTileLoopPosition++; } } @@ -1315,9 +1315,9 @@ void MapRemoveOutOfRangeElements() // NOTE: This is only a workaround for non-networked games. // Map resize has to become its own Game Action to properly solve this issue. // - auto& gameState = GetGameState(); - bool buildState = gameState.Cheats.buildInPauseMode; - gameState.Cheats.buildInPauseMode = true; + auto& gameState = getGameState(); + bool buildState = gameState.cheats.buildInPauseMode; + gameState.cheats.buildInPauseMode = true; for (int32_t y = kMaximumMapSizeBig - kCoordsXYStep; y >= 0; y -= kCoordsXYStep) { @@ -1338,7 +1338,7 @@ void MapRemoveOutOfRangeElements() } // Reset cheat state - gameState.Cheats.buildInPauseMode = buildState; + gameState.cheats.buildInPauseMode = buildState; } static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile, SurfaceElement& destTile) @@ -1383,7 +1383,7 @@ static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile, */ void MapExtendBoundarySurfaceY() { - auto y = GetGameState().MapSize.y - 2; + auto y = getGameState().mapSize.y - 2; for (auto x = 0; x < kMaximumMapSizeTechnical; x++) { auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y - 1 }); @@ -1403,7 +1403,7 @@ void MapExtendBoundarySurfaceY() */ void MapExtendBoundarySurfaceX() { - auto x = GetGameState().MapSize.x - 2; + auto x = getGameState().mapSize.x - 2; for (auto y = 0; y < kMaximumMapSizeTechnical; y++) { auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y }); @@ -1510,13 +1510,13 @@ void ClearElementAt(const CoordsXY& loc, TileElement** elementPtr) */ static void ClearElementsAt(const CoordsXY& loc) { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Remove the spawn point (if there is one in the current tile) - gameState.PeepSpawns.erase( + gameState.peepSpawns.erase( std::remove_if( - gameState.PeepSpawns.begin(), gameState.PeepSpawns.end(), + gameState.peepSpawns.begin(), gameState.peepSpawns.end(), [loc](const CoordsXY& spawn) { return spawn.ToTileStart() == loc.ToTileStart(); }), - gameState.PeepSpawns.end()); + gameState.peepSpawns.end()); TileElement* tileElement = MapGetFirstElementAt(loc); if (tileElement == nullptr) @@ -2202,7 +2202,7 @@ void ShiftMap(const TileCoordsXY& amount) return; auto amountToMove = amount.ToCoordsXY(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Tile elements auto newElements = std::vector(); @@ -2212,8 +2212,8 @@ void ShiftMap(const TileCoordsXY& amount) { auto srcX = x - amount.x; auto srcY = y - amount.y; - if (x > 0 && y > 0 && x < gameState.MapSize.x - 1 && y < gameState.MapSize.y - 1 && srcX > 0 && srcY > 0 - && srcX < gameState.MapSize.x - 1 && srcY < gameState.MapSize.y - 1) + if (x > 0 && y > 0 && x < gameState.mapSize.x - 1 && y < gameState.mapSize.y - 1 && srcX > 0 && srcY > 0 + && srcX < gameState.mapSize.x - 1 && srcY < gameState.mapSize.y - 1) { auto srcTile = _tileIndex.GetFirstElementAt(TileCoordsXY(srcX, srcY)); do @@ -2221,7 +2221,7 @@ void ShiftMap(const TileCoordsXY& amount) newElements.push_back(*srcTile); } while (!(srcTile++)->IsLastForTile()); } - else if (x == 0 || y == 0 || x == gameState.MapSize.x - 1 || y == gameState.MapSize.y - 1) + else if (x == 0 || y == 0 || x == gameState.mapSize.x - 1 || y == gameState.mapSize.y - 1) { auto surface = GetDefaultSurfaceElement(); surface.SetBaseZ(kMinimumLandZ); @@ -2232,8 +2232,8 @@ void ShiftMap(const TileCoordsXY& amount) } else { - auto copyX = std::clamp(srcX, 1, gameState.MapSize.x - 2); - auto copyY = std::clamp(srcY, 1, gameState.MapSize.y - 2); + auto copyX = std::clamp(srcX, 1, gameState.mapSize.x - 2); + auto copyY = std::clamp(srcY, 1, gameState.mapSize.y - 2); auto srcTile = MapGetSurfaceElementAt(TileCoordsXY(copyX, copyY)); if (srcTile != nullptr) { @@ -2254,10 +2254,10 @@ void ShiftMap(const TileCoordsXY& amount) SetTileElements(gameState, std::move(newElements)); MapRemoveOutOfRangeElements(); - for (auto& spawn : gameState.PeepSpawns) + for (auto& spawn : gameState.peepSpawns) shiftIfNotNull(spawn, amountToMove); - for (auto& entrance : gameState.Park.Entrances) + for (auto& entrance : gameState.park.Entrances) shiftIfNotNull(entrance, amountToMove); // Entities diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 69ca1f362d..323d41c992 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -201,7 +201,7 @@ static bool MapAnimationInvalidateSmallScenery(const CoordsXYZ& loc) if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_CLOCK)) { // Peep, looking at scenery - if (!(GetGameState().CurrentTicks & 0x3FF) && GameIsNotPaused()) + if (!(getGameState().currentTicks & 0x3FF) && GameIsNotPaused()) { int32_t direction = tileElement->GetDirection(); auto quad = EntityTileList(CoordsXY{ loc } - CoordsDirectionDelta[direction]); @@ -489,7 +489,7 @@ static bool MapAnimationInvalidateWallDoor(const CoordsXYZ& loc) TileCoordsXYZ tileLoc{ loc }; TileElement* tileElement; - if (GetGameState().CurrentTicks & 1) + if (getGameState().currentTicks & 1) return false; bool removeAnimation = true; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 5357f81285..3b3664fdb7 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -62,10 +62,10 @@ namespace OpenRCT2::Park */ static PeepSpawn* GetRandomPeepSpawn() { - auto& gameState = GetGameState(); - if (!gameState.PeepSpawns.empty()) + auto& gameState = getGameState(); + if (!gameState.peepSpawns.empty()) { - return &gameState.PeepSpawns[ScenarioRand() % gameState.PeepSpawns.size()]; + return &gameState.peepSpawns[ScenarioRand() % gameState.peepSpawns.size()]; } return nullptr; @@ -85,7 +85,7 @@ namespace OpenRCT2::Park static money64 calculateTotalRideValueForMoney() { money64 totalRideValue = 0; - bool ridePricesUnlocked = RidePricesUnlocked() && !(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY); + bool ridePricesUnlocked = RidePricesUnlocked() && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY); for (auto& ride : GetRideManager()) { if (ride.status != RideStatus::open) @@ -117,7 +117,7 @@ namespace OpenRCT2::Park uint32_t suggestedMaxGuests = 0; uint32_t difficultGenerationBonus = 0; - auto& gameState = GetGameState(); + auto& gameState = getGameState(); for (auto& ride : GetRideManager()) { @@ -132,7 +132,7 @@ namespace OpenRCT2::Park suggestedMaxGuests += ride.getRideTypeDescriptor().BonusValue; // If difficult guest generation, extra guests are available for good rides - if (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) + if (gameState.park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) { if (!(ride.lifecycleFlags & RIDE_LIFECYCLE_TESTED)) continue; @@ -150,7 +150,7 @@ namespace OpenRCT2::Park } } - if (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) + if (gameState.park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) { suggestedMaxGuests = std::min(suggestedMaxGuests, 1000); suggestedMaxGuests += difficultGenerationBonus; @@ -177,18 +177,18 @@ namespace OpenRCT2::Park static uint32_t calculateGuestGenerationProbability() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Begin with 50 + park rating - uint32_t probability = 50 + std::clamp(gameState.Park.Rating - 200, 0, 650); + uint32_t probability = 50 + std::clamp(gameState.park.Rating - 200, 0, 650); // The more guests, the lower the chance of a new one - uint32_t numGuests = gameState.NumGuestsInPark + gameState.NumGuestsHeadingForPark; - if (numGuests > gameState.SuggestedGuestMaximum) + uint32_t numGuests = gameState.numGuestsInPark + gameState.numGuestsHeadingForPark; + if (numGuests > gameState.suggestedGuestMaximum) { probability /= 4; // Even lower for difficult guest generation - if (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) + if (gameState.park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) { probability /= 4; } @@ -202,18 +202,18 @@ namespace OpenRCT2::Park // Penalty for overpriced entrance fee relative to total ride value auto entranceFee = GetEntranceFee(); - if (entranceFee > gameState.TotalRideValueForMoney) + if (entranceFee > gameState.totalRideValueForMoney) { probability /= 4; // Extra penalty for very overpriced entrance fee - if (entranceFee / 2 > gameState.TotalRideValueForMoney) + if (entranceFee / 2 > gameState.totalRideValueForMoney) { probability /= 4; } } // Reward or penalties for park awards - for (const auto& award : GetGameState().CurrentAwards) + for (const auto& award : getGameState().currentAwards) { // +/- 0.25% of the probability if (AwardIsPositive(award.Type)) @@ -232,17 +232,17 @@ namespace OpenRCT2::Park static void generateGuests(GameState_t& gameState) { // Generate a new guest for some probability - if (static_cast(ScenarioRand() & 0xFFFF) < gameState.GuestGenerationProbability) + if (static_cast(ScenarioRand() & 0xFFFF) < gameState.guestGenerationProbability) { - bool difficultGeneration = (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0; - if (!difficultGeneration || gameState.SuggestedGuestMaximum + 150 >= gameState.NumGuestsInPark) + bool difficultGeneration = (gameState.park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0; + if (!difficultGeneration || gameState.suggestedGuestMaximum + 150 >= gameState.numGuestsInPark) { GenerateGuest(); } } // Extra guests generated by advertising campaigns - for (const auto& campaign : gameState.MarketingCampaigns) + for (const auto& campaign : gameState.marketingCampaigns) { // Random chance of guest generation auto probability = MarketingGetCampaignGuestGenerationProbability(campaign.Type); @@ -276,21 +276,21 @@ namespace OpenRCT2::Park void Initialise(GameState_t& gameState) { - gameState.Park.Name = LanguageGetString(STR_UNNAMED_PARK); - gameState.PluginStorage = {}; - gameState.StaffHandymanColour = COLOUR_BRIGHT_RED; - gameState.StaffMechanicColour = COLOUR_LIGHT_BLUE; - gameState.StaffSecurityColour = COLOUR_YELLOW; - gameState.NumGuestsInPark = 0; - gameState.NumGuestsInParkLastWeek = 0; - gameState.NumGuestsHeadingForPark = 0; - gameState.GuestChangeModifier = 0; - gameState.Park.Rating = 0; - gameState.GuestGenerationProbability = 0; - gameState.TotalRideValueForMoney = 0; - gameState.SuggestedGuestMaximum = 0; - gameState.ResearchLastItem = std::nullopt; - gameState.MarketingCampaigns.clear(); + gameState.park.Name = LanguageGetString(STR_UNNAMED_PARK); + gameState.pluginStorage = {}; + gameState.staffHandymanColour = COLOUR_BRIGHT_RED; + gameState.staffMechanicColour = COLOUR_LIGHT_BLUE; + gameState.staffSecurityColour = COLOUR_YELLOW; + gameState.numGuestsInPark = 0; + gameState.numGuestsInParkLastWeek = 0; + gameState.numGuestsHeadingForPark = 0; + gameState.guestChangeModifier = 0; + gameState.park.Rating = 0; + gameState.guestGenerationProbability = 0; + gameState.totalRideValueForMoney = 0; + gameState.suggestedGuestMaximum = 0; + gameState.researchLastItem = std::nullopt; + gameState.marketingCampaigns.clear(); ResearchResetItems(gameState); FinanceInit(); @@ -299,32 +299,32 @@ namespace OpenRCT2::Park SetAllSceneryItemsInvented(); - gameState.Park.EntranceFee = 10.00_GBP; + gameState.park.EntranceFee = 10.00_GBP; - gameState.PeepSpawns.clear(); + gameState.peepSpawns.clear(); ParkEntranceReset(); - gameState.ResearchPriorities = EnumsToFlags( + gameState.researchPriorities = EnumsToFlags( ResearchCategory::Transport, ResearchCategory::Gentle, ResearchCategory::Rollercoaster, ResearchCategory::Thrill, ResearchCategory::Water, ResearchCategory::Shop, ResearchCategory::SceneryGroup); - gameState.ResearchFundingLevel = RESEARCH_FUNDING_NORMAL; + gameState.researchFundingLevel = RESEARCH_FUNDING_NORMAL; - gameState.GuestInitialCash = 50.00_GBP; - gameState.GuestInitialHappiness = Park::CalculateGuestInitialHappiness(50); - gameState.GuestInitialHunger = 200; - gameState.GuestInitialThirst = 200; - gameState.ScenarioObjective.Type = OBJECTIVE_GUESTS_BY; - gameState.ScenarioObjective.Year = 4; - gameState.ScenarioObjective.NumGuests = 1000; - gameState.LandPrice = 90.00_GBP; - gameState.ConstructionRightsPrice = 40.00_GBP; - gameState.Park.Flags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + gameState.guestInitialCash = 50.00_GBP; + gameState.guestInitialHappiness = Park::CalculateGuestInitialHappiness(50); + gameState.guestInitialHunger = 200; + gameState.guestInitialThirst = 200; + gameState.scenarioObjective.Type = OBJECTIVE_GUESTS_BY; + gameState.scenarioObjective.Year = 4; + gameState.scenarioObjective.NumGuests = 1000; + gameState.landPrice = 90.00_GBP; + gameState.constructionRightsPrice = 40.00_GBP; + gameState.park.Flags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES; ResetHistories(gameState); FinanceResetHistory(); AwardReset(); - gameState.ScenarioName.clear(); - gameState.ScenarioDetails = String::toStd(LanguageGetString(STR_NO_DETAILS_YET)); + gameState.scenarioName.clear(); + gameState.scenarioDetails = String::toStd(LanguageGetString(STR_NO_DETAILS_YET)); } void Update(GameState_t& gameState, const Date& date) @@ -337,18 +337,18 @@ namespace OpenRCT2::Park UpdateHistories(gameState); } - const auto currentTicks = gameState.CurrentTicks; + const auto currentTicks = gameState.currentTicks; auto* windowMgr = Ui::GetWindowManager(); // Every ~13 seconds if (currentTicks % 512 == 0) { - gameState.Park.Rating = CalculateParkRating(); - gameState.Park.Value = Park::CalculateParkValue(); - gameState.CompanyValue = CalculateCompanyValue(); - gameState.TotalRideValueForMoney = calculateTotalRideValueForMoney(); - gameState.SuggestedGuestMaximum = calculateSuggestedMaxGuests(); - gameState.GuestGenerationProbability = calculateGuestGenerationProbability(); + gameState.park.Rating = CalculateParkRating(); + gameState.park.Value = Park::CalculateParkValue(); + gameState.companyValue = CalculateCompanyValue(); + gameState.totalRideValueForMoney = calculateTotalRideValueForMoney(); + gameState.suggestedGuestMaximum = calculateSuggestedMaxGuests(); + gameState.guestGenerationProbability = calculateGuestGenerationProbability(); windowMgr->InvalidateByClass(WindowClass::Finances); auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING); @@ -358,7 +358,7 @@ namespace OpenRCT2::Park // Every ~102 seconds if (currentTicks % 4096 == 0) { - gameState.Park.Size = CalculateParkSize(); + gameState.park.Size = CalculateParkSize(); windowMgr->InvalidateByClass(WindowClass::ParkInformation); } @@ -381,10 +381,10 @@ namespace OpenRCT2::Park } } while (TileElementIteratorNext(&it)); - auto& gameState = GetGameState(); - if (tiles != gameState.Park.Size) + auto& gameState = getGameState(); + if (tiles != gameState.park.Size) { - gameState.Park.Size = tiles; + gameState.park.Size = tiles; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ParkInformation); } @@ -394,15 +394,15 @@ namespace OpenRCT2::Park int32_t CalculateParkRating() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); - if (gameState.Cheats.forcedParkRating != kForcedParkRatingDisabled) + if (gameState.cheats.forcedParkRating != kForcedParkRatingDisabled) { - return gameState.Cheats.forcedParkRating; + return gameState.cheats.forcedParkRating; } int32_t result = 1150; - if (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING) + if (gameState.park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING) { result = 1050; } @@ -410,7 +410,7 @@ namespace OpenRCT2::Park // Guests { // -150 to +3 based on a range of guests from 0 to 2000 - result -= 150 - (std::min(2000, gameState.NumGuestsInPark) / 13); + result -= 150 - (std::min(2000, gameState.numGuestsInPark) / 13); // Find the number of happy peeps and the number of peeps who can't find the park exit uint32_t happyGuestCount = 0; @@ -432,9 +432,9 @@ namespace OpenRCT2::Park // Peep happiness -500 to +0 result -= 500; - if (gameState.NumGuestsInPark > 0) + if (gameState.numGuestsInPark > 0) { - result += 2 * std::min(250u, (happyGuestCount * 300) / gameState.NumGuestsInPark); + result += 2 * std::min(250u, (happyGuestCount * 300) / gameState.numGuestsInPark); } // Up to 25 guests can be lost without affecting the park rating. @@ -505,7 +505,7 @@ namespace OpenRCT2::Park result -= 600 - (4 * (150 - std::min(150, litterCount))); } - result -= gameState.Park.RatingCasualtyPenalty; + result -= gameState.park.RatingCasualtyPenalty; result = std::clamp(result, 0, 999); return result; } @@ -520,16 +520,16 @@ namespace OpenRCT2::Park } // +7.00 per guest - result += static_cast(GetGameState().NumGuestsInPark) * 7.00_GBP; + result += static_cast(getGameState().numGuestsInPark) * 7.00_GBP; return result; } money64 CalculateCompanyValue() { - const auto& gameState = GetGameState(); + const auto& gameState = getGameState(); - auto result = gameState.Park.Value - gameState.BankLoan; + auto result = gameState.park.Value - gameState.bankLoan; // Clamp addition to prevent overflow result = AddClamp(result, FinanceGetCurrentCash()); @@ -584,16 +584,16 @@ namespace OpenRCT2::Park void ResetHistories(GameState_t& gameState) { std::fill( - std::begin(gameState.Park.RatingHistory), std::end(gameState.Park.RatingHistory), kParkRatingHistoryUndefined); + std::begin(gameState.park.RatingHistory), std::end(gameState.park.RatingHistory), kParkRatingHistoryUndefined); std::fill( - std::begin(gameState.GuestsInParkHistory), std::end(gameState.GuestsInParkHistory), kGuestsInParkHistoryUndefined); + std::begin(gameState.guestsInParkHistory), std::end(gameState.guestsInParkHistory), kGuestsInParkHistoryUndefined); } void UpdateHistories(GameState_t& gameState) { uint8_t guestChangeModifier = 1; - int32_t changeInGuestsInPark = static_cast(gameState.NumGuestsInPark) - - static_cast(gameState.NumGuestsInParkLastWeek); + int32_t changeInGuestsInPark = static_cast(gameState.numGuestsInPark) + - static_cast(gameState.numGuestsInParkLastWeek); if (changeInGuestsInPark > -20) { guestChangeModifier++; @@ -602,32 +602,32 @@ namespace OpenRCT2::Park guestChangeModifier = 0; } } - gameState.GuestChangeModifier = guestChangeModifier; - gameState.NumGuestsInParkLastWeek = gameState.NumGuestsInPark; + gameState.guestChangeModifier = guestChangeModifier; + gameState.numGuestsInParkLastWeek = gameState.numGuestsInPark; // Update park rating, guests in park and current cash history constexpr auto ratingHistorySize = std::extent_v; - HistoryPushRecord(gameState.Park.RatingHistory, gameState.Park.Rating); - constexpr auto numGuestsHistorySize = std::extent_v; - HistoryPushRecord(gameState.GuestsInParkHistory, gameState.NumGuestsInPark); + HistoryPushRecord(gameState.park.RatingHistory, gameState.park.Rating); + constexpr auto numGuestsHistorySize = std::extent_v; + HistoryPushRecord(gameState.guestsInParkHistory, gameState.numGuestsInPark); - constexpr auto cashHistorySize = std::extent_v; - HistoryPushRecord(gameState.CashHistory, FinanceGetCurrentCash() - gameState.BankLoan); + constexpr auto cashHistorySize = std::extent_v; + HistoryPushRecord(gameState.cashHistory, FinanceGetCurrentCash() - gameState.bankLoan); // Update weekly profit history - auto currentWeeklyProfit = gameState.WeeklyProfitAverageDividend; - if (gameState.WeeklyProfitAverageDivisor != 0) + auto currentWeeklyProfit = gameState.weeklyProfitAverageDividend; + if (gameState.weeklyProfitAverageDivisor != 0) { - currentWeeklyProfit /= gameState.WeeklyProfitAverageDivisor; + currentWeeklyProfit /= gameState.weeklyProfitAverageDivisor; } - constexpr auto profitHistorySize = std::extent_v; - HistoryPushRecord(gameState.WeeklyProfitHistory, currentWeeklyProfit); - gameState.WeeklyProfitAverageDividend = 0; - gameState.WeeklyProfitAverageDivisor = 0; + constexpr auto profitHistorySize = std::extent_v; + HistoryPushRecord(gameState.weeklyProfitHistory, currentWeeklyProfit); + gameState.weeklyProfitAverageDividend = 0; + gameState.weeklyProfitAverageDivisor = 0; // Update park value history - constexpr auto parkValueHistorySize = std::extent_v; - HistoryPushRecord(gameState.Park.ValueHistory, gameState.Park.Value); + constexpr auto parkValueHistorySize = std::extent_v; + HistoryPushRecord(gameState.park.ValueHistory, gameState.park.Value); // Invalidate relevant windows auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); @@ -641,9 +641,9 @@ namespace OpenRCT2::Park uint32_t UpdateSize(GameState_t& gameState) { auto tiles = CalculateParkSize(); - if (tiles != gameState.Park.Size) + if (tiles != gameState.park.Size) { - gameState.Park.Size = tiles; + gameState.park.Size = tiles; auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ParkInformation); @@ -738,9 +738,9 @@ namespace OpenRCT2::Park void SetForcedRating(int32_t rating) { - auto& gameState = GetGameState(); - gameState.Cheats.forcedParkRating = rating; - gameState.Park.Rating = CalculateParkRating(); + auto& gameState = getGameState(); + gameState.cheats.forcedParkRating = rating; + gameState.park.Rating = CalculateParkRating(); auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING); ContextBroadcastIntent(&intent); @@ -748,13 +748,13 @@ namespace OpenRCT2::Park int32_t GetForcedRating() { - return GetGameState().Cheats.forcedParkRating; + return getGameState().cheats.forcedParkRating; } money64 GetEntranceFee() { - const auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_NO_MONEY) + const auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_NO_MONEY) { return 0; } @@ -762,17 +762,17 @@ namespace OpenRCT2::Park { return 0; } - return gameState.Park.EntranceFee; + return gameState.park.EntranceFee; } bool RidePricesUnlocked() { - const auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) + const auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) { return true; } - if (gameState.Park.Flags & PARK_FLAGS_PARK_FREE_ENTRY) + if (gameState.park.Flags & PARK_FLAGS_PARK_FREE_ENTRY) { return true; } @@ -781,12 +781,12 @@ namespace OpenRCT2::Park bool EntranceFeeUnlocked() { - const auto& gameState = GetGameState(); - if (gameState.Park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) + const auto& gameState = getGameState(); + if (gameState.park.Flags & PARK_FLAGS_UNLOCK_ALL_PRICES) { return true; } - if (!(gameState.Park.Flags & PARK_FLAGS_PARK_FREE_ENTRY)) + if (!(gameState.park.Flags & PARK_FLAGS_PARK_FREE_ENTRY)) { return true; } diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 5b67c7ea7f..456ed9ece4 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -176,13 +176,13 @@ void SmallSceneryElement::UpdateAge(const CoordsXY& sceneryPos) return; } - auto& gameState = GetGameState(); - if (gameState.Cheats.disablePlantAging && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_BE_WATERED)) + auto& gameState = getGameState(); + if (gameState.cheats.disablePlantAging && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_BE_WATERED)) { return; } - if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_BE_WATERED) || WeatherIsDry(gameState.WeatherCurrent.weatherType) + if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_BE_WATERED) || WeatherIsDry(gameState.weatherCurrent.weatherType) || GetAge() < 5) { IncreaseAge(sceneryPos); @@ -307,8 +307,8 @@ bool IsSceneryAvailableToBuild(const ScenerySelection& item) return true; } - auto& gameState = GetGameState(); - if (!gameState.Cheats.ignoreResearchStatus) + auto& gameState = getGameState(); + if (!gameState.cheats.ignoreResearchStatus) { if (!SceneryIsInvented(item)) { @@ -316,7 +316,7 @@ bool IsSceneryAvailableToBuild(const ScenerySelection& item) } } - if (!gameState.Cheats.sandboxMode && !isInEditorMode()) + if (!gameState.cheats.sandboxMode && !isInEditorMode()) { if (IsSceneryItemRestricted(item)) { @@ -367,38 +367,38 @@ static bool IsSceneryEntryValid(const ScenerySelection& item) bool IsSceneryItemRestricted(const ScenerySelection& item) { - auto& gameState = GetGameState(); - return std::find(std::begin(gameState.RestrictedScenery), std::end(gameState.RestrictedScenery), item) - != std::end(gameState.RestrictedScenery); + auto& gameState = getGameState(); + return std::find(std::begin(gameState.restrictedScenery), std::end(gameState.restrictedScenery), item) + != std::end(gameState.restrictedScenery); } void ClearRestrictedScenery() { - GetGameState().RestrictedScenery.clear(); + getGameState().restrictedScenery.clear(); } std::vector& GetRestrictedScenery() { - return GetGameState().RestrictedScenery; + return getGameState().restrictedScenery; } void SetSceneryItemRestricted(const ScenerySelection& item, bool on) { - auto& gameState = GetGameState(); - auto existingItem = std::find(std::begin(gameState.RestrictedScenery), std::end(gameState.RestrictedScenery), item); - const bool existingItemIsPresent = existingItem != std::end(gameState.RestrictedScenery); + auto& gameState = getGameState(); + auto existingItem = std::find(std::begin(gameState.restrictedScenery), std::end(gameState.restrictedScenery), item); + const bool existingItemIsPresent = existingItem != std::end(gameState.restrictedScenery); if (on) { if (!existingItemIsPresent) { - gameState.RestrictedScenery.push_back(item); + gameState.restrictedScenery.push_back(item); } } else { if (existingItemIsPresent) { - gameState.RestrictedScenery.erase(existingItem); + gameState.restrictedScenery.erase(existingItem); } } } @@ -522,14 +522,14 @@ static MiscScenery GetAllMiscScenery() void RestrictAllMiscScenery() { - auto& gameState = GetGameState(); + auto& gameState = getGameState(); auto miscScenery = GetAllMiscScenery().miscScenery; - gameState.RestrictedScenery.insert(gameState.RestrictedScenery.begin(), miscScenery.begin(), miscScenery.end()); + gameState.restrictedScenery.insert(gameState.restrictedScenery.begin(), miscScenery.begin(), miscScenery.end()); } static void MarkAllUnrestrictedSceneryInVectorInvented(const std::vector& vector) { - auto& restrictedScenery = GetGameState().RestrictedScenery; + auto& restrictedScenery = getGameState().restrictedScenery; for (const auto& sceneryItem : vector) { diff --git a/src/openrct2/world/map_generator/MapGen.cpp b/src/openrct2/world/map_generator/MapGen.cpp index 75dfcdd039..e2ec3e227a 100644 --- a/src/openrct2/world/map_generator/MapGen.cpp +++ b/src/openrct2/world/map_generator/MapGen.cpp @@ -111,10 +111,10 @@ namespace OpenRCT2::World::MapGenerator */ void setWaterLevel(int32_t waterLevel) { - auto& gameState = GetGameState(); - for (int32_t y = 1; y < gameState.MapSize.y - 1; y++) + auto& gameState = getGameState(); + for (int32_t y = 1; y < gameState.mapSize.y - 1; y++) { - for (int32_t x = 1; x < gameState.MapSize.x - 1; x++) + for (int32_t x = 1; x < gameState.mapSize.x - 1; x++) { auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }); if (surfaceElement != nullptr && surfaceElement->BaseHeight < waterLevel) diff --git a/src/openrct2/world/map_generator/TreePlacement.cpp b/src/openrct2/world/map_generator/TreePlacement.cpp index 47f5ec1632..b87417c07c 100644 --- a/src/openrct2/world/map_generator/TreePlacement.cpp +++ b/src/openrct2/world/map_generator/TreePlacement.cpp @@ -150,10 +150,10 @@ namespace OpenRCT2::World::MapGenerator // Randomise simplex noise NoiseRand(); - auto& gameState = GetGameState(); - for (int32_t y = 1; y < gameState.MapSize.y - 1; y++) + auto& gameState = getGameState(); + for (int32_t y = 1; y < gameState.mapSize.y - 1; y++) { - for (int32_t x = 1; x < gameState.MapSize.x - 1; x++) + for (int32_t x = 1; x < gameState.mapSize.x - 1; x++) { auto pos = CoordsXY{ x, y } * kCoordsXYStep; auto* surfaceElement = MapGetSurfaceElementAt(pos); @@ -185,9 +185,9 @@ namespace OpenRCT2::World::MapGenerator const auto offset = CoordsXY{ offsetX * kCoordsXYStep, offsetY * kCoordsXYStep }; auto neighbourPos = pos + offset; neighbourPos.x = std::clamp( - neighbourPos.x, kCoordsXYStep, kCoordsXYStep * (gameState.MapSize.x - 1)); + neighbourPos.x, kCoordsXYStep, kCoordsXYStep * (gameState.mapSize.x - 1)); neighbourPos.y = std::clamp( - neighbourPos.y, kCoordsXYStep, kCoordsXYStep * (gameState.MapSize.y - 1)); + neighbourPos.y, kCoordsXYStep, kCoordsXYStep * (gameState.mapSize.y - 1)); const auto neighboutSurface = MapGetSurfaceElementAt(neighbourPos); if (neighboutSurface != nullptr && neighboutSurface->GetWaterHeight() > 0) diff --git a/src/openrct2/world/tile_element/TrackElement.cpp b/src/openrct2/world/tile_element/TrackElement.cpp index 30dc26314e..1bb21b422f 100644 --- a/src/openrct2/world/tile_element/TrackElement.cpp +++ b/src/openrct2/world/tile_element/TrackElement.cpp @@ -252,7 +252,7 @@ void TrackElement::SetBrakeClosed(bool isClosed) bool TrackElement::IsIndestructible() const { - return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0 && !GetGameState().Cheats.makeAllDestructible; + return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0 && !getGameState().cheats.makeAllDestructible; } void TrackElement::SetIsIndestructible(bool isIndestructible) diff --git a/test/tests/MultiLaunch.cpp b/test/tests/MultiLaunch.cpp index ae73b07c31..3df8473a0d 100644 --- a/test/tests/MultiLaunch.cpp +++ b/test/tests/MultiLaunch.cpp @@ -46,7 +46,7 @@ TEST(MultiLaunchTest, all) // Check ride count to check load was successful ASSERT_EQ(RideGetCount(), 134); - auto& date = GetGameState().Date; + auto& date = getGameState().date; // NOTE: This value is saved in the SV6 file, after the import this will be the current state. // In case the save file gets replaced this needs to be adjusted. ASSERT_EQ(date.GetMonthTicks(), 0x1e98); diff --git a/test/tests/PlayTests.cpp b/test/tests/PlayTests.cpp index f0509d0a80..66f9fa1547 100644 --- a/test/tests/PlayTests.cpp +++ b/test/tests/PlayTests.cpp @@ -52,7 +52,7 @@ static std::unique_ptr localStartGame(const std::string& parkPath) context->GetObjectManager().LoadObjects(loadResult.RequiredObjects); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); importer->Import(gameState); ResetEntitySpatialIndices(); @@ -98,12 +98,12 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds) auto context = localStartGame(initStateFile); ASSERT_NE(context.get(), nullptr); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Open park for free but charging for rides execute(ParkParameter::Open); execute(0); - gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; // Find ferris wheel auto rideManager = GetRideManager(); @@ -117,7 +117,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds) execute(ferrisWheel.id, 0, true); // Ignore intensity to stimulate peeps to queue into ferris wheel - gameState.Cheats.ignoreRideIntensity = true; + gameState.cheats.ignoreRideIntensity = true; // Insert a rich guest auto richGuest = Park::GenerateGuest(); @@ -158,12 +158,12 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests) auto context = localStartGame(initStateFile); ASSERT_NE(context.get(), nullptr); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); // Open park for free but charging for rides execute(ParkParameter::Open); execute(0); - gameState.Park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; + gameState.park.Flags |= PARK_FLAGS_UNLOCK_ALL_PRICES; // Find car ride auto rideManager = GetRideManager(); @@ -176,7 +176,7 @@ TEST_F(PlayTests, CarRideWithOneCarOnlyAcceptsTwoGuests) execute(carRide.id, 0, true); // Ignore intensity to stimulate peeps to queue into the ride - gameState.Cheats.ignoreRideIntensity = true; + gameState.cheats.ignoreRideIntensity = true; // Create some guests std::vector guests; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index a7901aef60..8a89d20c15 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -84,7 +84,7 @@ static bool ImportS6(MemoryStream& stream, std::unique_ptr& context, b objManager.LoadObjects(loadResult.RequiredObjects); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); importer->Import(gameState); GameInit(retainSpatialIndices); @@ -103,7 +103,7 @@ static bool ImportPark(MemoryStream& stream, std::unique_ptr& context, objManager.LoadObjects(loadResult.RequiredObjects); // TODO: Have a separate GameState and exchange once loaded. - auto& gameState = GetGameState(); + auto& gameState = getGameState(); importer->Import(gameState); GameInit(retainSpatialIndices); @@ -118,7 +118,7 @@ static bool ExportSave(MemoryStream& stream, std::unique_ptr& context) auto exporter = std::make_unique(); exporter->ExportObjectsList = objManager.GetPackableObjects(); - auto& gameState = GetGameState(); + auto& gameState = getGameState(); exporter->Export(gameState, stream); return true; @@ -130,7 +130,7 @@ static void RecordGameStateSnapshot(std::unique_ptr& context, MemorySt auto& snapshot = snapshots->CreateSnapshot(); snapshots->Capture(snapshot); - snapshots->LinkSnapshot(snapshot, GetGameState().CurrentTicks, ScenarioRandState().s0); + snapshots->LinkSnapshot(snapshot, getGameState().currentTicks, ScenarioRandState().s0); DataSerialiser snapShotDs(true, snapshotStream); snapshots->SerialiseSnapshot(snapshot, snapShotDs); }