From 773ba479cd7397b7fd513dfb3061c7b98b6a2e5d Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Mon, 9 Feb 2026 15:07:42 +0100 Subject: [PATCH] Create separate unit for GameActionRunner --- src/openrct2-ui/input/Shortcuts.cpp | 1 + .../interface/ViewportInteraction.cpp | 1 + src/openrct2-ui/ride/Construction.cpp | 1 + src/openrct2-ui/windows/Banner.cpp | 1 + src/openrct2-ui/windows/Cheats.cpp | 1 + src/openrct2-ui/windows/ClearScenery.cpp | 1 + .../windows/DemolishRidePrompt.cpp | 1 + .../windows/EditorParkEntrance.cpp | 1 + .../windows/EditorScenarioOptions.cpp | 1 + src/openrct2-ui/windows/Finances.cpp | 1 + src/openrct2-ui/windows/Footpath.cpp | 1 + src/openrct2-ui/windows/Guest.cpp | 1 + src/openrct2-ui/windows/Land.cpp | 1 + src/openrct2-ui/windows/LandRights.cpp | 1 + src/openrct2-ui/windows/Map.cpp | 1 + src/openrct2-ui/windows/MazeConstruction.cpp | 1 + src/openrct2-ui/windows/Multiplayer.cpp | 1 + src/openrct2-ui/windows/NewCampaign.cpp | 1 + src/openrct2-ui/windows/Options.cpp | 1 + src/openrct2-ui/windows/Park.cpp | 1 + src/openrct2-ui/windows/PatrolArea.cpp | 1 + src/openrct2-ui/windows/Player.cpp | 1 + .../windows/RefurbishRidePrompt.cpp | 1 + src/openrct2-ui/windows/Research.cpp | 1 + src/openrct2-ui/windows/Ride.cpp | 2 +- src/openrct2-ui/windows/RideConstruction.cpp | 1 + src/openrct2-ui/windows/RideList.cpp | 1 + src/openrct2-ui/windows/Scenery.cpp | 1 + src/openrct2-ui/windows/Sign.cpp | 1 + src/openrct2-ui/windows/Staff.cpp | 1 + src/openrct2-ui/windows/StaffFirePrompt.cpp | 1 + src/openrct2-ui/windows/StaffList.cpp | 1 + src/openrct2-ui/windows/TileInspector.cpp | 1 + src/openrct2-ui/windows/TitleMenu.cpp | 1 + src/openrct2-ui/windows/TopToolbar.cpp | 1 + src/openrct2-ui/windows/TrackDesignPlace.cpp | 1 + src/openrct2-ui/windows/Water.cpp | 1 + src/openrct2/Cheats.cpp | 1 + src/openrct2/Context.cpp | 2 +- src/openrct2/Editor.cpp | 1 + src/openrct2/Game.cpp | 1 + src/openrct2/GameState.cpp | 2 +- src/openrct2/ReplayManager.cpp | 2 +- src/openrct2/actions/BalloonPressAction.cpp | 2 +- src/openrct2/actions/BalloonPressAction.h | 2 +- src/openrct2/actions/BannerPlaceAction.cpp | 2 +- src/openrct2/actions/BannerPlaceAction.h | 2 +- src/openrct2/actions/BannerRemoveAction.cpp | 2 +- src/openrct2/actions/BannerRemoveAction.h | 2 +- .../actions/BannerSetColourAction.cpp | 2 +- src/openrct2/actions/BannerSetColourAction.h | 2 +- src/openrct2/actions/BannerSetNameAction.cpp | 2 +- src/openrct2/actions/BannerSetNameAction.h | 2 +- src/openrct2/actions/BannerSetStyleAction.cpp | 2 +- src/openrct2/actions/BannerSetStyleAction.h | 2 +- src/openrct2/actions/CheatSetAction.cpp | 1 + src/openrct2/actions/CheatSetAction.h | 2 +- src/openrct2/actions/ClearAction.cpp | 1 + src/openrct2/actions/ClearAction.h | 2 +- src/openrct2/actions/CustomAction.h | 2 +- .../actions/FootpathAdditionPlaceAction.h | 2 +- .../actions/FootpathAdditionRemoveAction.h | 2 +- .../actions/FootpathLayoutPlaceAction.h | 2 +- src/openrct2/actions/FootpathPlaceAction.h | 2 +- src/openrct2/actions/FootpathRemoveAction.cpp | 1 + src/openrct2/actions/FootpathRemoveAction.h | 2 +- src/openrct2/actions/GameAction.cpp | 488 ++---------------- .../actions/{GameAction.h => GameAction.hpp} | 102 +--- .../actions/GameActionParameterVisitor.h | 102 ++++ src/openrct2/actions/GameActionRegistry.cpp | 30 +- src/openrct2/actions/GameActionRegistry.h | 27 + src/openrct2/actions/GameActionRunner.cpp | 455 ++++++++++++++++ src/openrct2/actions/GameActionRunner.h | 42 ++ src/openrct2/actions/GameSetSpeedAction.h | 2 +- src/openrct2/actions/GuestSetFlagsAction.h | 2 +- src/openrct2/actions/GuestSetNameAction.h | 2 +- src/openrct2/actions/LandBuyRightsAction.h | 2 +- src/openrct2/actions/LandLowerAction.cpp | 1 + src/openrct2/actions/LandLowerAction.h | 2 +- src/openrct2/actions/LandRaiseAction.cpp | 1 + src/openrct2/actions/LandRaiseAction.h | 2 +- src/openrct2/actions/LandSetHeightAction.h | 2 +- src/openrct2/actions/LandSetRightsAction.h | 2 +- src/openrct2/actions/LandSmoothAction.cpp | 1 + src/openrct2/actions/LandSmoothAction.h | 2 +- .../actions/LargeSceneryPlaceAction.h | 2 +- .../actions/LargeSceneryRemoveAction.h | 2 +- .../actions/LargeScenerySetColourAction.h | 2 +- src/openrct2/actions/LoadOrQuitAction.h | 2 +- src/openrct2/actions/MapChangeSizeAction.h | 2 +- src/openrct2/actions/MazePlaceTrackAction.h | 2 +- src/openrct2/actions/MazeSetTrackAction.h | 2 +- .../actions/NetworkModifyGroupAction.h | 2 +- .../actions/ParkEntrancePlaceAction.h | 2 +- .../actions/ParkEntranceRemoveAction.h | 2 +- src/openrct2/actions/ParkMarketingAction.h | 2 +- src/openrct2/actions/ParkSetDateAction.h | 2 +- .../actions/ParkSetEntranceFeeAction.h | 2 +- src/openrct2/actions/ParkSetLoanAction.h | 2 +- src/openrct2/actions/ParkSetNameAction.h | 2 +- src/openrct2/actions/ParkSetParameterAction.h | 2 +- .../actions/ParkSetResearchFundingAction.h | 2 +- src/openrct2/actions/PauseToggleAction.h | 2 +- src/openrct2/actions/PeepPickupAction.cpp | 1 + src/openrct2/actions/PeepPickupAction.h | 2 +- src/openrct2/actions/PeepSpawnPlaceAction.h | 2 +- src/openrct2/actions/PlayerKickAction.h | 2 +- src/openrct2/actions/PlayerSetGroupAction.h | 2 +- src/openrct2/actions/RideCreateAction.h | 2 +- src/openrct2/actions/RideDemolishAction.cpp | 1 + src/openrct2/actions/RideDemolishAction.h | 2 +- .../actions/RideEntranceExitPlaceAction.cpp | 3 +- .../actions/RideEntranceExitPlaceAction.h | 2 +- .../actions/RideEntranceExitRemoveAction.h | 2 +- src/openrct2/actions/RideFreezeRatingAction.h | 2 +- .../actions/RideSetAppearanceAction.h | 2 +- .../actions/RideSetColourSchemeAction.h | 2 +- src/openrct2/actions/RideSetNameAction.h | 2 +- src/openrct2/actions/RideSetPriceAction.h | 2 +- src/openrct2/actions/RideSetSettingAction.h | 2 +- src/openrct2/actions/RideSetStatusAction.h | 2 +- src/openrct2/actions/RideSetVehicleAction.h | 2 +- .../actions/RideSetVisibilityAction.cpp | 2 +- .../actions/RideSetVisibilityAction.h | 2 +- .../actions/ScenarioSetSettingAction.h | 2 +- .../actions/ScenerySetRestrictedAction.h | 2 +- src/openrct2/actions/SignSetNameAction.h | 2 +- src/openrct2/actions/SignSetStyleAction.h | 2 +- .../actions/SmallSceneryPlaceAction.cpp | 2 +- .../actions/SmallSceneryPlaceAction.h | 2 +- .../actions/SmallSceneryRemoveAction.cpp | 2 +- .../actions/SmallSceneryRemoveAction.h | 2 +- .../actions/SmallScenerySetColourAction.h | 2 +- src/openrct2/actions/StaffFireAction.h | 2 +- src/openrct2/actions/StaffHireNewAction.h | 2 +- src/openrct2/actions/StaffSetColourAction.h | 2 +- src/openrct2/actions/StaffSetCostumeAction.h | 2 +- src/openrct2/actions/StaffSetNameAction.h | 2 +- src/openrct2/actions/StaffSetOrdersAction.h | 2 +- .../actions/StaffSetPatrolAreaAction.h | 2 +- src/openrct2/actions/SurfaceSetStyleAction.h | 2 +- src/openrct2/actions/TileModifyAction.h | 2 +- src/openrct2/actions/TrackDesignAction.cpp | 1 + src/openrct2/actions/TrackDesignAction.h | 2 +- src/openrct2/actions/TrackPlaceAction.cpp | 1 + src/openrct2/actions/TrackPlaceAction.h | 2 +- src/openrct2/actions/TrackRemoveAction.cpp | 1 + src/openrct2/actions/TrackRemoveAction.h | 2 +- .../actions/TrackSetBrakeSpeedAction.h | 2 +- src/openrct2/actions/WallPlaceAction.h | 2 +- src/openrct2/actions/WallRemoveAction.h | 2 +- src/openrct2/actions/WallSetColourAction.h | 2 +- src/openrct2/actions/WaterLowerAction.cpp | 1 + src/openrct2/actions/WaterLowerAction.h | 2 +- src/openrct2/actions/WaterRaiseAction.cpp | 1 + src/openrct2/actions/WaterRaiseAction.h | 2 +- src/openrct2/actions/WaterSetHeightAction.h | 2 +- src/openrct2/entity/Peep.cpp | 2 +- src/openrct2/interface/InteractiveConsole.cpp | 1 + src/openrct2/libopenrct2.vcxproj | 6 +- src/openrct2/management/Research.cpp | 1 + src/openrct2/network/NetworkBase.cpp | 3 +- src/openrct2/network/NetworkBase.h | 2 +- src/openrct2/ride/Ride.cpp | 1 + src/openrct2/ride/RideConstruction.cpp | 1 + src/openrct2/ride/TrackDesign.cpp | 1 + src/openrct2/ride/Vehicle.Crash.cpp | 1 + src/openrct2/scripting/ScriptEngine.cpp | 2 +- .../scripting/bindings/game/ScContext.hpp | 2 +- .../scripting/bindings/network/ScNetwork.cpp | 1 + .../scripting/bindings/network/ScPlayer.cpp | 1 + .../bindings/network/ScPlayerGroup.cpp | 1 + src/openrct2/world/Entrance.cpp | 1 + src/openrct2/world/Footpath.cpp | 1 + src/openrct2/world/Map.cpp | 1 + src/openrct2/world/Park.cpp | 1 + src/openrct2/world/Scenery.cpp | 1 + src/openrct2/world/TileInspector.cpp | 2 +- test/tests/PlayTests.cpp | 1 + 179 files changed, 854 insertions(+), 675 deletions(-) rename src/openrct2/actions/{GameAction.h => GameAction.hpp} (62%) create mode 100644 src/openrct2/actions/GameActionParameterVisitor.h create mode 100644 src/openrct2/actions/GameActionRegistry.h create mode 100644 src/openrct2/actions/GameActionRunner.cpp create mode 100644 src/openrct2/actions/GameActionRunner.h diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index b3a0c0c069..cd7aaf798b 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 5f764a7057..7fbc1f272c 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/ride/Construction.cpp b/src/openrct2-ui/ride/Construction.cpp index b8e51b27f3..07431b225c 100644 --- a/src/openrct2-ui/ride/Construction.cpp +++ b/src/openrct2-ui/ride/Construction.cpp @@ -12,6 +12,7 @@ #include "../interface/Viewport.h" #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index be106901b8..6a268a88b1 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index efa08827c8..6f0ef75d86 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 726b571697..629709243e 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 4309c92582..ba22366b13 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index 0a2d521d7a..2fda741f14 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index fcf2e8256b..ffe3c62048 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 77dec849f8..7a4e7cb217 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 4ffba953bc..ee853aaa2c 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index c8dbb2c6e3..913edb7c41 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 91823eca34..46f9fbefc7 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index caccc15458..8943174a11 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 3b4d734f3a..acb8f18cbf 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index dd46fb8239..1f860df4b7 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 8e834ed059..bfc6a25538 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 2f83b4ea1d..70c0f67c3e 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 3c51b0510c..3b9d38304c 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 79ebafb634..9ed3833c87 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 812715e84e..114e45775a 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index fa0f72ec82..6a9ce37cdd 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index 382e9e4cfc..ab10264963 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index d275115e20..b56372aac7 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index fb62f55262..b2bef66089 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 4bb5c05ae6..a141ffaf65 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index a6e28311f1..ff1d31023b 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index b9bccb1489..b6a889abfc 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 14c077cc1e..528c86492e 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 4dac058b01..8b7a9d6888 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index 9636b1a586..df6a472156 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index bf77b03266..3090354f64 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 09538bf31b..4985fb2633 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 39a1a51cf8..d39ce4a6a7 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 8d15a68c08..ba9c48949b 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 64f8020e0e..240d554191 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 467fc47128..e2834aba2e 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2/Cheats.cpp b/src/openrct2/Cheats.cpp index 24d4890328..4e18d5b0df 100644 --- a/src/openrct2/Cheats.cpp +++ b/src/openrct2/Cheats.cpp @@ -11,6 +11,7 @@ #include "GameState.h" #include "actions/CheatSetAction.h" +#include "actions/GameActionRunner.h" #include "actions/ParkSetLoanAction.h" #include "core/DataSerialiser.h" #include "network/Network.h" diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index d2f915112b..5ddc791fa4 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -25,7 +25,7 @@ #include "PlatformEnvironment.h" #include "ReplayManager.h" #include "Version.h" -#include "actions/GameAction.h" +#include "actions/GameActionRunner.h" #include "audio/Audio.h" #include "audio/AudioContext.h" #include "config/Config.h" diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 16c695f49f..1c22d6943f 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -16,6 +16,7 @@ #include "GameState.h" #include "OpenRCT2.h" #include "ParkImporter.h" +#include "actions/GameActionRunner.h" #include "actions/LandBuyRightsAction.h" #include "actions/LandSetRightsAction.h" #include "actions/ResultWithMessage.h" diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 0e4ae7897d..59f758ac36 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -21,6 +21,7 @@ #include "ParkImporter.h" #include "PlatformEnvironment.h" #include "ReplayManager.h" +#include "actions/GameActionRunner.h" #include "actions/GameSetSpeedAction.h" #include "actions/LoadOrQuitAction.h" #include "audio/Audio.h" diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 2b96819391..90c0beb3ae 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -14,7 +14,7 @@ #include "Input.h" #include "OpenRCT2.h" #include "ReplayManager.h" -#include "actions/GameAction.h" +#include "actions/GameActionRunner.h" #include "config/Config.h" #include "drawing/Drawing.h" #include "entity/EntityTweener.h" diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index c9e5ce510f..9d570d8abf 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -19,7 +19,7 @@ #include "PlatformEnvironment.h" #include "actions/CheatSetAction.h" #include "actions/FootpathPlaceAction.h" -#include "actions/GameAction.h" +#include "actions/GameActionRunner.h" #include "actions/RideEntranceExitPlaceAction.h" #include "actions/TileModifyAction.h" #include "actions/TrackPlaceAction.h" diff --git a/src/openrct2/actions/BalloonPressAction.cpp b/src/openrct2/actions/BalloonPressAction.cpp index 19c72338de..03dfbc3d07 100644 --- a/src/openrct2/actions/BalloonPressAction.cpp +++ b/src/openrct2/actions/BalloonPressAction.cpp @@ -13,7 +13,7 @@ #include "../GameState.h" #include "../entity/Balloon.h" #include "../entity/EntityRegistry.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BalloonPressAction.h b/src/openrct2/actions/BalloonPressAction.h index 75928a472e..93392d2c81 100644 --- a/src/openrct2/actions/BalloonPressAction.h +++ b/src/openrct2/actions/BalloonPressAction.h @@ -10,7 +10,7 @@ #pragma once #include "../Identifiers.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerPlaceAction.cpp b/src/openrct2/actions/BannerPlaceAction.cpp index 061382e1d0..1b720c3aeb 100644 --- a/src/openrct2/actions/BannerPlaceAction.cpp +++ b/src/openrct2/actions/BannerPlaceAction.cpp @@ -22,7 +22,7 @@ #include "../world/TileElementsView.h" #include "../world/tile_element/BannerElement.h" #include "../world/tile_element/PathElement.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerPlaceAction.h b/src/openrct2/actions/BannerPlaceAction.h index 7847d4a189..5719aa69e5 100644 --- a/src/openrct2/actions/BannerPlaceAction.h +++ b/src/openrct2/actions/BannerPlaceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::Drawing { diff --git a/src/openrct2/actions/BannerRemoveAction.cpp b/src/openrct2/actions/BannerRemoveAction.cpp index 61a389a363..738ec432bd 100644 --- a/src/openrct2/actions/BannerRemoveAction.cpp +++ b/src/openrct2/actions/BannerRemoveAction.cpp @@ -18,7 +18,7 @@ #include "../world/Scenery.h" #include "../world/TileElementsView.h" #include "../world/tile_element/BannerElement.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerRemoveAction.h b/src/openrct2/actions/BannerRemoveAction.h index d2063d321f..408e597c79 100644 --- a/src/openrct2/actions/BannerRemoveAction.h +++ b/src/openrct2/actions/BannerRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerSetColourAction.cpp b/src/openrct2/actions/BannerSetColourAction.cpp index 33c62fd37d..3b5cff446f 100644 --- a/src/openrct2/actions/BannerSetColourAction.cpp +++ b/src/openrct2/actions/BannerSetColourAction.cpp @@ -16,7 +16,7 @@ #include "../world/Banner.h" #include "../world/Map.h" #include "../world/tile_element/BannerElement.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerSetColourAction.h b/src/openrct2/actions/BannerSetColourAction.h index 34eff768c0..2a4c896c97 100644 --- a/src/openrct2/actions/BannerSetColourAction.h +++ b/src/openrct2/actions/BannerSetColourAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::Drawing { diff --git a/src/openrct2/actions/BannerSetNameAction.cpp b/src/openrct2/actions/BannerSetNameAction.cpp index 28c2fff100..01a8f4a384 100644 --- a/src/openrct2/actions/BannerSetNameAction.cpp +++ b/src/openrct2/actions/BannerSetNameAction.cpp @@ -19,7 +19,7 @@ #include "../world/Banner.h" #include "../world/Map.h" #include "../world/tile_element/BannerElement.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerSetNameAction.h b/src/openrct2/actions/BannerSetNameAction.h index 38d9bbd35f..1f4167cb66 100644 --- a/src/openrct2/actions/BannerSetNameAction.h +++ b/src/openrct2/actions/BannerSetNameAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerSetStyleAction.cpp b/src/openrct2/actions/BannerSetStyleAction.cpp index bdfeb415f1..5260ffd155 100644 --- a/src/openrct2/actions/BannerSetStyleAction.cpp +++ b/src/openrct2/actions/BannerSetStyleAction.cpp @@ -19,7 +19,7 @@ #include "../world/Banner.h" #include "../world/Map.h" #include "../world/tile_element/BannerElement.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/BannerSetStyleAction.h b/src/openrct2/actions/BannerSetStyleAction.h index 7af76d3981..765b6c6af7 100644 --- a/src/openrct2/actions/BannerSetStyleAction.h +++ b/src/openrct2/actions/BannerSetStyleAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index dffca5b040..cdf3bf481b 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -12,6 +12,7 @@ #include "../Cheats.h" #include "../Diagnostic.h" #include "../GameState.h" +#include "../actions/GameActionRunner.h" #include "../config/Config.h" #include "../core/EnumUtils.hpp" #include "../core/Guard.hpp" diff --git a/src/openrct2/actions/CheatSetAction.h b/src/openrct2/actions/CheatSetAction.h index 934ce956ba..854883d4b5 100644 --- a/src/openrct2/actions/CheatSetAction.h +++ b/src/openrct2/actions/CheatSetAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp index 8bf6667bd6..6f4b4cef3f 100644 --- a/src/openrct2/actions/ClearAction.cpp +++ b/src/openrct2/actions/ClearAction.cpp @@ -21,6 +21,7 @@ #include "../world/tile_element/PathElement.h" #include "../world/tile_element/SmallSceneryElement.h" #include "FootpathRemoveAction.h" +#include "GameActionRunner.h" #include "LargeSceneryRemoveAction.h" #include "SmallSceneryRemoveAction.h" #include "WallRemoveAction.h" diff --git a/src/openrct2/actions/ClearAction.h b/src/openrct2/actions/ClearAction.h index d087b25157..e7f3b11ed1 100644 --- a/src/openrct2/actions/ClearAction.h +++ b/src/openrct2/actions/ClearAction.h @@ -11,7 +11,7 @@ #include "../OpenRCT2.h" #include "../management/Finance.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/CustomAction.h b/src/openrct2/actions/CustomAction.h index 0ee60f159c..2d64c322bc 100644 --- a/src/openrct2/actions/CustomAction.h +++ b/src/openrct2/actions/CustomAction.h @@ -11,7 +11,7 @@ #ifdef ENABLE_SCRIPTING - #include "GameAction.h" + #include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.h b/src/openrct2/actions/FootpathAdditionPlaceAction.h index c5a40a033e..3a867c7fe8 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.h +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.h b/src/openrct2/actions/FootpathAdditionRemoveAction.h index 8e7f02fc9a..7c5db648db 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.h +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.h b/src/openrct2/actions/FootpathLayoutPlaceAction.h index a90ce529b7..a2c103fa29 100644 --- a/src/openrct2/actions/FootpathLayoutPlaceAction.h +++ b/src/openrct2/actions/FootpathLayoutPlaceAction.h @@ -10,7 +10,7 @@ #pragma once #include "../world/Footpath.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/FootpathPlaceAction.h b/src/openrct2/actions/FootpathPlaceAction.h index ed2fcb2a42..5ef402bc08 100644 --- a/src/openrct2/actions/FootpathPlaceAction.h +++ b/src/openrct2/actions/FootpathPlaceAction.h @@ -10,7 +10,7 @@ #pragma once #include "../world/Footpath.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp index a0924ee455..a26573128b 100644 --- a/src/openrct2/actions/FootpathRemoveAction.cpp +++ b/src/openrct2/actions/FootpathRemoveAction.cpp @@ -23,6 +23,7 @@ #include "../world/tile_element/BannerElement.h" #include "../world/tile_element/PathElement.h" #include "BannerRemoveAction.h" +#include "GameActionRunner.h" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/FootpathRemoveAction.h b/src/openrct2/actions/FootpathRemoveAction.h index c0284793fa..0b51a9e440 100644 --- a/src/openrct2/actions/FootpathRemoveAction.h +++ b/src/openrct2/actions/FootpathRemoveAction.h @@ -10,7 +10,7 @@ #pragma once #include "../management/Finance.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp index e8b1fc77b0..3eb5ac5d1c 100644 --- a/src/openrct2/actions/GameAction.cpp +++ b/src/openrct2/actions/GameAction.cpp @@ -7,469 +7,21 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ -#include "GameAction.h" +#include "GameAction.hpp" #include "../Context.h" -#include "../Diagnostic.h" -#include "../GameState.h" -#include "../ReplayManager.h" #include "../core/Guard.hpp" -#include "../core/Memory.hpp" -#include "../core/MemoryStream.h" -#include "../entity/MoneyEffect.h" -#include "../localisation/Formatter.h" -#include "../network/Network.h" -#include "../platform/Platform.h" -#include "../profiling/Profiling.h" -#include "../scenario/Scenario.h" #include "../scripting/Duktape.hpp" #include "../scripting/HookEngine.h" #include "../scripting/ScriptEngine.h" -#include "../ui/WindowManager.h" #include "../world/Map.h" -#include "../world/Park.h" -#include "../world/Scenery.h" +#include "GameActionRegistry.h" +#include "GameActionRunner.h" #include namespace OpenRCT2::GameActions { - struct QueuedGameAction - { - uint32_t tick; - uint32_t uniqueId; - GameAction::Ptr action; - - explicit QueuedGameAction(uint32_t t, std::unique_ptr&& ga, uint32_t id) - : tick(t) - , uniqueId(id) - , action(std::move(ga)) - { - } - - bool operator<(const QueuedGameAction& comp) const - { - // First sort by tick - if (tick < comp.tick) - return true; - if (tick > comp.tick) - return false; - - // If the ticks are equal sort by commandIndex - return uniqueId < comp.uniqueId; - } - }; - - static std::multiset _actionQueue; - static uint32_t _nextUniqueId = 0; - static bool _suspended = false; - - void SuspendQueue() - { - _suspended = true; - } - - void ResumeQueue() - { - _suspended = false; - } - - void Enqueue(const GameAction* ga, uint32_t tick) - { - auto action = Clone(ga); - Enqueue(std::move(action), tick); - } - - void Enqueue(GameAction::Ptr&& ga, uint32_t tick) - { - if (ga->GetPlayer() == -1 && Network::GetMode() != Network::Mode::none) - { - // Server can directly invoke actions and will have no player id assigned - // as that normally happens when receiving them over network. - ga->SetPlayer(Network::GetCurrentPlayerId()); - } - _actionQueue.emplace(tick, std::move(ga), _nextUniqueId++); - } - - void ProcessQueue(GameState_t& gameState) - { - if (_suspended) - { - // Do nothing if suspended, this is usually the case between connect and map loads. - return; - } - - const uint32_t currentTick = gameState.currentTicks; - - while (_actionQueue.begin() != _actionQueue.end()) - { - // run all the game commands at the current tick - const QueuedGameAction& queued = *_actionQueue.begin(); - - if (Network::GetMode() == Network::Mode::client) - { - if (queued.tick < currentTick) - { - // This should never happen. - Guard::Assert( - false, - "Discarding game action %s (%u) from tick behind current tick, ID: %08X, Action Tick: %08X, Current " - "Tick: " - "%08X\n", - queued.action->GetName(), queued.action->GetType(), queued.uniqueId, queued.tick, currentTick); - } - else if (queued.tick > currentTick) - { - return; - } - } - - // Remove ghost scenery so it doesn't interfere with incoming network command - switch (queued.action->GetType()) - { - case GameCommand::PlaceWall: - case GameCommand::PlaceLargeScenery: - case GameCommand::PlaceBanner: - case GameCommand::PlaceScenery: - SceneryRemoveGhostToolPlacement(); - break; - default: - break; - } - - GameAction* action = queued.action.get(); - action->SetFlags(action->GetFlags().with(CommandFlag::networked)); - - Guard::Assert(action != nullptr); - - Result result = Execute(action, gameState); - if (result.error == Status::ok && Network::GetMode() == Network::Mode::server) - { - // Relay this action to all other clients. - Network::SendGameAction(action); - } - - _actionQueue.erase(_actionQueue.begin()); - } - } - - void ClearQueue() - { - _actionQueue.clear(); - } - - GameAction::Ptr Clone(const GameAction* action) - { - std::unique_ptr ga = Create(action->GetType()); - ga->SetCallback(action->GetCallback()); - - // Serialise action data into stream. - DataSerialiser dsOut(true); - action->Serialise(dsOut); - - // Serialise into new action. - IStream& stream = dsOut.GetStream(); - stream.SetPosition(0); - - DataSerialiser dsIn(false, stream); - ga->Serialise(dsIn); - - return ga; - } - - static bool CheckActionInPausedMode(const GameState_t& gameState, uint32_t actionFlags) - { - if (gGamePaused == 0) - return true; - if (gameState.cheats.buildInPauseMode) - return true; - if (actionFlags & Flags::AllowWhilePaused) - return true; - return false; - } - - static Result QueryInternal(const GameAction* action, GameState_t& gameState, bool topLevel) - { - Guard::ArgumentNotNull(action); - - uint16_t actionFlags = action->GetActionFlags(); - if (topLevel && !CheckActionInPausedMode(gameState, actionFlags)) - { - Result result = Result(); - - result.error = Status::gamePaused; - result.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; - result.errorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; - - return result; - } - - auto result = action->Query(gameState); - - if (result.error == Status::ok) - { - if (!FinanceCheckAffordability(result.cost, action->GetFlags())) - { - result.error = Status::insufficientFunds; - result.errorTitle = STR_CANT_DO_THIS; - result.errorMessage = STR_NOT_ENOUGH_CASH_REQUIRES; - Formatter(result.errorMessageArgs.data()).Add(result.cost); - } - } - return result; - } - - Result Query(const GameAction* action, GameState_t& gameState) - { - return QueryInternal(action, gameState, true); - } - - Result QueryNested(const GameAction* action, GameState_t& gameState) - { - return QueryInternal(action, gameState, false); - } - - static const char* GetRealm() - { - if (Network::GetMode() == Network::Mode::client) - return "cl"; - if (Network::GetMode() == Network::Mode::server) - return "sv"; - return "sp"; - } - - struct ActionLogContext - { - MemoryStream output; - }; - - static void LogActionBegin(const GameState_t& gameState, ActionLogContext& ctx, const GameAction* action) - { - MemoryStream& output = ctx.output; - - char temp[128] = {}; - snprintf( - temp, sizeof(temp), "[%s] Tick: %u, GA: %s (%08X) (", GetRealm(), gameState.currentTicks, action->GetName(), - EnumValue(action->GetType())); - - output.Write(temp, strlen(temp)); - - DataSerialiser ds(true, ctx.output, true); // Logging mode. - - // Write all parameters into output as text. - action->Serialise(ds); - } - - static void LogActionFinish(ActionLogContext& ctx, const GameAction* action, const Result& result) - { - MemoryStream& output = ctx.output; - - char temp[128] = {}; - - if (result.error != Status::ok) - { - snprintf(temp, sizeof(temp), ") Failed, %u", static_cast(result.error)); - } - else - { - snprintf(temp, sizeof(temp), ") OK"); - } - - output.Write(temp, strlen(temp) + 1); - - const char* text = static_cast(output.GetData()); - LOG_VERBOSE("%s", text); - - Network::AppendServerLog(text); - } - - static Result ExecuteInternal(const GameAction* action, GameState_t& gameState, bool topLevel) - { - Guard::ArgumentNotNull(action); - - uint16_t actionFlags = action->GetActionFlags(); - auto flags = action->GetFlags(); - - // Some actions are not recorded in the replay. - const auto ignoreForReplays = (actionFlags & Flags::IgnoreForReplays) != 0; - - auto* replayManager = GetContext()->GetReplayManager(); - if (replayManager != nullptr && (replayManager->IsReplaying() || replayManager->IsNormalising())) - { - // We only accept replay commands as long the replay is active. - if (!flags.has(CommandFlag::replay) && !ignoreForReplays) - { - // TODO: Introduce proper error. - auto result = Result(); - result.error = Status::gamePaused; - result.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; - result.errorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; - - return result; - } - } - - Result result = QueryInternal(action, gameState, topLevel); -#ifdef ENABLE_SCRIPTING - if (result.error == Status::ok && ((Network::GetMode() == Network::Mode::none) || flags.has(CommandFlag::networked))) - { - auto& scriptEngine = GetContext()->GetScriptEngine(); - scriptEngine.RunGameActionHooks(*action, result, false); - // Script hooks may now have changed the game action result... - } -#endif - if (result.error == Status::ok) - { - if (topLevel) - { - // Networked games send actions to the server to be run - if (Network::GetMode() == Network::Mode::client) - { - // As a client we have to wait or send it first. - if (!(actionFlags & Flags::ClientOnly) && !flags.has(CommandFlag::networked)) - { - LOG_VERBOSE("[%s] GameAction::Execute %s (Out)", GetRealm(), action->GetName()); - Network::SendGameAction(action); - - return result; - } - } - else if (Network::GetMode() == Network::Mode::server || !gInUpdateCode) - { - // If player is the server it would execute right away as where clients execute the commands - // at the beginning of the frame, so we have to put them into the queue. - // This is also the case when its executed from the UI update. - if (!(actionFlags & Flags::ClientOnly) && !flags.has(CommandFlag::networked)) - { - LOG_VERBOSE("[%s] GameAction::Execute %s (Queue)", GetRealm(), action->GetName()); - Enqueue(action, gameState.currentTicks); - - return result; - } - } - } - - ActionLogContext logContext; - if (topLevel && !flags.has(CommandFlag::ghost)) - { - LogActionBegin(gameState, logContext, action); - } - - // Execute the action, changing the game state - result = action->Execute(gameState); -#ifdef ENABLE_SCRIPTING - if (result.error == Status::ok) - { - auto& scriptEngine = GetContext()->GetScriptEngine(); - scriptEngine.RunGameActionHooks(*action, result, true); - // Script hooks may now have changed the game action result... - } -#endif - if (topLevel && !flags.has(CommandFlag::ghost)) - { - LogActionFinish(logContext, action, result); - } - - // If not top level just give away the result. - if (!topLevel) - return result; - - // Update money balance - if (result.error == Status::ok && FinanceCheckMoneyRequired(flags) && result.cost != 0) - { - FinancePayment(result.cost, result.expenditure); - MoneyEffect::Create(result.cost, result.position); - } - - if (!(actionFlags & Flags::ClientOnly) && result.error == Status::ok) - { - if (Network::GetMode() != Network::Mode::none) - { - Network::PlayerId_t playerId = action->GetPlayer(); - - int32_t playerIndex = Network::GetPlayerIndex(playerId.id); - Guard::Assert( - playerIndex != -1, "Unable to find player %u for game action %u", playerId, action->GetType()); - - Network::SetPlayerLastAction(playerIndex, action->GetType()); - Network::IncrementPlayerNumCommands(playerIndex); - if (result.cost > 0) - { - Network::AddPlayerMoneySpent(playerIndex, result.cost); - } - - if (!result.position.IsNull()) - { - Network::SetPlayerLastActionCoord(playerIndex, result.position); - } - } - else - { - bool commandExecutes = !flags.hasAny(CommandFlag::ghost, CommandFlag::noSpend); - - bool recordAction = false; - if (replayManager != nullptr && !ignoreForReplays) - { - if (replayManager->IsRecording() && commandExecutes) - recordAction = true; - else if (replayManager->IsNormalising() && flags.has(CommandFlag::replay)) - recordAction = true; // In normalisation we only feed back actions issued by the replay manager. - } - if (recordAction) - { - replayManager->AddGameAction(gameState.currentTicks, action); - } - } - } - - // Allow autosave to commence - if (gLastAutoSaveUpdate == kAutosavePause) - { - gLastAutoSaveUpdate = Platform::GetTicks(); - } - } - - // Call callback for asynchronous events - auto cb = action->GetCallback(); - if (cb != nullptr) - { - cb(action, &result); - } - - // Only show errors when its not a ghost and not a preview and also top level action. - bool shouldShowError = !flags.has(CommandFlag::ghost) && !flags.has(CommandFlag::noSpend) && topLevel; - - // In network mode the error should be only shown to the issuer of the action. - if (Network::GetMode() != Network::Mode::none) - { - // If the action was never networked and query fails locally the player id is not assigned. - // So compare only if the action went into the queue otherwise show errors by default. - const bool isActionFromNetwork = action->GetFlags().has(CommandFlag::networked); - if (isActionFromNetwork && action->GetPlayer() != Network::GetCurrentPlayerId()) - { - shouldShowError = false; - } - } - - if (result.error != Status::ok && shouldShowError) - { - auto windowManager = Ui::GetWindowManager(); - windowManager->ShowError(result.getErrorTitle(), result.getErrorMessage()); - } - - return result; - } - - Result Execute(const GameAction* action, GameState_t& gameState) - { - return ExecuteInternal(action, gameState, true); - } - - Result ExecuteNested(const GameAction* action, GameState_t& gameState) - { - return ExecuteInternal(action, gameState, false); - } - const char* GameAction::GetName() const { return GameActions::GetName(_type); @@ -508,4 +60,38 @@ namespace OpenRCT2::GameActions #endif return true; } + + GameAction::Ptr Create(GameCommand id) + { + GameAction* result = nullptr; + + auto factory = getFactory(id); + if (factory.has_value()) + { + result = (*factory)(); + } + + Guard::ArgumentNotNull(result, "Attempting to create unregistered game action: %u", id); + return std::unique_ptr(result); + } + + GameAction::Ptr Clone(const GameAction* action) + { + std::unique_ptr ga = Create(action->GetType()); + ga->SetCallback(action->GetCallback()); + + // Serialise action data into stream. + DataSerialiser dsOut(true); + action->Serialise(dsOut); + + // Serialise into new action. + IStream& stream = dsOut.GetStream(); + stream.SetPosition(0); + + DataSerialiser dsIn(false, stream); + ga->Serialise(dsIn); + + return ga; + } + } // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/GameAction.h b/src/openrct2/actions/GameAction.hpp similarity index 62% rename from src/openrct2/actions/GameAction.h rename to src/openrct2/actions/GameAction.hpp index 3eb4f9c62c..d2c9bdec68 100644 --- a/src/openrct2/actions/GameAction.h +++ b/src/openrct2/actions/GameAction.hpp @@ -12,6 +12,7 @@ #include "../Game.h" #include "../core/DataSerialiser.h" #include "../core/Identifier.hpp" +#include "GameActionParameterVisitor.h" #include "GameActionResult.h" #include @@ -39,76 +40,6 @@ namespace OpenRCT2::GameActions #pragma GCC diagnostic ignored "-Wsuggest-final-types" #endif - class GameActionParameterVisitor - { - public: - virtual ~GameActionParameterVisitor() = default; - - virtual void Visit(std::string_view name, bool& param) - { - } - - virtual void Visit(std::string_view name, int32_t& param) - { - } - - virtual void Visit(std::string_view name, std::string& param) - { - } - - void Visit(CoordsXY& param) - { - Visit("x", param.x); - Visit("y", param.y); - } - - void Visit(CoordsXYZ& param) - { - Visit("x", param.x); - Visit("y", param.y); - Visit("z", param.z); - } - - void Visit(CoordsXYZD& param) - { - Visit("x", param.x); - Visit("y", param.y); - Visit("z", param.z); - Visit("direction", param.direction); - } - - void Visit(MapRange& param) - { - Visit("x1", param.Point1.x); - Visit("y1", param.Point1.y); - Visit("x2", param.Point2.x); - Visit("y2", param.Point2.y); - } - - template - void Visit(std::string_view name, T& param) - { - static_assert(std::is_arithmetic_v || std::is_enum_v, "Not an arithmetic type"); - auto value = static_cast(param); - Visit(name, value); - param = static_cast(value); - } - - template - void Visit(std::string_view name, TIdentifier& param) - { - auto value = param.ToUnderlying(); - Visit(name, value); - param = TIdentifier::FromUnderlying(value); - } - - template - void Visit(std::string_view name, Network::NetworkObjectId& param) - { - Visit(name, param.id); - } - }; - class GameAction { public: @@ -245,11 +176,6 @@ namespace OpenRCT2::GameActions #pragma GCC diagnostic pop #endif - template - struct GameActionNameQuery - { - }; - template struct GameActionBase : GameAction { @@ -262,33 +188,7 @@ namespace OpenRCT2::GameActions } }; - using GameActionFactory = GameAction* (*)(); - - bool IsValidId(uint32_t id); - const char* GetName(GameCommand id); - - // Halts the queue processing until ResumeQueue is called, any calls to ProcessQueue - // will have no effect during suspension. It has no effect of actions that will not - // cross the network. - void SuspendQueue(); - - // Resumes queue processing. - void ResumeQueue(); - - void Enqueue(const GameAction* ga, uint32_t tick); - void Enqueue(GameAction::Ptr&& ga, uint32_t tick); - void ProcessQueue(GameState_t& gameState); - void ClearQueue(); - GameAction::Ptr Create(GameCommand id); GameAction::Ptr Clone(const GameAction* action); - // This should be used if a round trip is to be expected. - Result Query(const GameAction* action, GameState_t& gameState); - Result Execute(const GameAction* action, GameState_t& gameState); - - // This should be used from within game actions. - Result QueryNested(const GameAction* action, GameState_t& gameState); - Result ExecuteNested(const GameAction* action, GameState_t& gameState); - } // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/GameActionParameterVisitor.h b/src/openrct2/actions/GameActionParameterVisitor.h new file mode 100644 index 0000000000..2959a72904 --- /dev/null +++ b/src/openrct2/actions/GameActionParameterVisitor.h @@ -0,0 +1,102 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../core/Identifier.hpp" +#include "../network/NetworkTypes.h" +#include "../world/Location.hpp" + +#include +#include + +namespace OpenRCT2::GameActions +{ + // GCC 15.1 is overzealous with its 'final' warnings +#ifdef __WARN_SUGGEST_FINAL_METHODS__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic ignored "-Wsuggest-final-types" +#endif + + class GameActionParameterVisitor + { + public: + virtual ~GameActionParameterVisitor() = default; + + virtual void Visit(std::string_view name, bool& param) + { + } + + virtual void Visit(std::string_view name, int32_t& param) + { + } + + virtual void Visit(std::string_view name, std::string& param) + { + } + + void Visit(CoordsXY& param) + { + Visit("x", param.x); + Visit("y", param.y); + } + + void Visit(CoordsXYZ& param) + { + Visit("x", param.x); + Visit("y", param.y); + Visit("z", param.z); + } + + void Visit(CoordsXYZD& param) + { + Visit("x", param.x); + Visit("y", param.y); + Visit("z", param.z); + Visit("direction", param.direction); + } + + void Visit(MapRange& param) + { + Visit("x1", param.Point1.x); + Visit("y1", param.Point1.y); + Visit("x2", param.Point2.x); + Visit("y2", param.Point2.y); + } + + template + void Visit(std::string_view name, T& param) + { + static_assert(std::is_arithmetic_v || std::is_enum_v, "Not an arithmetic type"); + auto value = static_cast(param); + Visit(name, value); + param = static_cast(value); + } + + template + void Visit(std::string_view name, TIdentifier& param) + { + auto value = param.ToUnderlying(); + Visit(name, value); + param = TIdentifier::FromUnderlying(value); + } + + template + void Visit(std::string_view name, Network::NetworkObjectId& param) + { + Visit(name, param.id); + } + }; + +#ifdef __WARN_SUGGEST_FINAL_METHODS__ + #pragma GCC diagnostic pop +#endif + +} // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/GameActionRegistry.cpp b/src/openrct2/actions/GameActionRegistry.cpp index b47d8ae4a6..dac0880f27 100644 --- a/src/openrct2/actions/GameActionRegistry.cpp +++ b/src/openrct2/actions/GameActionRegistry.cpp @@ -7,6 +7,8 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "GameActionRegistry.h" + #include "../core/Guard.hpp" #include "BalloonPressAction.h" #include "BannerPlaceAction.h" @@ -22,7 +24,6 @@ #include "FootpathLayoutPlaceAction.h" #include "FootpathPlaceAction.h" #include "FootpathRemoveAction.h" -#include "GameAction.h" #include "GameSetSpeedAction.h" #include "GuestSetFlagsAction.h" #include "GuestSetNameAction.h" @@ -223,6 +224,16 @@ namespace OpenRCT2::GameActions static constexpr GameActionRegistry _registry = BuildRegistry(); + std::optional getFactory(GameCommand id) + { + const auto idx = static_cast(id); + if (idx < std::size(_registry)) + { + return _registry[idx].factory; + } + return std::nullopt; + } + const char* GetName(GameCommand id) { const auto idx = static_cast(id); @@ -231,23 +242,6 @@ namespace OpenRCT2::GameActions return _registry[idx].name; } - std::unique_ptr Create(GameCommand id) - { - const auto idx = static_cast(id); - - GameAction* result = nullptr; - if (idx < std::size(_registry)) - { - GameActionFactory factory = _registry[idx].factory; - if (factory != nullptr) - { - result = factory(); - } - } - Guard::ArgumentNotNull(result, "Attempting to create unregistered game action: %u", id); - return std::unique_ptr(result); - } - bool IsValidId(uint32_t id) { if (id < std::size(_registry)) diff --git a/src/openrct2/actions/GameActionRegistry.h b/src/openrct2/actions/GameActionRegistry.h new file mode 100644 index 0000000000..8ba23716dc --- /dev/null +++ b/src/openrct2/actions/GameActionRegistry.h @@ -0,0 +1,27 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include +#include + +enum class GameCommand : int32_t; + +namespace OpenRCT2::GameActions +{ + class GameAction; + + using GameActionFactory = GameAction* (*)(); + + std::optional getFactory(GameCommand command); + const char* GetName(GameCommand id); + bool IsValidId(uint32_t id); + +} // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/GameActionRunner.cpp b/src/openrct2/actions/GameActionRunner.cpp new file mode 100644 index 0000000000..59d04981d3 --- /dev/null +++ b/src/openrct2/actions/GameActionRunner.cpp @@ -0,0 +1,455 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "GameActionRunner.h" + +#include "../Context.h" +#include "../Diagnostic.h" +#include "../GameState.h" +#include "../ReplayManager.h" +#include "../core/Guard.hpp" +#include "../core/Memory.hpp" +#include "../core/MemoryStream.h" +#include "../entity/MoneyEffect.h" +#include "../localisation/Formatter.h" +#include "../network/Network.h" +#include "../platform/Platform.h" +#include "../profiling/Profiling.h" +#include "../scenario/Scenario.h" +#include "../scripting/Duktape.hpp" +#include "../scripting/HookEngine.h" +#include "../scripting/ScriptEngine.h" +#include "../ui/WindowManager.h" +#include "../world/Map.h" +#include "../world/Park.h" +#include "../world/Scenery.h" +#include "GameActionRegistry.h" + +#include + +namespace OpenRCT2::GameActions +{ + struct QueuedGameAction + { + uint32_t tick; + uint32_t uniqueId; + GameAction::Ptr action; + + explicit QueuedGameAction(uint32_t t, std::unique_ptr&& ga, uint32_t id) + : tick(t) + , uniqueId(id) + , action(std::move(ga)) + { + } + + bool operator<(const QueuedGameAction& comp) const + { + // First sort by tick + if (tick < comp.tick) + return true; + if (tick > comp.tick) + return false; + + // If the ticks are equal sort by commandIndex + return uniqueId < comp.uniqueId; + } + }; + + static std::multiset _actionQueue; + static uint32_t _nextUniqueId = 0; + static bool _suspended = false; + + void SuspendQueue() + { + _suspended = true; + } + + void ResumeQueue() + { + _suspended = false; + } + + void Enqueue(const GameAction* ga, uint32_t tick) + { + auto action = Clone(ga); + Enqueue(std::move(action), tick); + } + + void Enqueue(GameAction::Ptr&& ga, uint32_t tick) + { + if (ga->GetPlayer() == -1 && Network::GetMode() != Network::Mode::none) + { + // Server can directly invoke actions and will have no player id assigned + // as that normally happens when receiving them over network. + ga->SetPlayer(Network::GetCurrentPlayerId()); + } + _actionQueue.emplace(tick, std::move(ga), _nextUniqueId++); + } + + void ProcessQueue(GameState_t& gameState) + { + if (_suspended) + { + // Do nothing if suspended, this is usually the case between connect and map loads. + return; + } + + const uint32_t currentTick = gameState.currentTicks; + + while (_actionQueue.begin() != _actionQueue.end()) + { + // run all the game commands at the current tick + const QueuedGameAction& queued = *_actionQueue.begin(); + + if (Network::GetMode() == Network::Mode::client) + { + if (queued.tick < currentTick) + { + // This should never happen. + Guard::Assert( + false, + "Discarding game action %s (%u) from tick behind current tick, ID: %08X, Action Tick: %08X, Current " + "Tick: " + "%08X\n", + queued.action->GetName(), queued.action->GetType(), queued.uniqueId, queued.tick, currentTick); + } + else if (queued.tick > currentTick) + { + return; + } + } + + // Remove ghost scenery so it doesn't interfere with incoming network command + switch (queued.action->GetType()) + { + case GameCommand::PlaceWall: + case GameCommand::PlaceLargeScenery: + case GameCommand::PlaceBanner: + case GameCommand::PlaceScenery: + SceneryRemoveGhostToolPlacement(); + break; + default: + break; + } + + GameAction* action = queued.action.get(); + action->SetFlags(action->GetFlags().with(CommandFlag::networked)); + + Guard::Assert(action != nullptr); + + Result result = Execute(action, gameState); + if (result.error == Status::ok && Network::GetMode() == Network::Mode::server) + { + // Relay this action to all other clients. + Network::SendGameAction(action); + } + + _actionQueue.erase(_actionQueue.begin()); + } + } + + void ClearQueue() + { + _actionQueue.clear(); + } + + static bool CheckActionInPausedMode(const GameState_t& gameState, uint32_t actionFlags) + { + if (gGamePaused == 0) + return true; + if (gameState.cheats.buildInPauseMode) + return true; + if (actionFlags & Flags::AllowWhilePaused) + return true; + return false; + } + + static Result QueryInternal(const GameAction* action, GameState_t& gameState, bool topLevel) + { + Guard::ArgumentNotNull(action); + + uint16_t actionFlags = action->GetActionFlags(); + if (topLevel && !CheckActionInPausedMode(gameState, actionFlags)) + { + Result result = Result(); + + result.error = Status::gamePaused; + result.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + result.errorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + + return result; + } + + auto result = action->Query(gameState); + + if (result.error == Status::ok) + { + if (!FinanceCheckAffordability(result.cost, action->GetFlags())) + { + result.error = Status::insufficientFunds; + result.errorTitle = STR_CANT_DO_THIS; + result.errorMessage = STR_NOT_ENOUGH_CASH_REQUIRES; + Formatter(result.errorMessageArgs.data()).Add(result.cost); + } + } + return result; + } + + Result Query(const GameAction* action, GameState_t& gameState) + { + return QueryInternal(action, gameState, true); + } + + Result QueryNested(const GameAction* action, GameState_t& gameState) + { + return QueryInternal(action, gameState, false); + } + + static const char* GetRealm() + { + if (Network::GetMode() == Network::Mode::client) + return "cl"; + if (Network::GetMode() == Network::Mode::server) + return "sv"; + return "sp"; + } + + struct ActionLogContext + { + MemoryStream output; + }; + + static void LogActionBegin(const GameState_t& gameState, ActionLogContext& ctx, const GameAction* action) + { + MemoryStream& output = ctx.output; + + char temp[128] = {}; + snprintf( + temp, sizeof(temp), "[%s] Tick: %u, GA: %s (%08X) (", GetRealm(), gameState.currentTicks, action->GetName(), + EnumValue(action->GetType())); + + output.Write(temp, strlen(temp)); + + DataSerialiser ds(true, ctx.output, true); // Logging mode. + + // Write all parameters into output as text. + action->Serialise(ds); + } + + static void LogActionFinish(ActionLogContext& ctx, const GameAction* action, const Result& result) + { + MemoryStream& output = ctx.output; + + char temp[128] = {}; + + if (result.error != Status::ok) + { + snprintf(temp, sizeof(temp), ") Failed, %u", static_cast(result.error)); + } + else + { + snprintf(temp, sizeof(temp), ") OK"); + } + + output.Write(temp, strlen(temp) + 1); + + const char* text = static_cast(output.GetData()); + LOG_VERBOSE("%s", text); + + Network::AppendServerLog(text); + } + + static Result ExecuteInternal(const GameAction* action, GameState_t& gameState, bool topLevel) + { + Guard::ArgumentNotNull(action); + + uint16_t actionFlags = action->GetActionFlags(); + auto flags = action->GetFlags(); + + // Some actions are not recorded in the replay. + const auto ignoreForReplays = (actionFlags & Flags::IgnoreForReplays) != 0; + + auto* replayManager = GetContext()->GetReplayManager(); + if (replayManager != nullptr && (replayManager->IsReplaying() || replayManager->IsNormalising())) + { + // We only accept replay commands as long the replay is active. + if (!flags.has(CommandFlag::replay) && !ignoreForReplays) + { + // TODO: Introduce proper error. + auto result = Result(); + result.error = Status::gamePaused; + result.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + result.errorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + + return result; + } + } + + Result result = QueryInternal(action, gameState, topLevel); +#ifdef ENABLE_SCRIPTING + if (result.error == Status::ok && ((Network::GetMode() == Network::Mode::none) || flags.has(CommandFlag::networked))) + { + auto& scriptEngine = GetContext()->GetScriptEngine(); + scriptEngine.RunGameActionHooks(*action, result, false); + // Script hooks may now have changed the game action result... + } +#endif + if (result.error == Status::ok) + { + if (topLevel) + { + // Networked games send actions to the server to be run + if (Network::GetMode() == Network::Mode::client) + { + // As a client we have to wait or send it first. + if (!(actionFlags & Flags::ClientOnly) && !flags.has(CommandFlag::networked)) + { + LOG_VERBOSE("[%s] GameAction::Execute %s (Out)", GetRealm(), action->GetName()); + Network::SendGameAction(action); + + return result; + } + } + else if (Network::GetMode() == Network::Mode::server || !gInUpdateCode) + { + // If player is the server it would execute right away as where clients execute the commands + // at the beginning of the frame, so we have to put them into the queue. + // This is also the case when its executed from the UI update. + if (!(actionFlags & Flags::ClientOnly) && !flags.has(CommandFlag::networked)) + { + LOG_VERBOSE("[%s] GameAction::Execute %s (Queue)", GetRealm(), action->GetName()); + Enqueue(action, gameState.currentTicks); + + return result; + } + } + } + + ActionLogContext logContext; + if (topLevel && !flags.has(CommandFlag::ghost)) + { + LogActionBegin(gameState, logContext, action); + } + + // Execute the action, changing the game state + result = action->Execute(gameState); +#ifdef ENABLE_SCRIPTING + if (result.error == Status::ok) + { + auto& scriptEngine = GetContext()->GetScriptEngine(); + scriptEngine.RunGameActionHooks(*action, result, true); + // Script hooks may now have changed the game action result... + } +#endif + if (topLevel && !flags.has(CommandFlag::ghost)) + { + LogActionFinish(logContext, action, result); + } + + // If not top level just give away the result. + if (!topLevel) + return result; + + // Update money balance + if (result.error == Status::ok && FinanceCheckMoneyRequired(flags) && result.cost != 0) + { + FinancePayment(result.cost, result.expenditure); + MoneyEffect::Create(result.cost, result.position); + } + + if (!(actionFlags & Flags::ClientOnly) && result.error == Status::ok) + { + if (Network::GetMode() != Network::Mode::none) + { + Network::PlayerId_t playerId = action->GetPlayer(); + + int32_t playerIndex = Network::GetPlayerIndex(playerId.id); + Guard::Assert( + playerIndex != -1, "Unable to find player %u for game action %u", playerId, action->GetType()); + + Network::SetPlayerLastAction(playerIndex, action->GetType()); + Network::IncrementPlayerNumCommands(playerIndex); + if (result.cost > 0) + { + Network::AddPlayerMoneySpent(playerIndex, result.cost); + } + + if (!result.position.IsNull()) + { + Network::SetPlayerLastActionCoord(playerIndex, result.position); + } + } + else + { + bool commandExecutes = !flags.hasAny(CommandFlag::ghost, CommandFlag::noSpend); + + bool recordAction = false; + if (replayManager != nullptr && !ignoreForReplays) + { + if (replayManager->IsRecording() && commandExecutes) + recordAction = true; + else if (replayManager->IsNormalising() && flags.has(CommandFlag::replay)) + recordAction = true; // In normalisation we only feed back actions issued by the replay manager. + } + if (recordAction) + { + replayManager->AddGameAction(gameState.currentTicks, action); + } + } + } + + // Allow autosave to commence + if (gLastAutoSaveUpdate == kAutosavePause) + { + gLastAutoSaveUpdate = Platform::GetTicks(); + } + } + + // Call callback for asynchronous events + auto cb = action->GetCallback(); + if (cb != nullptr) + { + cb(action, &result); + } + + // Only show errors when its not a ghost and not a preview and also top level action. + bool shouldShowError = !flags.has(CommandFlag::ghost) && !flags.has(CommandFlag::noSpend) && topLevel; + + // In network mode the error should be only shown to the issuer of the action. + if (Network::GetMode() != Network::Mode::none) + { + // If the action was never networked and query fails locally the player id is not assigned. + // So compare only if the action went into the queue otherwise show errors by default. + const bool isActionFromNetwork = action->GetFlags().has(CommandFlag::networked); + if (isActionFromNetwork && action->GetPlayer() != Network::GetCurrentPlayerId()) + { + shouldShowError = false; + } + } + + if (result.error != Status::ok && shouldShowError) + { + auto windowManager = Ui::GetWindowManager(); + windowManager->ShowError(result.getErrorTitle(), result.getErrorMessage()); + } + + return result; + } + + Result Execute(const GameAction* action, GameState_t& gameState) + { + return ExecuteInternal(action, gameState, true); + } + + Result ExecuteNested(const GameAction* action, GameState_t& gameState) + { + return ExecuteInternal(action, gameState, false); + } + +} // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/GameActionRunner.h b/src/openrct2/actions/GameActionRunner.h new file mode 100644 index 0000000000..0881657210 --- /dev/null +++ b/src/openrct2/actions/GameActionRunner.h @@ -0,0 +1,42 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../Game.h" +#include "GameAction.hpp" + +namespace OpenRCT2 +{ + struct GameState_t; +} + +namespace OpenRCT2::GameActions +{ + // Halts the queue processing until ResumeQueue is called, any calls to ProcessQueue + // will have no effect during suspension. It has no effect of actions that will not + // cross the network. + void SuspendQueue(); + + // Resumes queue processing. + void ResumeQueue(); + + void Enqueue(const GameAction* ga, uint32_t tick); + void Enqueue(GameAction::Ptr&& ga, uint32_t tick); + void ProcessQueue(GameState_t& gameState); + void ClearQueue(); + + // This should be used if a round trip is to be expected. + Result Query(const GameAction* action, GameState_t& gameState); + Result Execute(const GameAction* action, GameState_t& gameState); + + // This should be used from within game actions. + Result QueryNested(const GameAction* action, GameState_t& gameState); + Result ExecuteNested(const GameAction* action, GameState_t& gameState); +} // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/GameSetSpeedAction.h b/src/openrct2/actions/GameSetSpeedAction.h index 89842556c2..eb6a8cf88d 100644 --- a/src/openrct2/actions/GameSetSpeedAction.h +++ b/src/openrct2/actions/GameSetSpeedAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/GuestSetFlagsAction.h b/src/openrct2/actions/GuestSetFlagsAction.h index 1cda6807a3..e6e1771f6b 100644 --- a/src/openrct2/actions/GuestSetFlagsAction.h +++ b/src/openrct2/actions/GuestSetFlagsAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/GuestSetNameAction.h b/src/openrct2/actions/GuestSetNameAction.h index 9fb1f7581a..e0a83d256b 100644 --- a/src/openrct2/actions/GuestSetNameAction.h +++ b/src/openrct2/actions/GuestSetNameAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LandBuyRightsAction.h b/src/openrct2/actions/LandBuyRightsAction.h index 60c4433bb0..8bb6a028cb 100644 --- a/src/openrct2/actions/LandBuyRightsAction.h +++ b/src/openrct2/actions/LandBuyRightsAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp index c2fde776ee..a5b641ba54 100644 --- a/src/openrct2/actions/LandLowerAction.cpp +++ b/src/openrct2/actions/LandLowerAction.cpp @@ -26,6 +26,7 @@ #include "../world/SurfaceData.h" #include "../world/tile_element/Slope.h" #include "../world/tile_element/SurfaceElement.h" +#include "GameActionRunner.h" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LandLowerAction.h b/src/openrct2/actions/LandLowerAction.h index a9aba164be..99d03d7748 100644 --- a/src/openrct2/actions/LandLowerAction.h +++ b/src/openrct2/actions/LandLowerAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" enum class MapSelectType : uint8_t; diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp index aa55d8d7ab..cbf00a1c5f 100644 --- a/src/openrct2/actions/LandRaiseAction.cpp +++ b/src/openrct2/actions/LandRaiseAction.cpp @@ -27,6 +27,7 @@ #include "../world/SurfaceData.h" #include "../world/tile_element/Slope.h" #include "../world/tile_element/SurfaceElement.h" +#include "GameActionRunner.h" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LandRaiseAction.h b/src/openrct2/actions/LandRaiseAction.h index 36b9ade0f2..f5c9f6458e 100644 --- a/src/openrct2/actions/LandRaiseAction.h +++ b/src/openrct2/actions/LandRaiseAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" enum class MapSelectType : uint8_t; diff --git a/src/openrct2/actions/LandSetHeightAction.h b/src/openrct2/actions/LandSetHeightAction.h index b6a0fe93c6..2d18a0af56 100644 --- a/src/openrct2/actions/LandSetHeightAction.h +++ b/src/openrct2/actions/LandSetHeightAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LandSetRightsAction.h b/src/openrct2/actions/LandSetRightsAction.h index 46bbde6f42..12dfea0cf4 100644 --- a/src/openrct2/actions/LandSetRightsAction.h +++ b/src/openrct2/actions/LandSetRightsAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LandSmoothAction.cpp b/src/openrct2/actions/LandSmoothAction.cpp index 07616351ee..89deca3435 100644 --- a/src/openrct2/actions/LandSmoothAction.cpp +++ b/src/openrct2/actions/LandSmoothAction.cpp @@ -27,6 +27,7 @@ #include "../world/SurfaceData.h" #include "../world/tile_element/Slope.h" #include "../world/tile_element/SurfaceElement.h" +#include "GameActionRunner.h" #include diff --git a/src/openrct2/actions/LandSmoothAction.h b/src/openrct2/actions/LandSmoothAction.h index bedab19c47..acfbfc8909 100644 --- a/src/openrct2/actions/LandSmoothAction.h +++ b/src/openrct2/actions/LandSmoothAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" enum class MapSelectType : uint8_t; diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.h b/src/openrct2/actions/LargeSceneryPlaceAction.h index f62c879173..991eef683e 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.h +++ b/src/openrct2/actions/LargeSceneryPlaceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2 { diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.h b/src/openrct2/actions/LargeSceneryRemoveAction.h index 2c6ad2c9df..8fa9430fc7 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.h +++ b/src/openrct2/actions/LargeSceneryRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LargeScenerySetColourAction.h b/src/openrct2/actions/LargeScenerySetColourAction.h index 98d9b8811a..ee5703fa4f 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.h +++ b/src/openrct2/actions/LargeScenerySetColourAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/LoadOrQuitAction.h b/src/openrct2/actions/LoadOrQuitAction.h index e9d25553d1..0d955b2f52 100644 --- a/src/openrct2/actions/LoadOrQuitAction.h +++ b/src/openrct2/actions/LoadOrQuitAction.h @@ -10,7 +10,7 @@ #pragma once #include "../interface/Window.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/MapChangeSizeAction.h b/src/openrct2/actions/MapChangeSizeAction.h index dd3562155c..3cc1422e30 100644 --- a/src/openrct2/actions/MapChangeSizeAction.h +++ b/src/openrct2/actions/MapChangeSizeAction.h @@ -10,7 +10,7 @@ #pragma once #include "../world/Location.hpp" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/MazePlaceTrackAction.h b/src/openrct2/actions/MazePlaceTrackAction.h index f118d14e33..a5798804c6 100644 --- a/src/openrct2/actions/MazePlaceTrackAction.h +++ b/src/openrct2/actions/MazePlaceTrackAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/MazeSetTrackAction.h b/src/openrct2/actions/MazeSetTrackAction.h index a7db54aa18..e925a0f50c 100644 --- a/src/openrct2/actions/MazeSetTrackAction.h +++ b/src/openrct2/actions/MazeSetTrackAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/NetworkModifyGroupAction.h b/src/openrct2/actions/NetworkModifyGroupAction.h index ec74e01f02..0e308b1747 100644 --- a/src/openrct2/actions/NetworkModifyGroupAction.h +++ b/src/openrct2/actions/NetworkModifyGroupAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkEntrancePlaceAction.h b/src/openrct2/actions/ParkEntrancePlaceAction.h index 60164a22dc..9020c24a4b 100644 --- a/src/openrct2/actions/ParkEntrancePlaceAction.h +++ b/src/openrct2/actions/ParkEntrancePlaceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.h b/src/openrct2/actions/ParkEntranceRemoveAction.h index e459a45f7e..d60a292298 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.h +++ b/src/openrct2/actions/ParkEntranceRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkMarketingAction.h b/src/openrct2/actions/ParkMarketingAction.h index 7e5aec1f06..dc627642f0 100644 --- a/src/openrct2/actions/ParkMarketingAction.h +++ b/src/openrct2/actions/ParkMarketingAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkSetDateAction.h b/src/openrct2/actions/ParkSetDateAction.h index a42c8c870c..6453445406 100644 --- a/src/openrct2/actions/ParkSetDateAction.h +++ b/src/openrct2/actions/ParkSetDateAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkSetEntranceFeeAction.h b/src/openrct2/actions/ParkSetEntranceFeeAction.h index 84ef9c79f4..0b34d00d39 100644 --- a/src/openrct2/actions/ParkSetEntranceFeeAction.h +++ b/src/openrct2/actions/ParkSetEntranceFeeAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkSetLoanAction.h b/src/openrct2/actions/ParkSetLoanAction.h index e2ed95511c..d3a0715e9b 100644 --- a/src/openrct2/actions/ParkSetLoanAction.h +++ b/src/openrct2/actions/ParkSetLoanAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkSetNameAction.h b/src/openrct2/actions/ParkSetNameAction.h index 96b083d8c8..25ca2d8ee7 100644 --- a/src/openrct2/actions/ParkSetNameAction.h +++ b/src/openrct2/actions/ParkSetNameAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkSetParameterAction.h b/src/openrct2/actions/ParkSetParameterAction.h index 6fca01c201..eced96f1f5 100644 --- a/src/openrct2/actions/ParkSetParameterAction.h +++ b/src/openrct2/actions/ParkSetParameterAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ParkSetResearchFundingAction.h b/src/openrct2/actions/ParkSetResearchFundingAction.h index 587800ac43..7fdfe23f83 100644 --- a/src/openrct2/actions/ParkSetResearchFundingAction.h +++ b/src/openrct2/actions/ParkSetResearchFundingAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/PauseToggleAction.h b/src/openrct2/actions/PauseToggleAction.h index 6d93c12b9c..f96d2e5465 100644 --- a/src/openrct2/actions/PauseToggleAction.h +++ b/src/openrct2/actions/PauseToggleAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/PeepPickupAction.cpp b/src/openrct2/actions/PeepPickupAction.cpp index f24e8f1291..01e7f0fd9b 100644 --- a/src/openrct2/actions/PeepPickupAction.cpp +++ b/src/openrct2/actions/PeepPickupAction.cpp @@ -15,6 +15,7 @@ #include "../entity/EntityRegistry.h" #include "../entity/Peep.h" #include "../network/Network.h" +#include "GameActionRunner.h" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/PeepPickupAction.h b/src/openrct2/actions/PeepPickupAction.h index b59054eb27..87445a74ed 100644 --- a/src/openrct2/actions/PeepPickupAction.h +++ b/src/openrct2/actions/PeepPickupAction.h @@ -10,7 +10,7 @@ #pragma once #include "../Identifiers.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/PeepSpawnPlaceAction.h b/src/openrct2/actions/PeepSpawnPlaceAction.h index 274455beb0..9c290ec234 100644 --- a/src/openrct2/actions/PeepSpawnPlaceAction.h +++ b/src/openrct2/actions/PeepSpawnPlaceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/PlayerKickAction.h b/src/openrct2/actions/PlayerKickAction.h index 783550a696..396c15de51 100644 --- a/src/openrct2/actions/PlayerKickAction.h +++ b/src/openrct2/actions/PlayerKickAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/PlayerSetGroupAction.h b/src/openrct2/actions/PlayerSetGroupAction.h index bccbeca1b8..f3bf5b8557 100644 --- a/src/openrct2/actions/PlayerSetGroupAction.h +++ b/src/openrct2/actions/PlayerSetGroupAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideCreateAction.h b/src/openrct2/actions/RideCreateAction.h index 893294415a..df6c4792d0 100644 --- a/src/openrct2/actions/RideCreateAction.h +++ b/src/openrct2/actions/RideCreateAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp index 68a1df124c..f1b2822458 100644 --- a/src/openrct2/actions/RideDemolishAction.cpp +++ b/src/openrct2/actions/RideDemolishAction.cpp @@ -27,6 +27,7 @@ #include "../world/Park.h" #include "../world/TileElementsView.h" #include "../world/tile_element/TrackElement.h" +#include "GameActionRunner.h" #include "MazeSetTrackAction.h" #include "TrackRemoveAction.h" diff --git a/src/openrct2/actions/RideDemolishAction.h b/src/openrct2/actions/RideDemolishAction.h index 6bacbd2d7e..ef47227116 100644 --- a/src/openrct2/actions/RideDemolishAction.h +++ b/src/openrct2/actions/RideDemolishAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 2f9faddcb9..cd6c803616 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -11,7 +11,6 @@ #include "../Diagnostic.h" #include "../GameState.h" -#include "../actions/RideEntranceExitRemoveAction.h" #include "../core/Guard.hpp" #include "../management/Finance.h" #include "../ride/Ride.h" @@ -22,6 +21,8 @@ #include "../world/Wall.h" #include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" +#include "GameActionRunner.h" +#include "RideEntranceExitRemoveAction.h" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.h b/src/openrct2/actions/RideEntranceExitPlaceAction.h index 2e35c9acc3..035074326d 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.h +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.h @@ -10,7 +10,7 @@ #pragma once #include "../world/Entrance.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.h b/src/openrct2/actions/RideEntranceExitRemoveAction.h index ba118a1892..11b7898a8d 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.h +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideFreezeRatingAction.h b/src/openrct2/actions/RideFreezeRatingAction.h index 2e79429888..9768dcabed 100644 --- a/src/openrct2/actions/RideFreezeRatingAction.h +++ b/src/openrct2/actions/RideFreezeRatingAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetAppearanceAction.h b/src/openrct2/actions/RideSetAppearanceAction.h index 8d6b06d878..5efca79145 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.h +++ b/src/openrct2/actions/RideSetAppearanceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetColourSchemeAction.h b/src/openrct2/actions/RideSetColourSchemeAction.h index cb59860b3e..74baaab529 100644 --- a/src/openrct2/actions/RideSetColourSchemeAction.h +++ b/src/openrct2/actions/RideSetColourSchemeAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetNameAction.h b/src/openrct2/actions/RideSetNameAction.h index b48a6e03f5..cb2efa6a17 100644 --- a/src/openrct2/actions/RideSetNameAction.h +++ b/src/openrct2/actions/RideSetNameAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetPriceAction.h b/src/openrct2/actions/RideSetPriceAction.h index 12630228ff..f4eaa8e5c1 100644 --- a/src/openrct2/actions/RideSetPriceAction.h +++ b/src/openrct2/actions/RideSetPriceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetSettingAction.h b/src/openrct2/actions/RideSetSettingAction.h index d971853fad..ee357cb856 100644 --- a/src/openrct2/actions/RideSetSettingAction.h +++ b/src/openrct2/actions/RideSetSettingAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetStatusAction.h b/src/openrct2/actions/RideSetStatusAction.h index 1a6b490522..185335122b 100644 --- a/src/openrct2/actions/RideSetStatusAction.h +++ b/src/openrct2/actions/RideSetStatusAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetVehicleAction.h b/src/openrct2/actions/RideSetVehicleAction.h index be760513fd..2f1dff0e8e 100644 --- a/src/openrct2/actions/RideSetVehicleAction.h +++ b/src/openrct2/actions/RideSetVehicleAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetVisibilityAction.cpp b/src/openrct2/actions/RideSetVisibilityAction.cpp index e98b7fabcc..d09a97ce4d 100644 --- a/src/openrct2/actions/RideSetVisibilityAction.cpp +++ b/src/openrct2/actions/RideSetVisibilityAction.cpp @@ -13,7 +13,7 @@ #include "../GameState.h" #include "../world/TileElementsView.h" #include "../world/tile_element/TrackElement.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/RideSetVisibilityAction.h b/src/openrct2/actions/RideSetVisibilityAction.h index f17bc28199..d13996d214 100644 --- a/src/openrct2/actions/RideSetVisibilityAction.h +++ b/src/openrct2/actions/RideSetVisibilityAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ScenarioSetSettingAction.h b/src/openrct2/actions/ScenarioSetSettingAction.h index e7959aa779..51c8f28f02 100644 --- a/src/openrct2/actions/ScenarioSetSettingAction.h +++ b/src/openrct2/actions/ScenarioSetSettingAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/ScenerySetRestrictedAction.h b/src/openrct2/actions/ScenerySetRestrictedAction.h index cf88c98037..dba5b91855 100644 --- a/src/openrct2/actions/ScenerySetRestrictedAction.h +++ b/src/openrct2/actions/ScenerySetRestrictedAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/SignSetNameAction.h b/src/openrct2/actions/SignSetNameAction.h index 0f1374d681..b8169eac04 100644 --- a/src/openrct2/actions/SignSetNameAction.h +++ b/src/openrct2/actions/SignSetNameAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/SignSetStyleAction.h b/src/openrct2/actions/SignSetStyleAction.h index ae80ec6a10..c83bb11a97 100644 --- a/src/openrct2/actions/SignSetStyleAction.h +++ b/src/openrct2/actions/SignSetStyleAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.cpp b/src/openrct2/actions/SmallSceneryPlaceAction.cpp index a87cac7182..f90bf2b363 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.cpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.cpp @@ -31,7 +31,7 @@ #include "../world/tile_element/Slope.h" #include "../world/tile_element/SmallSceneryElement.h" #include "../world/tile_element/SurfaceElement.h" -#include "GameAction.h" +#include "GameAction.hpp" #include "SmallSceneryRemoveAction.h" namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.h b/src/openrct2/actions/SmallSceneryPlaceAction.h index eceeb296fd..2fa96d4996 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.h +++ b/src/openrct2/actions/SmallSceneryPlaceAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.cpp b/src/openrct2/actions/SmallSceneryRemoveAction.cpp index d812907f36..65e39b02e8 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.cpp +++ b/src/openrct2/actions/SmallSceneryRemoveAction.cpp @@ -23,7 +23,7 @@ #include "../world/Park.h" #include "../world/TileElementsView.h" #include "../world/tile_element/SmallSceneryElement.h" -#include "GameAction.h" +#include "GameAction.hpp" #include "SmallSceneryPlaceAction.h" namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.h b/src/openrct2/actions/SmallSceneryRemoveAction.h index 432dc704aa..54098cd668 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.h +++ b/src/openrct2/actions/SmallSceneryRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/SmallScenerySetColourAction.h b/src/openrct2/actions/SmallScenerySetColourAction.h index 168c13d780..24285dcffc 100644 --- a/src/openrct2/actions/SmallScenerySetColourAction.h +++ b/src/openrct2/actions/SmallScenerySetColourAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/StaffFireAction.h b/src/openrct2/actions/StaffFireAction.h index 8c0841e92d..1b4d926394 100644 --- a/src/openrct2/actions/StaffFireAction.h +++ b/src/openrct2/actions/StaffFireAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/StaffHireNewAction.h b/src/openrct2/actions/StaffHireNewAction.h index cd30b6ec18..ca3673e440 100644 --- a/src/openrct2/actions/StaffHireNewAction.h +++ b/src/openrct2/actions/StaffHireNewAction.h @@ -10,7 +10,7 @@ #pragma once #include "../entity/Staff.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/StaffSetColourAction.h b/src/openrct2/actions/StaffSetColourAction.h index 37f4acf07a..34baef20d8 100644 --- a/src/openrct2/actions/StaffSetColourAction.h +++ b/src/openrct2/actions/StaffSetColourAction.h @@ -10,7 +10,7 @@ #pragma once #include "../entity/Staff.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/StaffSetCostumeAction.h b/src/openrct2/actions/StaffSetCostumeAction.h index e7e868b3b0..58fb493688 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.h +++ b/src/openrct2/actions/StaffSetCostumeAction.h @@ -10,7 +10,7 @@ #pragma once #include "../entity/Staff.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/StaffSetNameAction.h b/src/openrct2/actions/StaffSetNameAction.h index 29dcf578ce..56e85cdb0f 100644 --- a/src/openrct2/actions/StaffSetNameAction.h +++ b/src/openrct2/actions/StaffSetNameAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/StaffSetOrdersAction.h b/src/openrct2/actions/StaffSetOrdersAction.h index a1538eea1c..00871ee30d 100644 --- a/src/openrct2/actions/StaffSetOrdersAction.h +++ b/src/openrct2/actions/StaffSetOrdersAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/StaffSetPatrolAreaAction.h b/src/openrct2/actions/StaffSetPatrolAreaAction.h index 2c895cc532..9bd9c95b50 100644 --- a/src/openrct2/actions/StaffSetPatrolAreaAction.h +++ b/src/openrct2/actions/StaffSetPatrolAreaAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/SurfaceSetStyleAction.h b/src/openrct2/actions/SurfaceSetStyleAction.h index c47d961c18..30b4b0cf35 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.h +++ b/src/openrct2/actions/SurfaceSetStyleAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/TileModifyAction.h b/src/openrct2/actions/TileModifyAction.h index 1c0214353c..732d61db8d 100644 --- a/src/openrct2/actions/TileModifyAction.h +++ b/src/openrct2/actions/TileModifyAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/TrackDesignAction.cpp b/src/openrct2/actions/TrackDesignAction.cpp index 289d0961bc..31b725b5f5 100644 --- a/src/openrct2/actions/TrackDesignAction.cpp +++ b/src/openrct2/actions/TrackDesignAction.cpp @@ -19,6 +19,7 @@ #include "../object/ObjectRepository.h" #include "../ride/RideConstruction.h" #include "../ride/TrackDesign.h" +#include "GameActionRunner.h" #include "RideCreateAction.h" #include "RideDemolishAction.h" #include "RideSetNameAction.h" diff --git a/src/openrct2/actions/TrackDesignAction.h b/src/openrct2/actions/TrackDesignAction.h index 2b658d2486..8652cccff2 100644 --- a/src/openrct2/actions/TrackDesignAction.h +++ b/src/openrct2/actions/TrackDesignAction.h @@ -10,7 +10,7 @@ #pragma once #include "../ride/TrackDesign.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index cc8924055a..dda568bae8 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -28,6 +28,7 @@ #include "../world/tile_element/Slope.h" #include "../world/tile_element/SurfaceElement.h" #include "../world/tile_element/TrackElement.h" +#include "GameActionRunner.h" #include "ResultWithMessage.h" #include "RideSetSettingAction.h" diff --git a/src/openrct2/actions/TrackPlaceAction.h b/src/openrct2/actions/TrackPlaceAction.h index 8604c4d09b..878cbde267 100644 --- a/src/openrct2/actions/TrackPlaceAction.h +++ b/src/openrct2/actions/TrackPlaceAction.h @@ -10,7 +10,7 @@ #pragma once #include "../ride/RideConstruction.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index ed291447b5..d72e867991 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -20,6 +20,7 @@ #include "../world/Map.h" #include "../world/tile_element/SurfaceElement.h" #include "../world/tile_element/TrackElement.h" +#include "GameActionRunner.h" #include "ResultWithMessage.h" #include "RideSetSettingAction.h" diff --git a/src/openrct2/actions/TrackRemoveAction.h b/src/openrct2/actions/TrackRemoveAction.h index ffad32da2f..5b5ec4d3a4 100644 --- a/src/openrct2/actions/TrackRemoveAction.h +++ b/src/openrct2/actions/TrackRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/TrackSetBrakeSpeedAction.h b/src/openrct2/actions/TrackSetBrakeSpeedAction.h index 65447a992a..18974cca83 100644 --- a/src/openrct2/actions/TrackSetBrakeSpeedAction.h +++ b/src/openrct2/actions/TrackSetBrakeSpeedAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/WallPlaceAction.h b/src/openrct2/actions/WallPlaceAction.h index 5cb8bef738..d1bd24b9ca 100644 --- a/src/openrct2/actions/WallPlaceAction.h +++ b/src/openrct2/actions/WallPlaceAction.h @@ -13,7 +13,7 @@ #include "../ride/TrackData.h" #include "../world/Banner.h" #include "../world/Scenery.h" -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2 { diff --git a/src/openrct2/actions/WallRemoveAction.h b/src/openrct2/actions/WallRemoveAction.h index 1a233da064..62db6a1ea6 100644 --- a/src/openrct2/actions/WallRemoveAction.h +++ b/src/openrct2/actions/WallRemoveAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/WallSetColourAction.h b/src/openrct2/actions/WallSetColourAction.h index 70c9e08969..013120d349 100644 --- a/src/openrct2/actions/WallSetColourAction.h +++ b/src/openrct2/actions/WallSetColourAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/WaterLowerAction.cpp b/src/openrct2/actions/WaterLowerAction.cpp index 1d045872d7..35d7e7e9b6 100644 --- a/src/openrct2/actions/WaterLowerAction.cpp +++ b/src/openrct2/actions/WaterLowerAction.cpp @@ -15,6 +15,7 @@ #include "../ride/RideConstruction.h" #include "../world/Map.h" #include "../world/tile_element/SurfaceElement.h" +#include "GameActionRunner.h" #include "WaterSetHeightAction.h" namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/WaterLowerAction.h b/src/openrct2/actions/WaterLowerAction.h index ca9642f0bf..97cbdf6ada 100644 --- a/src/openrct2/actions/WaterLowerAction.h +++ b/src/openrct2/actions/WaterLowerAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/WaterRaiseAction.cpp b/src/openrct2/actions/WaterRaiseAction.cpp index e118e02b94..7bd58806fd 100644 --- a/src/openrct2/actions/WaterRaiseAction.cpp +++ b/src/openrct2/actions/WaterRaiseAction.cpp @@ -15,6 +15,7 @@ #include "../ride/RideConstruction.h" #include "../world/Map.h" #include "../world/tile_element/SurfaceElement.h" +#include "GameActionRunner.h" #include "WaterSetHeightAction.h" namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/WaterRaiseAction.h b/src/openrct2/actions/WaterRaiseAction.h index adc69bfaa3..229ad7f8ea 100644 --- a/src/openrct2/actions/WaterRaiseAction.h +++ b/src/openrct2/actions/WaterRaiseAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/actions/WaterSetHeightAction.h b/src/openrct2/actions/WaterSetHeightAction.h index 3b9ebc843b..3b9adcd308 100644 --- a/src/openrct2/actions/WaterSetHeightAction.h +++ b/src/openrct2/actions/WaterSetHeightAction.h @@ -9,7 +9,7 @@ #pragma once -#include "GameAction.h" +#include "GameAction.hpp" namespace OpenRCT2::GameActions { diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 2b7c72eeec..bc1cf59ea6 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -17,7 +17,7 @@ #include "../Input.h" #include "../OpenRCT2.h" #include "../SpriteIds.h" -#include "../actions/GameAction.h" +#include "../actions/GameAction.hpp" #include "../audio/Audio.h" #include "../audio/AudioChannel.h" #include "../audio/AudioMixer.h" diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 802b603966..f3e08e27c3 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -19,6 +19,7 @@ #include "../ReplayManager.h" #include "../Version.h" #include "../actions/CheatSetAction.h" +#include "../actions/GameActionRunner.h" #include "../actions/GameSetSpeedAction.h" #include "../actions/ParkSetDateAction.h" #include "../actions/ParkSetParameterAction.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index b66843a20b..6f92de93b1 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -93,8 +93,11 @@ - + + + + @@ -712,6 +715,7 @@ + diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index 610e0866ca..6456fce453 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -15,6 +15,7 @@ #include "../Game.h" #include "../GameState.h" #include "../OpenRCT2.h" +#include "../actions/GameActionRunner.h" #include "../actions/ParkSetResearchFundingAction.h" #include "../config/Config.h" #include "../core/BitSet.hpp" diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index df8c92e9ab..6c1ef8022c 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -17,6 +17,7 @@ #include "../OpenRCT2.h" #include "../PlatformEnvironment.h" #include "../Version.h" +#include "../actions/GameActionRunner.h" #include "../actions/LoadOrQuitAction.h" #include "../actions/NetworkModifyGroupAction.h" #include "../actions/PeepPickupAction.h" @@ -67,7 +68,7 @@ static constexpr uint32_t kMaxPacketsPerTick = 100; #include "../Cheats.h" #include "../ParkImporter.h" #include "../Version.h" - #include "../actions/GameAction.h" + #include "../actions/GameAction.hpp" #include "../config/Config.h" #include "../core/Console.hpp" #include "../core/EnumUtils.hpp" diff --git a/src/openrct2/network/NetworkBase.h b/src/openrct2/network/NetworkBase.h index 0abe11a2c7..c64885f4d1 100644 --- a/src/openrct2/network/NetworkBase.h +++ b/src/openrct2/network/NetworkBase.h @@ -1,7 +1,7 @@ #pragma once #include "../System.hpp" -#include "../actions/GameAction.h" +#include "../actions/GameAction.hpp" #include "../scenario/Scenario.h" #include "NetworkConnection.h" #include "NetworkGroup.h" diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 161803ebbe..2fb34468d8 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -16,6 +16,7 @@ #include "../GameState.h" #include "../Input.h" #include "../OpenRCT2.h" +#include "../actions/GameActionRunner.h" #include "../actions/ResultWithMessage.h" #include "../actions/RideSetSettingAction.h" #include "../actions/RideSetStatusAction.h" diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 329f05f069..aa568d4ddc 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -12,6 +12,7 @@ #include "../Context.h" #include "../GameState.h" #include "../Input.h" +#include "../actions/GameActionRunner.h" #include "../actions/ResultWithMessage.h" #include "../actions/RideEntranceExitRemoveAction.h" #include "../actions/RideSetSettingAction.h" diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 84ec8a9bcb..ce225f950f 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -18,6 +18,7 @@ #include "../TrackImporter.h" #include "../actions/FootpathLayoutPlaceAction.h" #include "../actions/FootpathRemoveAction.h" +#include "../actions/GameActionRunner.h" #include "../actions/LargeSceneryPlaceAction.h" #include "../actions/LargeSceneryRemoveAction.h" #include "../actions/MazePlaceTrackAction.h" diff --git a/src/openrct2/ride/Vehicle.Crash.cpp b/src/openrct2/ride/Vehicle.Crash.cpp index a45dc6f897..975fc8cd8a 100644 --- a/src/openrct2/ride/Vehicle.Crash.cpp +++ b/src/openrct2/ride/Vehicle.Crash.cpp @@ -12,6 +12,7 @@ #include "../Context.h" #include "../Diagnostic.h" #include "../GameState.h" +#include "../actions/GameActionRunner.h" #include "../actions/RideSetStatusAction.h" #include "../audio/Audio.h" #include "../config/Config.h" diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index db9c2537aa..70a0e4be6c 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -14,7 +14,7 @@ #include "../PlatformEnvironment.h" #include "../actions/BannerPlaceAction.h" #include "../actions/CustomAction.h" - #include "../actions/GameAction.h" + #include "../actions/GameAction.hpp" #include "../actions/LargeSceneryPlaceAction.h" #include "../actions/RideCreateAction.h" #include "../actions/StaffHireNewAction.h" diff --git a/src/openrct2/scripting/bindings/game/ScContext.hpp b/src/openrct2/scripting/bindings/game/ScContext.hpp index 1e4f9a2e1f..362f1ed460 100644 --- a/src/openrct2/scripting/bindings/game/ScContext.hpp +++ b/src/openrct2/scripting/bindings/game/ScContext.hpp @@ -12,7 +12,7 @@ #ifdef ENABLE_SCRIPTING #include "../../../OpenRCT2.h" - #include "../../../actions/GameAction.h" + #include "../../../actions/GameActionRunner.h" #include "../../../interface/Screenshot.h" #include "../../../localisation/Formatting.h" #include "../../../object/ObjectManager.h" diff --git a/src/openrct2/scripting/bindings/network/ScNetwork.cpp b/src/openrct2/scripting/bindings/network/ScNetwork.cpp index 67d18a44c4..a90c799719 100644 --- a/src/openrct2/scripting/bindings/network/ScNetwork.cpp +++ b/src/openrct2/scripting/bindings/network/ScNetwork.cpp @@ -13,6 +13,7 @@ #include "../../../Context.h" #include "../../../GameState.h" + #include "../../../actions/GameActionRunner.h" #include "../../../actions/NetworkModifyGroupAction.h" #include "../../../actions/PlayerKickAction.h" #include "../../../network/Network.h" diff --git a/src/openrct2/scripting/bindings/network/ScPlayer.cpp b/src/openrct2/scripting/bindings/network/ScPlayer.cpp index 0765274742..413c137707 100644 --- a/src/openrct2/scripting/bindings/network/ScPlayer.cpp +++ b/src/openrct2/scripting/bindings/network/ScPlayer.cpp @@ -13,6 +13,7 @@ #include "../../../Context.h" #include "../../../GameState.h" + #include "../../../actions/GameActionRunner.h" #include "../../../actions/PlayerSetGroupAction.h" #include "../../../network/Network.h" #include "../../../network/NetworkAction.h" diff --git a/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp b/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp index b08cb20ef8..cfc816a2ff 100644 --- a/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp +++ b/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp @@ -13,6 +13,7 @@ #include "../../../Context.h" #include "../../../GameState.h" + #include "../../../actions/GameActionRunner.h" #include "../../../actions/NetworkModifyGroupAction.h" #include "../../../actions/PlayerSetGroupAction.h" #include "../../../core/String.hpp" diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 1ad4c93fb5..a465d26a36 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -14,6 +14,7 @@ #include "../Game.h" #include "../GameState.h" #include "../OpenRCT2.h" +#include "../actions/GameActionRunner.h" #include "../actions/ParkEntranceRemoveAction.h" #include "../actions/RideEntranceExitPlaceAction.h" #include "../actions/RideEntranceExitRemoveAction.h" diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 20f726ad7c..537b06d20c 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -16,6 +16,7 @@ #include "../OpenRCT2.h" #include "../actions/FootpathPlaceAction.h" #include "../actions/FootpathRemoveAction.h" +#include "../actions/GameActionRunner.h" #include "../actions/LandSetRightsAction.h" #include "../core/Guard.hpp" #include "../entity/EntityList.h" diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index d605fa58d6..a406f53643 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -17,6 +17,7 @@ #include "../Input.h" #include "../OpenRCT2.h" #include "../actions/BannerRemoveAction.h" +#include "../actions/GameActionRunner.h" #include "../actions/LargeSceneryRemoveAction.h" #include "../actions/ParkEntranceRemoveAction.h" #include "../actions/WallRemoveAction.h" diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 04d0aa78f3..3855f6082d 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -15,6 +15,7 @@ #include "../Game.h" #include "../GameState.h" #include "../OpenRCT2.h" +#include "../actions/GameActionRunner.h" #include "../actions/ParkSetParameterAction.h" #include "../core/Memory.hpp" #include "../core/String.hpp" diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 4186c60f23..a8c1847c70 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -16,6 +16,7 @@ #include "../OpenRCT2.h" #include "../actions/BannerRemoveAction.h" #include "../actions/FootpathAdditionRemoveAction.h" +#include "../actions/GameActionRunner.h" #include "../actions/LargeSceneryRemoveAction.h" #include "../actions/SmallSceneryRemoveAction.h" #include "../actions/WallRemoveAction.h" diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 6875c5f6a7..dfab68b8cb 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -10,7 +10,7 @@ #include "TileInspector.h" #include "../Diagnostic.h" -#include "../actions/GameAction.h" +#include "../actions/GameAction.hpp" #include "../core/Guard.hpp" #include "../object/LargeSceneryEntry.h" #include "../ride/Station.h" diff --git a/test/tests/PlayTests.cpp b/test/tests/PlayTests.cpp index 330d2e2f23..e3c31dfd8d 100644 --- a/test/tests/PlayTests.cpp +++ b/test/tests/PlayTests.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include