mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Merge pull request #15886 from ZehMatt/refactor/gameaction-setcallback2
Refactor out DEFINE_GAME_ACTION
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
struct GameAction;
|
||||
class GameAction;
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BalloonPressAction, GameCommand::BalloonPress, GameActions::Result)
|
||||
class BalloonPressAction final : public GameActionBase<GameCommand::BalloonPress>
|
||||
{
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ struct BannerPlaceActionResult
|
||||
BannerIndex bannerId = BANNER_INDEX_NULL;
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(BannerPlaceAction, GameCommand::PlaceBanner, GameActions::Result)
|
||||
class BannerPlaceAction final : public GameActionBase<GameCommand::PlaceBanner>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BannerRemoveAction, GameCommand::RemoveBanner, GameActions::Result)
|
||||
class BannerRemoveAction final : public GameActionBase<GameCommand::RemoveBanner>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BannerSetColourAction, GameCommand::SetBannerColour, GameActions::Result)
|
||||
class BannerSetColourAction final : public GameActionBase<GameCommand::SetBannerColour>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BannerSetNameAction, GameCommand::SetBannerName, GameActions::Result)
|
||||
class BannerSetNameAction final : public GameActionBase<GameCommand::SetBannerName>
|
||||
{
|
||||
private:
|
||||
BannerIndex _bannerIndex{ BANNER_INDEX_NULL };
|
||||
|
||||
@@ -21,7 +21,7 @@ enum class BannerSetStyleType : uint8_t
|
||||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(BannerSetStyleAction, GameCommand::SetBannerStyle, GameActions::Result)
|
||||
class BannerSetStyleAction final : public GameActionBase<GameCommand::SetBannerStyle>
|
||||
{
|
||||
private:
|
||||
BannerSetStyleType _type{ BannerSetStyleType::Count };
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../world/Map.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ChangeMapSizeAction, GameCommand::ChangeMapSize, GameActions::Result)
|
||||
class ChangeMapSizeAction final : public GameActionBase<GameCommand::ChangeMapSize>
|
||||
{
|
||||
public:
|
||||
ChangeMapSizeAction() = default;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CLEARABLE_ITEMS
|
||||
constexpr ClearableItems SCENERY_FOOTPATH = 1 << 2;
|
||||
} // namespace CLEARABLE_ITEMS
|
||||
|
||||
DEFINE_GAME_ACTION(ClearAction, GameCommand::ClearScenery, GameActions::Result)
|
||||
class ClearAction final : public GameActionBase<GameCommand::ClearScenery>
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../world/Climate.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ClimateSetAction, GameCommand::SetClimate, GameActions::Result)
|
||||
class ClimateSetAction final : public GameActionBase<GameCommand::SetClimate>
|
||||
{
|
||||
private:
|
||||
ClimateType _climate{};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
# include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(CustomAction, GameCommand::Custom, GameActions::Result)
|
||||
class CustomAction final : public GameActionBase<GameCommand::Custom>
|
||||
{
|
||||
private:
|
||||
std::string _id;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathAdditionPlaceAction, GameCommand::PlaceFootpathAddition, GameActions::Result)
|
||||
class FootpathAdditionPlaceAction final : public GameActionBase<GameCommand::PlaceFootpathAddition>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathAdditionRemoveAction, GameCommand::RemoveFootpathAddition, GameActions::Result)
|
||||
class FootpathAdditionRemoveAction final : public GameActionBase<GameCommand::RemoveFootpathAddition>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../world/Footpath.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathPlaceAction, GameCommand::PlacePath, GameActions::Result)
|
||||
class FootpathPlaceAction final : public GameActionBase<GameCommand::PlacePath>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathPlaceFromTrackAction, GameCommand::PlacePathFromTrack, GameActions::Result)
|
||||
class FootpathPlaceFromTrackAction final : public GameActionBase<GameCommand::PlacePathFromTrack>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../management/Finance.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathRemoveAction, GameCommand::RemovePath, GameActions::Result)
|
||||
class FootpathRemoveAction final : public GameActionBase<GameCommand::RemovePath>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -60,31 +60,10 @@ namespace GameActions
|
||||
}
|
||||
};
|
||||
|
||||
static GameActionFactory _actions[EnumValue(GameCommand::Count)];
|
||||
static std::multiset<QueuedGameAction> _actionQueue;
|
||||
static uint32_t _nextUniqueId = 0;
|
||||
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()
|
||||
{
|
||||
_suspended = true;
|
||||
@@ -179,38 +158,6 @@ namespace GameActions
|
||||
_actionQueue.clear();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
static bool initialized = false;
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
Register();
|
||||
|
||||
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)
|
||||
{
|
||||
std::unique_ptr<GameAction> ga = GameActions::Create(action->GetType());
|
||||
@@ -516,6 +463,11 @@ namespace GameActions
|
||||
}
|
||||
} // namespace GameActions
|
||||
|
||||
const char* GameAction::GetName() const
|
||||
{
|
||||
return GameActions::GetName(_type);
|
||||
}
|
||||
|
||||
bool GameAction::LocationValid(const CoordsXY& coords) const
|
||||
{
|
||||
auto result = map_is_location_valid(coords);
|
||||
|
||||
@@ -92,11 +92,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct GameAction
|
||||
class GameAction
|
||||
{
|
||||
public:
|
||||
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:
|
||||
GameCommand const _type;
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
virtual ~GameAction() = default;
|
||||
|
||||
virtual const char* GetName() const = 0;
|
||||
const char* GetName() const;
|
||||
|
||||
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:
|
||||
using Result = TResultType;
|
||||
|
||||
static constexpr GameCommand TYPE = TType;
|
||||
|
||||
GameActionBase()
|
||||
@@ -247,15 +245,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char* GetName() const override
|
||||
{
|
||||
return GameActionNameQuery<TType>::Name();
|
||||
}
|
||||
|
||||
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)...);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -263,9 +256,8 @@ namespace GameActions
|
||||
{
|
||||
using GameActionFactory = GameAction* (*)();
|
||||
|
||||
void Initialize();
|
||||
void Register();
|
||||
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
|
||||
@@ -291,25 +283,4 @@ namespace GameActions
|
||||
GameActions::Result::Ptr QueryNested(const GameAction* action);
|
||||
GameActions::Result::Ptr ExecuteNested(const GameAction* action);
|
||||
|
||||
GameActionFactory Register(GameCommand id, GameActionFactory action);
|
||||
|
||||
template<typename T> static GameActionFactory Register()
|
||||
{
|
||||
GameActionFactory factory = []() -> GameAction* { return new T(); };
|
||||
Register(T::TYPE, 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
|
||||
|
||||
@@ -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
|
||||
252
src/openrct2/actions/GameActionRegistry.cpp
Normal file
252
src/openrct2/actions/GameActionRegistry.cpp
Normal file
@@ -0,0 +1,252 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2021 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"
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace GameActions
|
||||
{
|
||||
struct GameActionEntry
|
||||
{
|
||||
GameActionFactory factory{};
|
||||
const char* name{};
|
||||
};
|
||||
|
||||
using GameActionRegistry = std::array<GameActionEntry, EnumValue(GameCommand::Count)>;
|
||||
|
||||
template<GameCommand TId>
|
||||
static constexpr void Register(GameActionRegistry& registry, GameActionFactory factory, const char* name)
|
||||
{
|
||||
constexpr auto idx = static_cast<size_t>(TId);
|
||||
|
||||
static_assert(idx < EnumValue(GameCommand::Count));
|
||||
|
||||
registry[idx] = { factory, name };
|
||||
}
|
||||
|
||||
template<typename T> static constexpr void Register(GameActionRegistry& registry, const char* name)
|
||||
{
|
||||
GameActionFactory factory = []() -> GameAction* { return new T(); };
|
||||
Register<T::TYPE>(registry, factory, name);
|
||||
}
|
||||
|
||||
static constexpr GameActionRegistry BuildRegistry()
|
||||
{
|
||||
GameActionRegistry registry{};
|
||||
|
||||
#define REGISTER_ACTION(type) Register<type>(registry, #type)
|
||||
|
||||
REGISTER_ACTION(BalloonPressAction);
|
||||
REGISTER_ACTION(BannerPlaceAction);
|
||||
REGISTER_ACTION(BannerRemoveAction);
|
||||
REGISTER_ACTION(BannerSetColourAction);
|
||||
REGISTER_ACTION(BannerSetNameAction);
|
||||
REGISTER_ACTION(BannerSetStyleAction);
|
||||
REGISTER_ACTION(ClimateSetAction);
|
||||
REGISTER_ACTION(FootpathPlaceAction);
|
||||
REGISTER_ACTION(FootpathPlaceFromTrackAction);
|
||||
REGISTER_ACTION(FootpathRemoveAction);
|
||||
REGISTER_ACTION(FootpathAdditionPlaceAction);
|
||||
REGISTER_ACTION(FootpathAdditionRemoveAction);
|
||||
REGISTER_ACTION(GuestSetNameAction);
|
||||
REGISTER_ACTION(MazePlaceTrackAction);
|
||||
REGISTER_ACTION(MazeSetTrackAction);
|
||||
REGISTER_ACTION(NetworkModifyGroupAction);
|
||||
REGISTER_ACTION(ParkMarketingAction);
|
||||
REGISTER_ACTION(ParkEntranceRemoveAction);
|
||||
REGISTER_ACTION(ParkSetLoanAction);
|
||||
REGISTER_ACTION(ParkSetNameAction);
|
||||
REGISTER_ACTION(ParkSetParameterAction);
|
||||
REGISTER_ACTION(ParkSetResearchFundingAction);
|
||||
REGISTER_ACTION(PeepPickupAction);
|
||||
REGISTER_ACTION(PlaceParkEntranceAction);
|
||||
REGISTER_ACTION(PlacePeepSpawnAction);
|
||||
REGISTER_ACTION(PlayerKickAction);
|
||||
REGISTER_ACTION(PlayerSetGroupAction);
|
||||
REGISTER_ACTION(RideCreateAction);
|
||||
REGISTER_ACTION(RideDemolishAction);
|
||||
REGISTER_ACTION(RideEntranceExitPlaceAction);
|
||||
REGISTER_ACTION(RideEntranceExitRemoveAction);
|
||||
REGISTER_ACTION(RideSetColourSchemeAction);
|
||||
REGISTER_ACTION(RideSetNameAction);
|
||||
REGISTER_ACTION(RideSetPriceAction);
|
||||
REGISTER_ACTION(RideSetStatusAction);
|
||||
REGISTER_ACTION(RideSetAppearanceAction);
|
||||
REGISTER_ACTION(RideSetVehicleAction);
|
||||
REGISTER_ACTION(RideSetSettingAction);
|
||||
REGISTER_ACTION(ScenarioSetSettingAction);
|
||||
REGISTER_ACTION(SetParkEntranceFeeAction);
|
||||
REGISTER_ACTION(SignSetNameAction);
|
||||
REGISTER_ACTION(SignSetStyleAction);
|
||||
REGISTER_ACTION(StaffFireAction);
|
||||
REGISTER_ACTION(StaffHireNewAction);
|
||||
REGISTER_ACTION(StaffSetColourAction);
|
||||
REGISTER_ACTION(StaffSetNameAction);
|
||||
REGISTER_ACTION(StaffSetOrdersAction);
|
||||
REGISTER_ACTION(StaffSetCostumeAction);
|
||||
REGISTER_ACTION(StaffSetPatrolAreaAction);
|
||||
REGISTER_ACTION(SurfaceSetStyleAction);
|
||||
REGISTER_ACTION(WallPlaceAction);
|
||||
REGISTER_ACTION(WallRemoveAction);
|
||||
REGISTER_ACTION(WallSetColourAction);
|
||||
REGISTER_ACTION(SmallSceneryPlaceAction);
|
||||
REGISTER_ACTION(SmallSceneryRemoveAction);
|
||||
REGISTER_ACTION(SmallScenerySetColourAction);
|
||||
REGISTER_ACTION(LargeSceneryPlaceAction);
|
||||
REGISTER_ACTION(LargeSceneryRemoveAction);
|
||||
REGISTER_ACTION(LargeScenerySetColourAction);
|
||||
REGISTER_ACTION(LandBuyRightsAction);
|
||||
REGISTER_ACTION(LandLowerAction);
|
||||
REGISTER_ACTION(LandRaiseAction);
|
||||
REGISTER_ACTION(LandSetHeightAction);
|
||||
REGISTER_ACTION(LandSetRightsAction);
|
||||
REGISTER_ACTION(LandSmoothAction);
|
||||
REGISTER_ACTION(TileModifyAction);
|
||||
REGISTER_ACTION(TrackDesignAction);
|
||||
REGISTER_ACTION(TrackPlaceAction);
|
||||
REGISTER_ACTION(TrackRemoveAction);
|
||||
REGISTER_ACTION(TrackSetBrakeSpeedAction);
|
||||
REGISTER_ACTION(ClearAction);
|
||||
REGISTER_ACTION(PauseToggleAction);
|
||||
REGISTER_ACTION(LoadOrQuitAction);
|
||||
REGISTER_ACTION(WaterSetHeightAction);
|
||||
REGISTER_ACTION(WaterLowerAction);
|
||||
REGISTER_ACTION(WaterRaiseAction);
|
||||
REGISTER_ACTION(GuestSetFlagsAction);
|
||||
REGISTER_ACTION(ParkSetDateAction);
|
||||
REGISTER_ACTION(SetCheatAction);
|
||||
REGISTER_ACTION(ChangeMapSizeAction);
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
REGISTER_ACTION(CustomAction);
|
||||
#endif
|
||||
|
||||
#undef REGISTER_ACTION
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
||||
static constexpr GameActionRegistry _registry = BuildRegistry();
|
||||
|
||||
const char* GetName(GameCommand id)
|
||||
{
|
||||
const auto idx = static_cast<size_t>(id);
|
||||
Guard::IndexInRange(idx, _registry);
|
||||
|
||||
return _registry[idx].name;
|
||||
}
|
||||
|
||||
std::unique_ptr<GameAction> Create(GameCommand id)
|
||||
{
|
||||
const auto idx = static_cast<size_t>(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<GameAction>(result);
|
||||
}
|
||||
|
||||
bool IsValidId(uint32_t id)
|
||||
{
|
||||
if (id < std::size(_registry))
|
||||
{
|
||||
return _registry[id].factory != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace GameActions
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(GuestSetFlagsAction, GameCommand::GuestSetFlags, GameActions::Result)
|
||||
class GuestSetFlagsAction final : public GameActionBase<GameCommand::GuestSetFlags>
|
||||
{
|
||||
private:
|
||||
uint16_t _peepId{ SPRITE_INDEX_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(GuestSetNameAction, GameCommand::SetGuestName, GameActions::Result)
|
||||
class GuestSetNameAction final : public GameActionBase<GameCommand::SetGuestName>
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
||||
@@ -18,7 +18,7 @@ enum class LandBuyRightSetting : uint8_t
|
||||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(LandBuyRightsAction, GameCommand::BuyLandRights, GameActions::Result)
|
||||
class LandBuyRightsAction final : public GameActionBase<GameCommand::BuyLandRights>
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandLowerAction, GameCommand::LowerLand, GameActions::Result)
|
||||
class LandLowerAction final : public GameActionBase<GameCommand::LowerLand>
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandRaiseAction, GameCommand::RaiseLand, GameActions::Result)
|
||||
class LandRaiseAction final : public GameActionBase<GameCommand::RaiseLand>
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandSetHeightAction, GameCommand::SetLandHeight, GameActions::Result)
|
||||
class LandSetHeightAction final : public GameActionBase<GameCommand::SetLandHeight>
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
||||
@@ -21,7 +21,7 @@ enum class LandSetRightSetting : uint8_t
|
||||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(LandSetRightsAction, GameCommand::SetLandOwnership, GameActions::Result)
|
||||
class LandSetRightsAction final : public GameActionBase<GameCommand::SetLandOwnership>
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandSmoothAction, GameCommand::EditLandSmooth, GameActions::Result)
|
||||
class LandSmoothAction final : public GameActionBase<GameCommand::EditLandSmooth>
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
||||
@@ -20,7 +20,7 @@ struct LargeSceneryPlaceActionResult
|
||||
BannerIndex bannerId = BANNER_INDEX_NULL;
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(LargeSceneryPlaceAction, GameCommand::PlaceLargeScenery, GameActions::Result)
|
||||
class LargeSceneryPlaceAction final : public GameActionBase<GameCommand::PlaceLargeScenery>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LargeSceneryRemoveAction, GameCommand::RemoveLargeScenery, GameActions::Result)
|
||||
class LargeSceneryRemoveAction final : public GameActionBase<GameCommand::RemoveLargeScenery>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LargeScenerySetColourAction, GameCommand::SetLargeSceneryColour, GameActions::Result)
|
||||
class LargeScenerySetColourAction final : public GameActionBase<GameCommand::SetLargeSceneryColour>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -17,7 +17,7 @@ enum class LoadOrQuitModes : uint8_t
|
||||
CloseSavePrompt
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(LoadOrQuitAction, GameCommand::LoadOrQuit, GameActions::Result)
|
||||
class LoadOrQuitAction final : public GameActionBase<GameCommand::LoadOrQuit>
|
||||
{
|
||||
private:
|
||||
LoadOrQuitModes _mode{};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(MazePlaceTrackAction, GameCommand::PlaceMazeDesign, GameActions::Result)
|
||||
class MazePlaceTrackAction final : public GameActionBase<GameCommand::PlaceMazeDesign>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -37,7 +37,7 @@ static constexpr const uint8_t byte_993D0C[] = {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
DEFINE_GAME_ACTION(MazeSetTrackAction, GameCommand::SetMazeTrack, GameActions::Result)
|
||||
class MazeSetTrackAction final : public GameActionBase<GameCommand::SetMazeTrack>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -29,7 +29,7 @@ enum class PermissionState : uint8_t
|
||||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(NetworkModifyGroupAction, GameCommand::ModifyGroups, GameActions::Result)
|
||||
class NetworkModifyGroupAction final : public GameActionBase<GameCommand::ModifyGroups>
|
||||
{
|
||||
private:
|
||||
ModifyGroupType _type{ ModifyGroupType::Count };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkEntranceRemoveAction, GameCommand::RemoveParkEntrance, GameActions::Result)
|
||||
class ParkEntranceRemoveAction final : public GameActionBase<GameCommand::RemoveParkEntrance>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkMarketingAction, GameCommand::StartMarketingCampaign, GameActions::Result)
|
||||
class ParkMarketingAction final : public GameActionBase<GameCommand::StartMarketingCampaign>
|
||||
{
|
||||
private:
|
||||
int32_t _type{};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetDateAction, GameCommand::SetDate, GameActions::Result)
|
||||
class ParkSetDateAction final : public GameActionBase<GameCommand::SetDate>
|
||||
{
|
||||
private:
|
||||
int32_t _year{};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetLoanAction, GameCommand::SetCurrentLoan, GameActions::Result)
|
||||
class ParkSetLoanAction final : public GameActionBase<GameCommand::SetCurrentLoan>
|
||||
{
|
||||
private:
|
||||
money32 _value{ MONEY32_UNDEFINED };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetNameAction, GameCommand::SetParkName, GameActions::Result)
|
||||
class ParkSetNameAction final : public GameActionBase<GameCommand::SetParkName>
|
||||
{
|
||||
private:
|
||||
std::string _name;
|
||||
|
||||
@@ -19,7 +19,7 @@ enum class ParkParameter : uint8_t
|
||||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetParameterAction, GameCommand::SetParkOpen, GameActions::Result)
|
||||
class ParkSetParameterAction final : public GameActionBase<GameCommand::SetParkOpen>
|
||||
{
|
||||
private:
|
||||
ParkParameter _parameter{ ParkParameter::Count };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetResearchFundingAction, GameCommand::SetResearchFunding, GameActions::Result)
|
||||
class ParkSetResearchFundingAction final : public GameActionBase<GameCommand::SetResearchFunding>
|
||||
{
|
||||
private:
|
||||
// TODO change to std::optional when C++17
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// Clang format is broken for small game actions
|
||||
// clang-format off
|
||||
DEFINE_GAME_ACTION(PauseToggleAction, GameCommand::TogglePause, GameActions::Result)
|
||||
class PauseToggleAction final : public GameActionBase<GameCommand::TogglePause>
|
||||
{
|
||||
public:
|
||||
PauseToggleAction() = default;
|
||||
|
||||
@@ -19,7 +19,7 @@ enum class PeepPickupType : uint8_t
|
||||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(PeepPickupAction, GameCommand::PickupGuest, GameActions::Result)
|
||||
class PeepPickupAction final : public GameActionBase<GameCommand::PickupGuest>
|
||||
{
|
||||
private:
|
||||
PeepPickupType _type{ PeepPickupType::Count };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlaceParkEntranceAction, GameCommand::PlaceParkEntrance, GameActions::Result)
|
||||
class PlaceParkEntranceAction final : public GameActionBase<GameCommand::PlaceParkEntrance>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlacePeepSpawnAction, GameCommand::PlacePeepSpawn, GameActions::Result)
|
||||
class PlacePeepSpawnAction final : public GameActionBase<GameCommand::PlacePeepSpawn>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _location;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlayerKickAction, GameCommand::KickPlayer, GameActions::Result)
|
||||
class PlayerKickAction final : public GameActionBase<GameCommand::KickPlayer>
|
||||
{
|
||||
private:
|
||||
NetworkPlayerId_t _playerId{ -1 };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlayerSetGroupAction, GameCommand::SetPlayerGroup, GameActions::Result)
|
||||
class PlayerSetGroupAction final : public GameActionBase<GameCommand::SetPlayerGroup>
|
||||
{
|
||||
private:
|
||||
NetworkPlayerId_t _playerId{ -1 };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideCreateAction, GameCommand::CreateRide, GameActions::Result)
|
||||
class RideCreateAction final : public GameActionBase<GameCommand::CreateRide>
|
||||
{
|
||||
private:
|
||||
ObjectEntryIndex _rideType{ OBJECT_ENTRY_INDEX_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideDemolishAction, GameCommand::DemolishRide, GameActions::Result)
|
||||
class RideDemolishAction final : public GameActionBase<GameCommand::DemolishRide>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../world/Entrance.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideEntranceExitPlaceAction, GameCommand::PlaceRideEntranceOrExit, GameActions::Result)
|
||||
class RideEntranceExitPlaceAction final : public GameActionBase<GameCommand::PlaceRideEntranceOrExit>
|
||||
{
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideEntranceExitRemoveAction, GameCommand::RemoveRideEntranceOrExit, GameActions::Result)
|
||||
class RideEntranceExitRemoveAction final : public GameActionBase<GameCommand::RemoveRideEntranceOrExit>
|
||||
{
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
|
||||
@@ -24,7 +24,7 @@ enum class RideSetAppearanceType : uint8_t
|
||||
EntranceStyle
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetAppearanceAction, GameCommand::SetRideAppearance, GameActions::Result)
|
||||
class RideSetAppearanceAction final : public GameActionBase<GameCommand::SetRideAppearance>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetColourSchemeAction, GameCommand::SetColourScheme, GameActions::Result)
|
||||
class RideSetColourSchemeAction final : public GameActionBase<GameCommand::SetColourScheme>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetNameAction, GameCommand::SetRideName, GameActions::Result)
|
||||
class RideSetNameAction final : public GameActionBase<GameCommand::SetRideName>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetPriceAction, GameCommand::SetRidePrice, GameActions::Result)
|
||||
class RideSetPriceAction final : public GameActionBase<GameCommand::SetRidePrice>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -26,7 +26,7 @@ enum class RideSetSetting : uint8_t
|
||||
RideType,
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetSettingAction, GameCommand::SetRideSetting, GameActions::Result)
|
||||
class RideSetSettingAction final : public GameActionBase<GameCommand::SetRideSetting>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetStatusAction, GameCommand::SetRideStatus, GameActions::Result)
|
||||
class RideSetStatusAction final : public GameActionBase<GameCommand::SetRideStatus>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -19,7 +19,7 @@ enum class RideSetVehicleType : uint8_t
|
||||
Count,
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetVehicleAction, GameCommand::SetRideVehicles, GameActions::Result)
|
||||
class RideSetVehicleAction final : public GameActionBase<GameCommand::SetRideVehicles>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -38,7 +38,7 @@ enum class ScenarioSetSetting : uint8_t
|
||||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(ScenarioSetSettingAction, GameCommand::EditScenarioOptions, GameActions::Result)
|
||||
class ScenarioSetSettingAction final : public GameActionBase<GameCommand::EditScenarioOptions>
|
||||
{
|
||||
private:
|
||||
ScenarioSetSetting _setting{ ScenarioSetSetting::Count };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#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>>;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SetParkEntranceFeeAction, GameCommand::SetParkEntranceFee, GameActions::Result)
|
||||
class SetParkEntranceFeeAction final : public GameActionBase<GameCommand::SetParkEntranceFee>
|
||||
{
|
||||
private:
|
||||
money16 _fee{ MONEY16_UNDEFINED };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SignSetNameAction, GameCommand::SetSignName, GameActions::Result)
|
||||
class SignSetNameAction final : public GameActionBase<GameCommand::SetSignName>
|
||||
{
|
||||
private:
|
||||
BannerIndex _bannerIndex{ BANNER_INDEX_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SignSetStyleAction, GameCommand::SetSignStyle, GameActions::Result)
|
||||
class SignSetStyleAction final : public GameActionBase<GameCommand::SetSignStyle>
|
||||
{
|
||||
private:
|
||||
BannerIndex _bannerIndex{ BANNER_INDEX_NULL };
|
||||
|
||||
@@ -19,7 +19,7 @@ struct SmallSceneryPlaceActionResult
|
||||
uint8_t SceneryQuadrant{};
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(SmallSceneryPlaceAction, GameCommand::PlaceScenery, GameActions::Result)
|
||||
class SmallSceneryPlaceAction final : public GameActionBase<GameCommand::PlaceScenery>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../world/TileElement.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SmallSceneryRemoveAction, GameCommand::RemoveScenery, GameActions::Result)
|
||||
class SmallSceneryRemoveAction final : public GameActionBase<GameCommand::RemoveScenery>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SmallScenerySetColourAction, GameCommand::SetSceneryColour, GameActions::Result)
|
||||
class SmallScenerySetColourAction final : public GameActionBase<GameCommand::SetSceneryColour>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffFireAction, GameCommand::FireStaffMember, GameActions::Result)
|
||||
class StaffFireAction final : public GameActionBase<GameCommand::FireStaffMember>
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteId{ SPRITE_INDEX_NULL };
|
||||
|
||||
@@ -17,7 +17,7 @@ struct StaffHireNewActionResult
|
||||
uint16_t StaffEntityId = SPRITE_INDEX_NULL;
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(StaffHireNewAction, GameCommand::HireNewStaffMember, GameActions::Result)
|
||||
class StaffHireNewAction final : public GameActionBase<GameCommand::HireNewStaffMember>
|
||||
{
|
||||
private:
|
||||
bool _autoPosition{};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetColourAction, GameCommand::SetStaffColour, GameActions::Result)
|
||||
class StaffSetColourAction final : public GameActionBase<GameCommand::SetStaffColour>
|
||||
{
|
||||
private:
|
||||
uint8_t _staffType{};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../peep/Staff.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetCostumeAction, GameCommand::SetStaffCostume, GameActions::Result)
|
||||
class StaffSetCostumeAction final : public GameActionBase<GameCommand::SetStaffCostume>
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetNameAction, GameCommand::SetStaffName, GameActions::Result)
|
||||
class StaffSetNameAction final : public GameActionBase<GameCommand::SetStaffName>
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetOrdersAction, GameCommand::SetStaffOrders, GameActions::Result)
|
||||
class StaffSetOrdersAction final : public GameActionBase<GameCommand::SetStaffOrders>
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
||||
@@ -18,7 +18,7 @@ enum class StaffSetPatrolAreaMode : uint8_t
|
||||
ClearAll
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetPatrolAreaAction, GameCommand::SetStaffPatrol, GameActions::Result)
|
||||
class StaffSetPatrolAreaAction final : public GameActionBase<GameCommand::SetStaffPatrol>
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteId{ SPRITE_INDEX_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SurfaceSetStyleAction, GameCommand::ChangeSurfaceStyle, GameActions::Result)
|
||||
class SurfaceSetStyleAction final : public GameActionBase<GameCommand::ChangeSurfaceStyle>
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
||||
@@ -41,7 +41,7 @@ enum class TileModifyType : uint8_t
|
||||
Count,
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(TileModifyAction, GameCommand::ModifyTile, GameActions::Result)
|
||||
class TileModifyAction final : public GameActionBase<GameCommand::ModifyTile>
|
||||
{
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../ride/TrackDesign.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(TrackDesignAction, GameCommand::PlaceTrackDesign, GameActions::Result)
|
||||
class TrackDesignAction final : public GameActionBase<GameCommand::PlaceTrackDesign>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -16,7 +16,7 @@ struct TrackPlaceActionResult
|
||||
uint8_t GroundFlags{ 0 };
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(TrackPlaceAction, GameCommand::PlaceTrack, GameActions::Result)
|
||||
class TrackPlaceAction final : public GameActionBase<GameCommand::PlaceTrack>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(TrackRemoveAction, GameCommand::RemoveTrack, GameActions::Result)
|
||||
class TrackRemoveAction final : public GameActionBase<GameCommand::RemoveTrack>
|
||||
{
|
||||
private:
|
||||
track_type_t _trackType{};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(TrackSetBrakeSpeedAction, GameCommand::SetBrakesSpeed, GameActions::Result)
|
||||
class TrackSetBrakeSpeedAction final : public GameActionBase<GameCommand::SetBrakesSpeed>
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
@@ -21,7 +21,7 @@ struct WallPlaceActionResult
|
||||
BannerIndex BannerId = BANNER_INDEX_NULL;
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(WallPlaceAction, GameCommand::PlaceWall, GameActions::Result)
|
||||
class WallPlaceAction final : public GameActionBase<GameCommand::PlaceWall>
|
||||
{
|
||||
private:
|
||||
ObjectEntryIndex _wallType{ OBJECT_ENTRY_INDEX_NULL };
|
||||
@@ -50,8 +50,8 @@ private:
|
||||
*
|
||||
* rct2: 0x006E5CBA
|
||||
*/
|
||||
bool WallCheckObstructionWithTrack(WallSceneryEntry * wall, int32_t z0, TrackElement * trackElement, bool* wallAcrossTrack)
|
||||
const;
|
||||
bool WallCheckObstructionWithTrack(
|
||||
WallSceneryEntry* wall, int32_t z0, TrackElement* trackElement, bool* wallAcrossTrack) const;
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5C1A
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WallRemoveAction, GameCommand::RemoveWall, GameActions::Result)
|
||||
class WallRemoveAction final : public GameActionBase<GameCommand::RemoveWall>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WallSetColourAction, GameCommand::SetWallColour, GameActions::Result)
|
||||
class WallSetColourAction final : public GameActionBase<GameCommand::SetWallColour>
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WaterLowerAction, GameCommand::LowerWater, GameActions::Result)
|
||||
class WaterLowerAction final : public GameActionBase<GameCommand::LowerWater>
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WaterRaiseAction, GameCommand::RaiseWater, GameActions::Result)
|
||||
class WaterRaiseAction final : public GameActionBase<GameCommand::RaiseWater>
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WaterSetHeightAction, GameCommand::SetWaterHeight, GameActions::Result)
|
||||
class WaterSetHeightAction final : public GameActionBase<GameCommand::SetWaterHeight>
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
||||
@@ -521,7 +521,7 @@
|
||||
<ClCompile Include="actions\FootpathRemoveAction.cpp" />
|
||||
<ClCompile Include="actions\GameAction.cpp" />
|
||||
<ClCompile Include="actions\GameActionCompat.cpp" />
|
||||
<ClCompile Include="actions\GameActionRegistration.cpp" />
|
||||
<ClCompile Include="actions\GameActionRegistry.cpp" />
|
||||
<ClCompile Include="actions\GameActionResult.cpp" />
|
||||
<ClCompile Include="actions\GuestSetFlagsAction.cpp" />
|
||||
<ClCompile Include="actions\GuestSetNameAction.cpp" />
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
struct GameAction;
|
||||
class GameAction;
|
||||
struct Peep;
|
||||
struct CoordsXYZ;
|
||||
namespace GameActions
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
struct duk_hthread;
|
||||
typedef struct duk_hthread duk_context;
|
||||
|
||||
struct GameAction;
|
||||
class GameAction;
|
||||
namespace GameActions
|
||||
{
|
||||
class Result;
|
||||
|
||||
Reference in New Issue
Block a user