1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-18 05:22:42 +01:00

Remove macro for registration and cleanup

This commit is contained in:
ζeh Matt
2021-11-10 15:57:44 +02:00
parent 91d6338db5
commit 96e2641d0d
89 changed files with 646 additions and 484 deletions

View File

@@ -15,7 +15,7 @@
#include <set> #include <set>
#include <string> #include <string>
struct GameAction; class GameAction;
namespace OpenRCT2 namespace OpenRCT2
{ {

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(BalloonPressAction, GameCommand::BalloonPress, GameActions::Result) class BalloonPressAction final : public GameActionBase<GameCommand::BalloonPress>
{ {
uint16_t _spriteIndex{ SPRITE_INDEX_NULL }; uint16_t _spriteIndex{ SPRITE_INDEX_NULL };

View File

@@ -16,7 +16,7 @@ struct BannerPlaceActionResult
BannerIndex bannerId = BANNER_INDEX_NULL; BannerIndex bannerId = BANNER_INDEX_NULL;
}; };
DEFINE_GAME_ACTION(BannerPlaceAction, GameCommand::PlaceBanner, GameActions::Result) class BannerPlaceAction final : public GameActionBase<GameCommand::PlaceBanner>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(BannerRemoveAction, GameCommand::RemoveBanner, GameActions::Result) class BannerRemoveAction final : public GameActionBase<GameCommand::RemoveBanner>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(BannerSetColourAction, GameCommand::SetBannerColour, GameActions::Result) class BannerSetColourAction final : public GameActionBase<GameCommand::SetBannerColour>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(BannerSetNameAction, GameCommand::SetBannerName, GameActions::Result) class BannerSetNameAction final : public GameActionBase<GameCommand::SetBannerName>
{ {
private: private:
BannerIndex _bannerIndex{ BANNER_INDEX_NULL }; BannerIndex _bannerIndex{ BANNER_INDEX_NULL };

View File

@@ -21,7 +21,7 @@ enum class BannerSetStyleType : uint8_t
Count Count
}; };
DEFINE_GAME_ACTION(BannerSetStyleAction, GameCommand::SetBannerStyle, GameActions::Result) class BannerSetStyleAction final : public GameActionBase<GameCommand::SetBannerStyle>
{ {
private: private:
BannerSetStyleType _type{ BannerSetStyleType::Count }; BannerSetStyleType _type{ BannerSetStyleType::Count };

View File

@@ -12,7 +12,7 @@
#include "../world/Map.h" #include "../world/Map.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ChangeMapSizeAction, GameCommand::ChangeMapSize, GameActions::Result) class ChangeMapSizeAction final : public GameActionBase<GameCommand::ChangeMapSize>
{ {
public: public:
ChangeMapSizeAction() = default; ChangeMapSizeAction() = default;

View File

@@ -24,7 +24,7 @@ namespace CLEARABLE_ITEMS
constexpr ClearableItems SCENERY_FOOTPATH = 1 << 2; constexpr ClearableItems SCENERY_FOOTPATH = 1 << 2;
} // namespace CLEARABLE_ITEMS } // namespace CLEARABLE_ITEMS
DEFINE_GAME_ACTION(ClearAction, GameCommand::ClearScenery, GameActions::Result) class ClearAction final : public GameActionBase<GameCommand::ClearScenery>
{ {
private: private:
MapRange _range; MapRange _range;

View File

@@ -12,7 +12,7 @@
#include "../world/Climate.h" #include "../world/Climate.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ClimateSetAction, GameCommand::SetClimate, GameActions::Result) class ClimateSetAction final : public GameActionBase<GameCommand::SetClimate>
{ {
private: private:
ClimateType _climate{}; ClimateType _climate{};

View File

@@ -13,7 +13,7 @@
# include "GameAction.h" # include "GameAction.h"
DEFINE_GAME_ACTION(CustomAction, GameCommand::Custom, GameActions::Result) class CustomAction final : public GameActionBase<GameCommand::Custom>
{ {
private: private:
std::string _id; std::string _id;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(FootpathAdditionPlaceAction, GameCommand::PlaceFootpathAddition, GameActions::Result) class FootpathAdditionPlaceAction final : public GameActionBase<GameCommand::PlaceFootpathAddition>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(FootpathAdditionRemoveAction, GameCommand::RemoveFootpathAddition, GameActions::Result) class FootpathAdditionRemoveAction final : public GameActionBase<GameCommand::RemoveFootpathAddition>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -12,7 +12,7 @@
#include "../world/Footpath.h" #include "../world/Footpath.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(FootpathPlaceAction, GameCommand::PlacePath, GameActions::Result) class FootpathPlaceAction final : public GameActionBase<GameCommand::PlacePath>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(FootpathPlaceFromTrackAction, GameCommand::PlacePathFromTrack, GameActions::Result) class FootpathPlaceFromTrackAction final : public GameActionBase<GameCommand::PlacePathFromTrack>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -12,7 +12,7 @@
#include "../management/Finance.h" #include "../management/Finance.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(FootpathRemoveAction, GameCommand::RemovePath, GameActions::Result) class FootpathRemoveAction final : public GameActionBase<GameCommand::RemovePath>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -60,31 +60,10 @@ namespace GameActions
} }
}; };
static GameActionFactory _actions[EnumValue(GameCommand::Count)];
static std::multiset<QueuedGameAction> _actionQueue; static std::multiset<QueuedGameAction> _actionQueue;
static uint32_t _nextUniqueId = 0; static uint32_t _nextUniqueId = 0;
static bool _suspended = false; static bool _suspended = false;
GameActionFactory Register(GameCommand id, GameActionFactory factory)
{
const auto idx = static_cast<size_t>(id);
Guard::Assert(idx < std::size(_actions));
Guard::ArgumentNotNull(factory);
_actions[idx] = factory;
return factory;
}
bool IsValidId(uint32_t id)
{
if (id < std::size(_actions))
{
return _actions[id] != nullptr;
}
return false;
}
void SuspendQueue() void SuspendQueue()
{ {
_suspended = true; _suspended = true;
@@ -186,31 +165,9 @@ namespace GameActions
return; return;
Register(); Register();
initialized = true; initialized = true;
} }
std::unique_ptr<GameAction> Create(GameCommand id)
{
Initialize();
const auto idx = static_cast<size_t>(id);
GameAction* result = nullptr;
if (idx < std::size(_actions))
{
GameActionFactory factory = _actions[idx];
if (factory != nullptr)
{
result = factory();
}
}
#ifdef _DEBUG
Guard::ArgumentNotNull(result, "Attempting to create unregistered gameaction: %u", id);
#endif
return std::unique_ptr<GameAction>(result);
}
GameAction::Ptr Clone(const GameAction* action) GameAction::Ptr Clone(const GameAction* action)
{ {
std::unique_ptr<GameAction> ga = GameActions::Create(action->GetType()); std::unique_ptr<GameAction> ga = GameActions::Create(action->GetType());
@@ -516,6 +473,11 @@ namespace GameActions
} }
} // namespace GameActions } // namespace GameActions
const char* GameAction::GetName() const
{
return GameActions::GetName(_type);
}
bool GameAction::LocationValid(const CoordsXY& coords) const bool GameAction::LocationValid(const CoordsXY& coords) const
{ {
auto result = map_is_location_valid(coords); auto result = map_is_location_valid(coords);

View File

@@ -92,11 +92,11 @@ public:
} }
}; };
struct GameAction class GameAction
{ {
public: public:
using Ptr = std::unique_ptr<GameAction>; using Ptr = std::unique_ptr<GameAction>;
using Callback_t = std::function<void(const struct GameAction*, const GameActions::Result*)>; using Callback_t = std::function<void(const class GameAction*, const GameActions::Result*)>;
private: private:
GameCommand const _type; GameCommand const _type;
@@ -114,7 +114,7 @@ public:
virtual ~GameAction() = default; virtual ~GameAction() = default;
virtual const char* GetName() const = 0; const char* GetName() const;
virtual void AcceptParameters(GameActionParameterVisitor&) virtual void AcceptParameters(GameActionParameterVisitor&)
{ {
@@ -235,11 +235,9 @@ template<GameCommand TId> struct GameActionNameQuery
{ {
}; };
template<GameCommand TType, typename TResultType> struct GameActionBase : GameAction template<GameCommand TType> struct GameActionBase : GameAction
{ {
public: public:
using Result = TResultType;
static constexpr GameCommand TYPE = TType; static constexpr GameCommand TYPE = TType;
GameActionBase() GameActionBase()
@@ -247,15 +245,10 @@ public:
{ {
} }
virtual const char* GetName() const override
{
return GameActionNameQuery<TType>::Name();
}
protected: protected:
template<class... TTypes> static constexpr std::unique_ptr<TResultType> MakeResult(TTypes&&... args) template<class... TTypes> static std::unique_ptr<GameActions::Result> MakeResult(TTypes&&... args)
{ {
return std::make_unique<TResultType>(std::forward<TTypes>(args)...); return std::make_unique<GameActions::Result>(std::forward<TTypes>(args)...);
} }
}; };
@@ -266,6 +259,7 @@ namespace GameActions
void Initialize(); void Initialize();
void Register(); void Register();
bool IsValidId(uint32_t id); bool IsValidId(uint32_t id);
const char* GetName(GameCommand id);
// Halts the queue processing until ResumeQueue is called, any calls to ProcessQueue // 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 // will have no effect during suspension. It has no effect of actions that will not
@@ -300,16 +294,4 @@ namespace GameActions
return factory; return factory;
} }
// clang-format off
#define DEFINE_GAME_ACTION(cls, id, res) \
template<> struct GameActionNameQuery<id> \
{ \
static const char* Name() \
{ \
return #cls; \
} \
}; \
struct cls final : public GameActionBase<id, res>
// clang-format on
} // namespace GameActions } // namespace GameActions

View File

@@ -1,181 +0,0 @@
/*****************************************************************************
* Copyright (c) 2014-2020 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 "BalloonPressAction.h"
#include "BannerPlaceAction.h"
#include "BannerRemoveAction.h"
#include "BannerSetColourAction.h"
#include "BannerSetNameAction.h"
#include "BannerSetStyleAction.h"
#include "ChangeMapSizeAction.h"
#include "ClearAction.h"
#include "ClimateSetAction.h"
#include "CustomAction.h"
#include "FootpathAdditionPlaceAction.h"
#include "FootpathAdditionRemoveAction.h"
#include "FootpathPlaceAction.h"
#include "FootpathPlaceFromTrackAction.h"
#include "FootpathRemoveAction.h"
#include "GameAction.h"
#include "GuestSetFlagsAction.h"
#include "GuestSetNameAction.h"
#include "LandBuyRightsAction.h"
#include "LandLowerAction.h"
#include "LandRaiseAction.h"
#include "LandSetHeightAction.h"
#include "LandSetRightsAction.h"
#include "LandSmoothAction.h"
#include "LargeSceneryPlaceAction.h"
#include "LargeSceneryRemoveAction.h"
#include "LargeScenerySetColourAction.h"
#include "LoadOrQuitAction.h"
#include "MazePlaceTrackAction.h"
#include "MazeSetTrackAction.h"
#include "NetworkModifyGroupAction.h"
#include "ParkEntranceRemoveAction.h"
#include "ParkMarketingAction.h"
#include "ParkSetDateAction.h"
#include "ParkSetLoanAction.h"
#include "ParkSetNameAction.h"
#include "ParkSetParameterAction.h"
#include "ParkSetResearchFundingAction.h"
#include "PauseToggleAction.h"
#include "PeepPickupAction.h"
#include "PlaceParkEntranceAction.h"
#include "PlacePeepSpawnAction.h"
#include "PlayerKickAction.h"
#include "PlayerSetGroupAction.h"
#include "RideCreateAction.h"
#include "RideDemolishAction.h"
#include "RideEntranceExitPlaceAction.h"
#include "RideEntranceExitRemoveAction.h"
#include "RideSetAppearanceAction.h"
#include "RideSetColourSchemeAction.h"
#include "RideSetNameAction.h"
#include "RideSetPriceAction.h"
#include "RideSetSettingAction.h"
#include "RideSetStatusAction.h"
#include "RideSetVehicleAction.h"
#include "ScenarioSetSettingAction.h"
#include "SetCheatAction.h"
#include "SetParkEntranceFeeAction.h"
#include "SignSetNameAction.h"
#include "SignSetStyleAction.h"
#include "SmallSceneryPlaceAction.h"
#include "SmallSceneryRemoveAction.h"
#include "SmallScenerySetColourAction.h"
#include "StaffFireAction.h"
#include "StaffHireNewAction.h"
#include "StaffSetColourAction.h"
#include "StaffSetCostumeAction.h"
#include "StaffSetNameAction.h"
#include "StaffSetOrdersAction.h"
#include "StaffSetPatrolAreaAction.h"
#include "SurfaceSetStyleAction.h"
#include "TileModifyAction.h"
#include "TrackDesignAction.h"
#include "TrackPlaceAction.h"
#include "TrackRemoveAction.h"
#include "TrackSetBrakeSpeedAction.h"
#include "WallPlaceAction.h"
#include "WallRemoveAction.h"
#include "WallSetColourAction.h"
#include "WaterLowerAction.h"
#include "WaterRaiseAction.h"
#include "WaterSetHeightAction.h"
namespace GameActions
{
void Register()
{
Register<BalloonPressAction>();
Register<BannerPlaceAction>();
Register<BannerRemoveAction>();
Register<BannerSetColourAction>();
Register<BannerSetNameAction>();
Register<BannerSetStyleAction>();
Register<ClimateSetAction>();
Register<FootpathPlaceAction>();
Register<FootpathPlaceFromTrackAction>();
Register<FootpathRemoveAction>();
Register<FootpathAdditionPlaceAction>();
Register<FootpathAdditionRemoveAction>();
Register<GuestSetNameAction>();
Register<MazePlaceTrackAction>();
Register<MazeSetTrackAction>();
Register<NetworkModifyGroupAction>();
Register<ParkMarketingAction>();
Register<ParkEntranceRemoveAction>();
Register<ParkSetLoanAction>();
Register<ParkSetNameAction>();
Register<ParkSetParameterAction>();
Register<ParkSetResearchFundingAction>();
Register<PeepPickupAction>();
Register<PlaceParkEntranceAction>();
Register<PlacePeepSpawnAction>();
Register<PlayerKickAction>();
Register<PlayerSetGroupAction>();
Register<RideCreateAction>();
Register<RideDemolishAction>();
Register<RideEntranceExitPlaceAction>();
Register<RideEntranceExitRemoveAction>();
Register<RideSetColourSchemeAction>();
Register<RideSetNameAction>();
Register<RideSetPriceAction>();
Register<RideSetStatusAction>();
Register<RideSetAppearanceAction>();
Register<RideSetVehicleAction>();
Register<RideSetSettingAction>();
Register<ScenarioSetSettingAction>();
Register<SetParkEntranceFeeAction>();
Register<SignSetNameAction>();
Register<SignSetStyleAction>();
Register<StaffFireAction>();
Register<StaffHireNewAction>();
Register<StaffSetColourAction>();
Register<StaffSetNameAction>();
Register<StaffSetOrdersAction>();
Register<StaffSetCostumeAction>();
Register<StaffSetPatrolAreaAction>();
Register<SurfaceSetStyleAction>();
Register<WallPlaceAction>();
Register<WallRemoveAction>();
Register<WallSetColourAction>();
Register<SmallSceneryPlaceAction>();
Register<SmallSceneryRemoveAction>();
Register<SmallScenerySetColourAction>();
Register<LargeSceneryPlaceAction>();
Register<LargeSceneryRemoveAction>();
Register<LargeScenerySetColourAction>();
Register<LandBuyRightsAction>();
Register<LandLowerAction>();
Register<LandRaiseAction>();
Register<LandSetHeightAction>();
Register<LandSetRightsAction>();
Register<LandSmoothAction>();
Register<TileModifyAction>();
Register<TrackDesignAction>();
Register<TrackPlaceAction>();
Register<TrackRemoveAction>();
Register<TrackSetBrakeSpeedAction>();
Register<ClearAction>();
Register<PauseToggleAction>();
Register<LoadOrQuitAction>();
Register<WaterSetHeightAction>();
Register<WaterLowerAction>();
Register<WaterRaiseAction>();
Register<GuestSetFlagsAction>();
Register<ParkSetDateAction>();
Register<SetCheatAction>();
Register<ChangeMapSizeAction>();
#ifdef ENABLE_SCRIPTING
Register<CustomAction>();
#endif
}
} // namespace GameActions

View File

@@ -0,0 +1,399 @@
/*****************************************************************************
* Copyright (c) 2014-2020 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 "BalloonPressAction.h"
#include "BannerPlaceAction.h"
#include "BannerRemoveAction.h"
#include "BannerSetColourAction.h"
#include "BannerSetNameAction.h"
#include "BannerSetStyleAction.h"
#include "ChangeMapSizeAction.h"
#include "ClearAction.h"
#include "ClimateSetAction.h"
#include "CustomAction.h"
#include "FootpathAdditionPlaceAction.h"
#include "FootpathAdditionRemoveAction.h"
#include "FootpathPlaceAction.h"
#include "FootpathPlaceFromTrackAction.h"
#include "FootpathRemoveAction.h"
#include "GameAction.h"
#include "GuestSetFlagsAction.h"
#include "GuestSetNameAction.h"
#include "LandBuyRightsAction.h"
#include "LandLowerAction.h"
#include "LandRaiseAction.h"
#include "LandSetHeightAction.h"
#include "LandSetRightsAction.h"
#include "LandSmoothAction.h"
#include "LargeSceneryPlaceAction.h"
#include "LargeSceneryRemoveAction.h"
#include "LargeScenerySetColourAction.h"
#include "LoadOrQuitAction.h"
#include "MazePlaceTrackAction.h"
#include "MazeSetTrackAction.h"
#include "NetworkModifyGroupAction.h"
#include "ParkEntranceRemoveAction.h"
#include "ParkMarketingAction.h"
#include "ParkSetDateAction.h"
#include "ParkSetLoanAction.h"
#include "ParkSetNameAction.h"
#include "ParkSetParameterAction.h"
#include "ParkSetResearchFundingAction.h"
#include "PauseToggleAction.h"
#include "PeepPickupAction.h"
#include "PlaceParkEntranceAction.h"
#include "PlacePeepSpawnAction.h"
#include "PlayerKickAction.h"
#include "PlayerSetGroupAction.h"
#include "RideCreateAction.h"
#include "RideDemolishAction.h"
#include "RideEntranceExitPlaceAction.h"
#include "RideEntranceExitRemoveAction.h"
#include "RideSetAppearanceAction.h"
#include "RideSetColourSchemeAction.h"
#include "RideSetNameAction.h"
#include "RideSetPriceAction.h"
#include "RideSetSettingAction.h"
#include "RideSetStatusAction.h"
#include "RideSetVehicleAction.h"
#include "ScenarioSetSettingAction.h"
#include "SetCheatAction.h"
#include "SetParkEntranceFeeAction.h"
#include "SignSetNameAction.h"
#include "SignSetStyleAction.h"
#include "SmallSceneryPlaceAction.h"
#include "SmallSceneryRemoveAction.h"
#include "SmallScenerySetColourAction.h"
#include "StaffFireAction.h"
#include "StaffHireNewAction.h"
#include "StaffSetColourAction.h"
#include "StaffSetCostumeAction.h"
#include "StaffSetNameAction.h"
#include "StaffSetOrdersAction.h"
#include "StaffSetPatrolAreaAction.h"
#include "SurfaceSetStyleAction.h"
#include "TileModifyAction.h"
#include "TrackDesignAction.h"
#include "TrackPlaceAction.h"
#include "TrackRemoveAction.h"
#include "TrackSetBrakeSpeedAction.h"
#include "WallPlaceAction.h"
#include "WallRemoveAction.h"
#include "WallSetColourAction.h"
#include "WaterLowerAction.h"
#include "WaterRaiseAction.h"
#include "WaterSetHeightAction.h"
namespace GameActions
{
static GameActionFactory _actions[EnumValue(GameCommand::Count)];
GameActionFactory Register(GameCommand id, GameActionFactory factory)
{
const auto idx = static_cast<size_t>(id);
Guard::Assert(idx < std::size(_actions));
Guard::ArgumentNotNull(factory);
_actions[idx] = factory;
return factory;
}
void Register()
{
Register<BalloonPressAction>();
Register<BannerPlaceAction>();
Register<BannerRemoveAction>();
Register<BannerSetColourAction>();
Register<BannerSetNameAction>();
Register<BannerSetStyleAction>();
Register<ClimateSetAction>();
Register<FootpathPlaceAction>();
Register<FootpathPlaceFromTrackAction>();
Register<FootpathRemoveAction>();
Register<FootpathAdditionPlaceAction>();
Register<FootpathAdditionRemoveAction>();
Register<GuestSetNameAction>();
Register<MazePlaceTrackAction>();
Register<MazeSetTrackAction>();
Register<NetworkModifyGroupAction>();
Register<ParkMarketingAction>();
Register<ParkEntranceRemoveAction>();
Register<ParkSetLoanAction>();
Register<ParkSetNameAction>();
Register<ParkSetParameterAction>();
Register<ParkSetResearchFundingAction>();
Register<PeepPickupAction>();
Register<PlaceParkEntranceAction>();
Register<PlacePeepSpawnAction>();
Register<PlayerKickAction>();
Register<PlayerSetGroupAction>();
Register<RideCreateAction>();
Register<RideDemolishAction>();
Register<RideEntranceExitPlaceAction>();
Register<RideEntranceExitRemoveAction>();
Register<RideSetColourSchemeAction>();
Register<RideSetNameAction>();
Register<RideSetPriceAction>();
Register<RideSetStatusAction>();
Register<RideSetAppearanceAction>();
Register<RideSetVehicleAction>();
Register<RideSetSettingAction>();
Register<ScenarioSetSettingAction>();
Register<SetParkEntranceFeeAction>();
Register<SignSetNameAction>();
Register<SignSetStyleAction>();
Register<StaffFireAction>();
Register<StaffHireNewAction>();
Register<StaffSetColourAction>();
Register<StaffSetNameAction>();
Register<StaffSetOrdersAction>();
Register<StaffSetCostumeAction>();
Register<StaffSetPatrolAreaAction>();
Register<SurfaceSetStyleAction>();
Register<WallPlaceAction>();
Register<WallRemoveAction>();
Register<WallSetColourAction>();
Register<SmallSceneryPlaceAction>();
Register<SmallSceneryRemoveAction>();
Register<SmallScenerySetColourAction>();
Register<LargeSceneryPlaceAction>();
Register<LargeSceneryRemoveAction>();
Register<LargeScenerySetColourAction>();
Register<LandBuyRightsAction>();
Register<LandLowerAction>();
Register<LandRaiseAction>();
Register<LandSetHeightAction>();
Register<LandSetRightsAction>();
Register<LandSmoothAction>();
Register<TileModifyAction>();
Register<TrackDesignAction>();
Register<TrackPlaceAction>();
Register<TrackRemoveAction>();
Register<TrackSetBrakeSpeedAction>();
Register<ClearAction>();
Register<PauseToggleAction>();
Register<LoadOrQuitAction>();
Register<WaterSetHeightAction>();
Register<WaterLowerAction>();
Register<WaterRaiseAction>();
Register<GuestSetFlagsAction>();
Register<ParkSetDateAction>();
Register<SetCheatAction>();
Register<ChangeMapSizeAction>();
#ifdef ENABLE_SCRIPTING
Register<CustomAction>();
#endif
}
const char* GetName(GameCommand id)
{
switch (id)
{
case GameCommand::SetRideAppearance:
return "SetRideAppearance";
case GameCommand::SetLandHeight:
return "SetLandHeight";
case GameCommand::TogglePause:
return "TogglePause";
case GameCommand::PlaceTrack:
return "PlaceTrack";
case GameCommand::RemoveTrack:
return "RemoveTrack";
case GameCommand::LoadOrQuit:
return "LoadOrQuit";
case GameCommand::CreateRide:
return "CreateRide";
case GameCommand::DemolishRide:
return "DemolishRide";
case GameCommand::SetRideStatus:
return "SetRideStatus";
case GameCommand::SetRideVehicles:
return "SetRideVehicles";
case GameCommand::SetRideName:
return "SetRideName";
case GameCommand::SetRideSetting:
return "SetRideSetting";
case GameCommand::PlaceRideEntranceOrExit:
return "PlaceRideEntranceOrExit";
case GameCommand::RemoveRideEntranceOrExit:
return "RemoveRideEntranceOrExit";
case GameCommand::RemoveScenery:
return "RemoveScenery";
case GameCommand::PlaceScenery:
return "PlaceScenery";
case GameCommand::SetWaterHeight:
return "SetWaterHeight";
case GameCommand::PlacePath:
return "PlacePath";
case GameCommand::PlacePathFromTrack:
return "PlacePathFromTrack";
case GameCommand::RemovePath:
return "RemovePath";
case GameCommand::ChangeSurfaceStyle:
return "ChangeSurfaceStyle";
case GameCommand::SetRidePrice:
return "SetRidePrice";
case GameCommand::SetGuestName:
return "SetGuestName";
case GameCommand::SetStaffName:
return "SetStaffName";
case GameCommand::RaiseLand:
return "RaiseLand";
case GameCommand::LowerLand:
return "LowerLand";
case GameCommand::EditLandSmooth:
return "EditLandSmooth";
case GameCommand::RaiseWater:
return "RaiseWater";
case GameCommand::LowerWater:
return "LowerWater";
case GameCommand::SetBrakesSpeed:
return "SetBrakesSpeed";
case GameCommand::HireNewStaffMember:
return "HireNewStaffMember";
case GameCommand::SetStaffPatrol:
return "SetStaffPatrol";
case GameCommand::FireStaffMember:
return "FireStaffMember";
case GameCommand::SetStaffOrders:
return "SetStaffOrders";
case GameCommand::SetParkName:
return "SetParkName";
case GameCommand::SetParkOpen:
return "SetParkOpen";
case GameCommand::BuyLandRights:
return "BuyLandRights";
case GameCommand::PlaceParkEntrance:
return "PlaceParkEntrance";
case GameCommand::RemoveParkEntrance:
return "RemoveParkEntrance";
case GameCommand::SetMazeTrack:
return "SetMazeTrack";
case GameCommand::SetParkEntranceFee:
return "SetParkEntranceFee";
case GameCommand::SetStaffColour:
return "SetStaffColour";
case GameCommand::PlaceWall:
return "PlaceWall";
case GameCommand::RemoveWall:
return "RemoveWall";
case GameCommand::PlaceLargeScenery:
return "PlaceLargeScenery";
case GameCommand::RemoveLargeScenery:
return "RemoveLargeScenery";
case GameCommand::SetCurrentLoan:
return "SetCurrentLoan";
case GameCommand::SetResearchFunding:
return "SetResearchFunding";
case GameCommand::PlaceTrackDesign:
return "PlaceTrackDesign";
case GameCommand::StartMarketingCampaign:
return "StartMarketingCampaign";
case GameCommand::PlaceMazeDesign:
return "PlaceMazeDesign";
case GameCommand::PlaceBanner:
return "PlaceBanner";
case GameCommand::RemoveBanner:
return "RemoveBanner";
case GameCommand::SetSceneryColour:
return "SetSceneryColour";
case GameCommand::SetWallColour:
return "SetWallColour";
case GameCommand::SetLargeSceneryColour:
return "SetLargeSceneryColour";
case GameCommand::SetBannerColour:
return "SetBannerColour";
case GameCommand::SetLandOwnership:
return "SetLandOwnership";
case GameCommand::ClearScenery:
return "ClearScenery";
case GameCommand::SetBannerName:
return "SetBannerName";
case GameCommand::SetSignName:
return "SetSignName";
case GameCommand::SetBannerStyle:
return "SetBannerStyle";
case GameCommand::SetSignStyle:
return "SetSignStyle";
case GameCommand::SetPlayerGroup:
return "SetPlayerGroup";
case GameCommand::ModifyGroups:
return "ModifyGroups";
case GameCommand::KickPlayer:
return "KickPlayer";
case GameCommand::Cheat:
return "Cheat";
case GameCommand::PickupGuest:
return "PickupGuest";
case GameCommand::PickupStaff:
return "PickupStaff";
case GameCommand::BalloonPress:
return "BalloonPress";
case GameCommand::ModifyTile:
return "ModifyTile";
case GameCommand::EditScenarioOptions:
return "EditScenarioOptions";
case GameCommand::PlacePeepSpawn:
return "PlacePeepSpawn";
case GameCommand::SetClimate:
return "SetClimate";
case GameCommand::SetColourScheme:
return "SetColourScheme";
case GameCommand::SetStaffCostume:
return "SetStaffCostume";
case GameCommand::PlaceFootpathAddition:
return "PlaceFootpathAddition";
case GameCommand::RemoveFootpathAddition:
return "RemoveFootpathAddition";
case GameCommand::GuestSetFlags:
return "GuestSetFlags";
case GameCommand::SetDate:
return "SetDate";
case GameCommand::Custom:
return "Custom";
case GameCommand::ChangeMapSize:
return "ChangeMapSize";
default:
break;
}
return "<error>";
}
std::unique_ptr<GameAction> Create(GameCommand id)
{
Initialize();
const auto idx = static_cast<size_t>(id);
GameAction* result = nullptr;
if (idx < std::size(_actions))
{
GameActionFactory factory = _actions[idx];
if (factory != nullptr)
{
result = factory();
}
}
#ifdef _DEBUG
Guard::ArgumentNotNull(result, "Attempting to create unregistered gameaction: %u", id);
#endif
return std::unique_ptr<GameAction>(result);
}
bool IsValidId(uint32_t id)
{
if (id < std::size(_actions))
{
return _actions[id] != nullptr;
}
return false;
}
} // namespace GameActions

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(GuestSetFlagsAction, GameCommand::GuestSetFlags, GameActions::Result) class GuestSetFlagsAction final : public GameActionBase<GameCommand::GuestSetFlags>
{ {
private: private:
uint16_t _peepId{ SPRITE_INDEX_NULL }; uint16_t _peepId{ SPRITE_INDEX_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(GuestSetNameAction, GameCommand::SetGuestName, GameActions::Result) class GuestSetNameAction final : public GameActionBase<GameCommand::SetGuestName>
{ {
private: private:
uint16_t _spriteIndex{ SPRITE_INDEX_NULL }; uint16_t _spriteIndex{ SPRITE_INDEX_NULL };

View File

@@ -18,7 +18,7 @@ enum class LandBuyRightSetting : uint8_t
Count Count
}; };
DEFINE_GAME_ACTION(LandBuyRightsAction, GameCommand::BuyLandRights, GameActions::Result) class LandBuyRightsAction final : public GameActionBase<GameCommand::BuyLandRights>
{ {
private: private:
MapRange _range; MapRange _range;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(LandLowerAction, GameCommand::LowerLand, GameActions::Result) class LandLowerAction final : public GameActionBase<GameCommand::LowerLand>
{ {
private: private:
CoordsXY _coords; CoordsXY _coords;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(LandRaiseAction, GameCommand::RaiseLand, GameActions::Result) class LandRaiseAction final : public GameActionBase<GameCommand::RaiseLand>
{ {
private: private:
CoordsXY _coords; CoordsXY _coords;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(LandSetHeightAction, GameCommand::SetLandHeight, GameActions::Result) class LandSetHeightAction final : public GameActionBase<GameCommand::SetLandHeight>
{ {
private: private:
CoordsXY _coords; CoordsXY _coords;

View File

@@ -21,7 +21,7 @@ enum class LandSetRightSetting : uint8_t
Count Count
}; };
DEFINE_GAME_ACTION(LandSetRightsAction, GameCommand::SetLandOwnership, GameActions::Result) class LandSetRightsAction final : public GameActionBase<GameCommand::SetLandOwnership>
{ {
private: private:
MapRange _range; MapRange _range;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(LandSmoothAction, GameCommand::EditLandSmooth, GameActions::Result) class LandSmoothAction final : public GameActionBase<GameCommand::EditLandSmooth>
{ {
private: private:
CoordsXY _coords; CoordsXY _coords;

View File

@@ -20,7 +20,7 @@ struct LargeSceneryPlaceActionResult
BannerIndex bannerId = BANNER_INDEX_NULL; BannerIndex bannerId = BANNER_INDEX_NULL;
}; };
DEFINE_GAME_ACTION(LargeSceneryPlaceAction, GameCommand::PlaceLargeScenery, GameActions::Result) class LargeSceneryPlaceAction final : public GameActionBase<GameCommand::PlaceLargeScenery>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(LargeSceneryRemoveAction, GameCommand::RemoveLargeScenery, GameActions::Result) class LargeSceneryRemoveAction final : public GameActionBase<GameCommand::RemoveLargeScenery>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(LargeScenerySetColourAction, GameCommand::SetLargeSceneryColour, GameActions::Result) class LargeScenerySetColourAction final : public GameActionBase<GameCommand::SetLargeSceneryColour>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -17,7 +17,7 @@ enum class LoadOrQuitModes : uint8_t
CloseSavePrompt CloseSavePrompt
}; };
DEFINE_GAME_ACTION(LoadOrQuitAction, GameCommand::LoadOrQuit, GameActions::Result) class LoadOrQuitAction final : public GameActionBase<GameCommand::LoadOrQuit>
{ {
private: private:
LoadOrQuitModes _mode{}; LoadOrQuitModes _mode{};

View File

@@ -10,7 +10,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(MazePlaceTrackAction, GameCommand::PlaceMazeDesign, GameActions::Result) class MazePlaceTrackAction final : public GameActionBase<GameCommand::PlaceMazeDesign>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -37,7 +37,7 @@ static constexpr const uint8_t byte_993D0C[] = {
}; };
// clang-format on // clang-format on
DEFINE_GAME_ACTION(MazeSetTrackAction, GameCommand::SetMazeTrack, GameActions::Result) class MazeSetTrackAction final : public GameActionBase<GameCommand::SetMazeTrack>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -29,7 +29,7 @@ enum class PermissionState : uint8_t
Count Count
}; };
DEFINE_GAME_ACTION(NetworkModifyGroupAction, GameCommand::ModifyGroups, GameActions::Result) class NetworkModifyGroupAction final : public GameActionBase<GameCommand::ModifyGroups>
{ {
private: private:
ModifyGroupType _type{ ModifyGroupType::Count }; ModifyGroupType _type{ ModifyGroupType::Count };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ParkEntranceRemoveAction, GameCommand::RemoveParkEntrance, GameActions::Result) class ParkEntranceRemoveAction final : public GameActionBase<GameCommand::RemoveParkEntrance>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ParkMarketingAction, GameCommand::StartMarketingCampaign, GameActions::Result) class ParkMarketingAction final : public GameActionBase<GameCommand::StartMarketingCampaign>
{ {
private: private:
int32_t _type{}; int32_t _type{};

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ParkSetDateAction, GameCommand::SetDate, GameActions::Result) class ParkSetDateAction final : public GameActionBase<GameCommand::SetDate>
{ {
private: private:
int32_t _year{}; int32_t _year{};

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ParkSetLoanAction, GameCommand::SetCurrentLoan, GameActions::Result) class ParkSetLoanAction final : public GameActionBase<GameCommand::SetCurrentLoan>
{ {
private: private:
money32 _value{ MONEY32_UNDEFINED }; money32 _value{ MONEY32_UNDEFINED };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ParkSetNameAction, GameCommand::SetParkName, GameActions::Result) class ParkSetNameAction final : public GameActionBase<GameCommand::SetParkName>
{ {
private: private:
std::string _name; std::string _name;

View File

@@ -19,7 +19,7 @@ enum class ParkParameter : uint8_t
Count Count
}; };
DEFINE_GAME_ACTION(ParkSetParameterAction, GameCommand::SetParkOpen, GameActions::Result) class ParkSetParameterAction final : public GameActionBase<GameCommand::SetParkOpen>
{ {
private: private:
ParkParameter _parameter{ ParkParameter::Count }; ParkParameter _parameter{ ParkParameter::Count };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(ParkSetResearchFundingAction, GameCommand::SetResearchFunding, GameActions::Result) class ParkSetResearchFundingAction final : public GameActionBase<GameCommand::SetResearchFunding>
{ {
private: private:
// TODO change to std::optional when C++17 // TODO change to std::optional when C++17

View File

@@ -13,7 +13,7 @@
// Clang format is broken for small game actions // Clang format is broken for small game actions
// clang-format off // clang-format off
DEFINE_GAME_ACTION(PauseToggleAction, GameCommand::TogglePause, GameActions::Result) class PauseToggleAction final : public GameActionBase<GameCommand::TogglePause>
{ {
public: public:
PauseToggleAction() = default; PauseToggleAction() = default;

View File

@@ -19,7 +19,7 @@ enum class PeepPickupType : uint8_t
Count Count
}; };
DEFINE_GAME_ACTION(PeepPickupAction, GameCommand::PickupGuest, GameActions::Result) class PeepPickupAction final : public GameActionBase<GameCommand::PickupGuest>
{ {
private: private:
PeepPickupType _type{ PeepPickupType::Count }; PeepPickupType _type{ PeepPickupType::Count };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(PlaceParkEntranceAction, GameCommand::PlaceParkEntrance, GameActions::Result) class PlaceParkEntranceAction final : public GameActionBase<GameCommand::PlaceParkEntrance>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(PlacePeepSpawnAction, GameCommand::PlacePeepSpawn, GameActions::Result) class PlacePeepSpawnAction final : public GameActionBase<GameCommand::PlacePeepSpawn>
{ {
private: private:
CoordsXYZD _location; CoordsXYZD _location;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(PlayerKickAction, GameCommand::KickPlayer, GameActions::Result) class PlayerKickAction final : public GameActionBase<GameCommand::KickPlayer>
{ {
private: private:
NetworkPlayerId_t _playerId{ -1 }; NetworkPlayerId_t _playerId{ -1 };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(PlayerSetGroupAction, GameCommand::SetPlayerGroup, GameActions::Result) class PlayerSetGroupAction final : public GameActionBase<GameCommand::SetPlayerGroup>
{ {
private: private:
NetworkPlayerId_t _playerId{ -1 }; NetworkPlayerId_t _playerId{ -1 };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideCreateAction, GameCommand::CreateRide, GameActions::Result) class RideCreateAction final : public GameActionBase<GameCommand::CreateRide>
{ {
private: private:
ObjectEntryIndex _rideType{ OBJECT_ENTRY_INDEX_NULL }; ObjectEntryIndex _rideType{ OBJECT_ENTRY_INDEX_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideDemolishAction, GameCommand::DemolishRide, GameActions::Result) class RideDemolishAction final : public GameActionBase<GameCommand::DemolishRide>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -12,7 +12,7 @@
#include "../world/Entrance.h" #include "../world/Entrance.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideEntranceExitPlaceAction, GameCommand::PlaceRideEntranceOrExit, GameActions::Result) class RideEntranceExitPlaceAction final : public GameActionBase<GameCommand::PlaceRideEntranceOrExit>
{ {
private: private:
CoordsXY _loc; CoordsXY _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideEntranceExitRemoveAction, GameCommand::RemoveRideEntranceOrExit, GameActions::Result) class RideEntranceExitRemoveAction final : public GameActionBase<GameCommand::RemoveRideEntranceOrExit>
{ {
private: private:
CoordsXY _loc; CoordsXY _loc;

View File

@@ -24,7 +24,7 @@ enum class RideSetAppearanceType : uint8_t
EntranceStyle EntranceStyle
}; };
DEFINE_GAME_ACTION(RideSetAppearanceAction, GameCommand::SetRideAppearance, GameActions::Result) class RideSetAppearanceAction final : public GameActionBase<GameCommand::SetRideAppearance>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideSetColourSchemeAction, GameCommand::SetColourScheme, GameActions::Result) class RideSetColourSchemeAction final : public GameActionBase<GameCommand::SetColourScheme>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideSetNameAction, GameCommand::SetRideName, GameActions::Result) class RideSetNameAction final : public GameActionBase<GameCommand::SetRideName>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideSetPriceAction, GameCommand::SetRidePrice, GameActions::Result) class RideSetPriceAction final : public GameActionBase<GameCommand::SetRidePrice>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -26,7 +26,7 @@ enum class RideSetSetting : uint8_t
RideType, RideType,
}; };
DEFINE_GAME_ACTION(RideSetSettingAction, GameCommand::SetRideSetting, GameActions::Result) class RideSetSettingAction final : public GameActionBase<GameCommand::SetRideSetting>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(RideSetStatusAction, GameCommand::SetRideStatus, GameActions::Result) class RideSetStatusAction final : public GameActionBase<GameCommand::SetRideStatus>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -19,7 +19,7 @@ enum class RideSetVehicleType : uint8_t
Count, Count,
}; };
DEFINE_GAME_ACTION(RideSetVehicleAction, GameCommand::SetRideVehicles, GameActions::Result) class RideSetVehicleAction final : public GameActionBase<GameCommand::SetRideVehicles>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -38,7 +38,7 @@ enum class ScenarioSetSetting : uint8_t
Count Count
}; };
DEFINE_GAME_ACTION(ScenarioSetSettingAction, GameCommand::EditScenarioOptions, GameActions::Result) class ScenarioSetSettingAction final : public GameActionBase<GameCommand::EditScenarioOptions>
{ {
private: private:
ScenarioSetSetting _setting{ ScenarioSetSetting::Count }; ScenarioSetSetting _setting{ ScenarioSetSetting::Count };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(SetCheatAction, GameCommand::Cheat, GameActions::Result) class SetCheatAction final : public GameActionBase<GameCommand::Cheat>
{ {
using ParametersRange = std::pair<std::pair<int32_t, int32_t>, std::pair<int32_t, int32_t>>; using ParametersRange = std::pair<std::pair<int32_t, int32_t>, std::pair<int32_t, int32_t>>;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(SetParkEntranceFeeAction, GameCommand::SetParkEntranceFee, GameActions::Result) class SetParkEntranceFeeAction final : public GameActionBase<GameCommand::SetParkEntranceFee>
{ {
private: private:
money16 _fee{ MONEY16_UNDEFINED }; money16 _fee{ MONEY16_UNDEFINED };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(SignSetNameAction, GameCommand::SetSignName, GameActions::Result) class SignSetNameAction final : public GameActionBase<GameCommand::SetSignName>
{ {
private: private:
BannerIndex _bannerIndex{ BANNER_INDEX_NULL }; BannerIndex _bannerIndex{ BANNER_INDEX_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(SignSetStyleAction, GameCommand::SetSignStyle, GameActions::Result) class SignSetStyleAction final : public GameActionBase<GameCommand::SetSignStyle>
{ {
private: private:
BannerIndex _bannerIndex{ BANNER_INDEX_NULL }; BannerIndex _bannerIndex{ BANNER_INDEX_NULL };

View File

@@ -19,7 +19,7 @@ struct SmallSceneryPlaceActionResult
uint8_t SceneryQuadrant{}; uint8_t SceneryQuadrant{};
}; };
DEFINE_GAME_ACTION(SmallSceneryPlaceAction, GameCommand::PlaceScenery, GameActions::Result) class SmallSceneryPlaceAction final : public GameActionBase<GameCommand::PlaceScenery>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -12,7 +12,7 @@
#include "../world/TileElement.h" #include "../world/TileElement.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(SmallSceneryRemoveAction, GameCommand::RemoveScenery, GameActions::Result) class SmallSceneryRemoveAction final : public GameActionBase<GameCommand::RemoveScenery>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(SmallScenerySetColourAction, GameCommand::SetSceneryColour, GameActions::Result) class SmallScenerySetColourAction final : public GameActionBase<GameCommand::SetSceneryColour>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(StaffFireAction, GameCommand::FireStaffMember, GameActions::Result) class StaffFireAction final : public GameActionBase<GameCommand::FireStaffMember>
{ {
private: private:
uint16_t _spriteId{ SPRITE_INDEX_NULL }; uint16_t _spriteId{ SPRITE_INDEX_NULL };

View File

@@ -17,7 +17,7 @@ struct StaffHireNewActionResult
uint16_t StaffEntityId = SPRITE_INDEX_NULL; uint16_t StaffEntityId = SPRITE_INDEX_NULL;
}; };
DEFINE_GAME_ACTION(StaffHireNewAction, GameCommand::HireNewStaffMember, GameActions::Result) class StaffHireNewAction final : public GameActionBase<GameCommand::HireNewStaffMember>
{ {
private: private:
bool _autoPosition{}; bool _autoPosition{};

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(StaffSetColourAction, GameCommand::SetStaffColour, GameActions::Result) class StaffSetColourAction final : public GameActionBase<GameCommand::SetStaffColour>
{ {
private: private:
uint8_t _staffType{}; uint8_t _staffType{};

View File

@@ -12,7 +12,7 @@
#include "../peep/Staff.h" #include "../peep/Staff.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(StaffSetCostumeAction, GameCommand::SetStaffCostume, GameActions::Result) class StaffSetCostumeAction final : public GameActionBase<GameCommand::SetStaffCostume>
{ {
private: private:
uint16_t _spriteIndex{ SPRITE_INDEX_NULL }; uint16_t _spriteIndex{ SPRITE_INDEX_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(StaffSetNameAction, GameCommand::SetStaffName, GameActions::Result) class StaffSetNameAction final : public GameActionBase<GameCommand::SetStaffName>
{ {
private: private:
uint16_t _spriteIndex{ SPRITE_INDEX_NULL }; uint16_t _spriteIndex{ SPRITE_INDEX_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(StaffSetOrdersAction, GameCommand::SetStaffOrders, GameActions::Result) class StaffSetOrdersAction final : public GameActionBase<GameCommand::SetStaffOrders>
{ {
private: private:
uint16_t _spriteIndex{ SPRITE_INDEX_NULL }; uint16_t _spriteIndex{ SPRITE_INDEX_NULL };

View File

@@ -18,7 +18,7 @@ enum class StaffSetPatrolAreaMode : uint8_t
ClearAll ClearAll
}; };
DEFINE_GAME_ACTION(StaffSetPatrolAreaAction, GameCommand::SetStaffPatrol, GameActions::Result) class StaffSetPatrolAreaAction final : public GameActionBase<GameCommand::SetStaffPatrol>
{ {
private: private:
uint16_t _spriteId{ SPRITE_INDEX_NULL }; uint16_t _spriteId{ SPRITE_INDEX_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(SurfaceSetStyleAction, GameCommand::ChangeSurfaceStyle, GameActions::Result) class SurfaceSetStyleAction final : public GameActionBase<GameCommand::ChangeSurfaceStyle>
{ {
private: private:
MapRange _range; MapRange _range;

View File

@@ -41,7 +41,7 @@ enum class TileModifyType : uint8_t
Count, Count,
}; };
DEFINE_GAME_ACTION(TileModifyAction, GameCommand::ModifyTile, GameActions::Result) class TileModifyAction final : public GameActionBase<GameCommand::ModifyTile>
{ {
private: private:
CoordsXY _loc; CoordsXY _loc;

View File

@@ -12,7 +12,7 @@
#include "../ride/TrackDesign.h" #include "../ride/TrackDesign.h"
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(TrackDesignAction, GameCommand::PlaceTrackDesign, GameActions::Result) class TrackDesignAction final : public GameActionBase<GameCommand::PlaceTrackDesign>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -16,7 +16,7 @@ struct TrackPlaceActionResult
uint8_t GroundFlags{ 0 }; uint8_t GroundFlags{ 0 };
}; };
DEFINE_GAME_ACTION(TrackPlaceAction, GameCommand::PlaceTrack, GameActions::Result) class TrackPlaceAction final : public GameActionBase<GameCommand::PlaceTrack>
{ {
private: private:
NetworkRideId_t _rideIndex{ RIDE_ID_NULL }; NetworkRideId_t _rideIndex{ RIDE_ID_NULL };

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(TrackRemoveAction, GameCommand::RemoveTrack, GameActions::Result) class TrackRemoveAction final : public GameActionBase<GameCommand::RemoveTrack>
{ {
private: private:
track_type_t _trackType{}; track_type_t _trackType{};

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(TrackSetBrakeSpeedAction, GameCommand::SetBrakesSpeed, GameActions::Result) class TrackSetBrakeSpeedAction final : public GameActionBase<GameCommand::SetBrakesSpeed>
{ {
private: private:
CoordsXYZ _loc; CoordsXYZ _loc;

View File

@@ -21,7 +21,7 @@ struct WallPlaceActionResult
BannerIndex BannerId = BANNER_INDEX_NULL; BannerIndex BannerId = BANNER_INDEX_NULL;
}; };
DEFINE_GAME_ACTION(WallPlaceAction, GameCommand::PlaceWall, GameActions::Result) class WallPlaceAction final : public GameActionBase<GameCommand::PlaceWall>
{ {
private: private:
ObjectEntryIndex _wallType{ OBJECT_ENTRY_INDEX_NULL }; ObjectEntryIndex _wallType{ OBJECT_ENTRY_INDEX_NULL };
@@ -50,8 +50,8 @@ private:
* *
* rct2: 0x006E5CBA * rct2: 0x006E5CBA
*/ */
bool WallCheckObstructionWithTrack(WallSceneryEntry * wall, int32_t z0, TrackElement * trackElement, bool* wallAcrossTrack) bool WallCheckObstructionWithTrack(
const; WallSceneryEntry* wall, int32_t z0, TrackElement* trackElement, bool* wallAcrossTrack) const;
/** /**
* *
* rct2: 0x006E5C1A * rct2: 0x006E5C1A

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(WallRemoveAction, GameCommand::RemoveWall, GameActions::Result) class WallRemoveAction final : public GameActionBase<GameCommand::RemoveWall>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(WallSetColourAction, GameCommand::SetWallColour, GameActions::Result) class WallSetColourAction final : public GameActionBase<GameCommand::SetWallColour>
{ {
private: private:
CoordsXYZD _loc; CoordsXYZD _loc;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(WaterLowerAction, GameCommand::LowerWater, GameActions::Result) class WaterLowerAction final : public GameActionBase<GameCommand::LowerWater>
{ {
private: private:
MapRange _range; MapRange _range;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(WaterRaiseAction, GameCommand::RaiseWater, GameActions::Result) class WaterRaiseAction final : public GameActionBase<GameCommand::RaiseWater>
{ {
private: private:
MapRange _range; MapRange _range;

View File

@@ -11,7 +11,7 @@
#include "GameAction.h" #include "GameAction.h"
DEFINE_GAME_ACTION(WaterSetHeightAction, GameCommand::SetWaterHeight, GameActions::Result) class WaterSetHeightAction final : public GameActionBase<GameCommand::SetWaterHeight>
{ {
private: private:
CoordsXY _coords; CoordsXY _coords;

View File

@@ -521,7 +521,7 @@
<ClCompile Include="actions\FootpathRemoveAction.cpp" /> <ClCompile Include="actions\FootpathRemoveAction.cpp" />
<ClCompile Include="actions\GameAction.cpp" /> <ClCompile Include="actions\GameAction.cpp" />
<ClCompile Include="actions\GameActionCompat.cpp" /> <ClCompile Include="actions\GameActionCompat.cpp" />
<ClCompile Include="actions\GameActionRegistration.cpp" /> <ClCompile Include="actions\GameActionRegistry.cpp" />
<ClCompile Include="actions\GameActionResult.cpp" /> <ClCompile Include="actions\GameActionResult.cpp" />
<ClCompile Include="actions\GuestSetFlagsAction.cpp" /> <ClCompile Include="actions\GuestSetFlagsAction.cpp" />
<ClCompile Include="actions\GuestSetNameAction.cpp" /> <ClCompile Include="actions\GuestSetNameAction.cpp" />

View File

@@ -25,7 +25,7 @@
#include <string_view> #include <string_view>
#include <vector> #include <vector>
struct GameAction; class GameAction;
struct Peep; struct Peep;
struct CoordsXYZ; struct CoordsXYZ;
namespace GameActions namespace GameActions

View File

@@ -31,7 +31,7 @@
struct duk_hthread; struct duk_hthread;
typedef struct duk_hthread duk_context; typedef struct duk_hthread duk_context;
struct GameAction; class GameAction;
namespace GameActions namespace GameActions
{ {
class Result; class Result;