1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

Move Pause, PeepSpawn, Player, TileModify game actions to GameActions namespace

This commit is contained in:
Aaron van Geffen
2025-08-26 21:39:29 +02:00
parent 86a001875e
commit 439afd9d5d
17 changed files with 574 additions and 544 deletions

View File

@@ -522,8 +522,9 @@ static void ShortcutToggleWallSlope()
int32_t newSlopeValue = (currSlopeValue + 1) % 3;
extern TileCoordsXY windowTileInspectorTile;
auto modifyTile = TileModifyAction(
windowTileInspectorTile.ToCoordsXY(), TileModifyType::WallSetSlope, windowTileInspectorSelectedIndex, newSlopeValue);
auto modifyTile = GameActions::TileModifyAction(
windowTileInspectorTile.ToCoordsXY(), GameActions::TileModifyType::WallSetSlope, windowTileInspectorSelectedIndex,
newSlopeValue);
GameActions::Execute(&modifyTile);
}
@@ -782,7 +783,7 @@ void ShortcutManager::RegisterDefaultShortcuts()
RegisterShortcut(ShortcutId::kInterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() {
if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager)
{
auto pauseToggleAction = PauseToggleAction();
auto pauseToggleAction = GameActions::PauseToggleAction();
GameActions::Execute(&pauseToggleAction);
}
});

View File

@@ -481,7 +481,7 @@ namespace OpenRCT2::Ui::Windows
int32_t mapZ = tileElement->GetBaseZ();
auto gameAction = PeepSpawnPlaceAction({ mapCoords, mapZ, static_cast<Direction>(direction) });
auto gameAction = GameActions::PeepSpawnPlaceAction({ mapCoords, mapZ, static_cast<Direction>(direction) });
auto result = GameActions::Execute(&gameAction);
if (result.Error == GameActions::Status::Ok)
{

View File

@@ -507,7 +507,7 @@ namespace OpenRCT2::Ui::Windows
break;
case WIDX_KICK:
{
auto kickPlayerAction = PlayerKickAction(number);
auto kickPlayerAction = GameActions::PlayerKickAction(number);
GameActions::Execute(&kickPlayerAction);
}
break;
@@ -528,7 +528,7 @@ namespace OpenRCT2::Ui::Windows
}
const auto groupId = NetworkGetGroupID(dropdownIndex);
const auto windowHandle = std::make_pair(classification, number);
auto playerSetGroupAction = PlayerSetGroupAction(playerId, groupId);
auto playerSetGroupAction = GameActions::PlayerSetGroupAction(playerId, groupId);
playerSetGroupAction.SetCallback([windowHandle](const GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
{

View File

@@ -1866,14 +1866,14 @@ static uint64_t PageDisabledWidgets[] = {
void RemoveElement(int32_t elementIndex)
{
Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range");
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyRemove, elementIndex);
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnyRemove, elementIndex);
GameActions::Execute(&modifyTile);
}
void RotateElement(int32_t elementIndex)
{
Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range");
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyRotate, elementIndex);
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnyRotate, elementIndex);
GameActions::Execute(&modifyTile);
}
@@ -1885,14 +1885,14 @@ static uint64_t PageDisabledWidgets[] = {
// This might happen if two people are modifying the same tile.
if (!firstInRange || !secondInRange)
return;
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnySwap, first, second);
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnySwap, first, second);
GameActions::Execute(&modifyTile);
}
void SortElements()
{
Guard::Assert(_tileSelected, "No tile selected");
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnySort);
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::AnySort);
GameActions::Execute(&modifyTile);
}
@@ -1916,50 +1916,56 @@ static uint64_t PageDisabledWidgets[] = {
void PasteElement()
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyPaste, 0, 0, _copiedElement, _copiedBanner);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::AnyPaste, 0, 0, _copiedElement, _copiedBanner);
GameActions::Execute(&modifyTile);
}
void BaseHeightOffset(int16_t elementIndex, int8_t heightOffset)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyBaseHeightOffset, elementIndex, heightOffset);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::AnyBaseHeightOffset, elementIndex, heightOffset);
GameActions::Execute(&modifyTile);
}
void SurfaceShowParkFences(bool showFences)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceShowParkFences, showFences);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::SurfaceShowParkFences, showFences);
GameActions::Execute(&modifyTile);
}
void SurfaceToggleCorner(int32_t cornerIndex)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceToggleCorner, cornerIndex);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::SurfaceToggleCorner, cornerIndex);
GameActions::Execute(&modifyTile);
}
void SurfaceToggleDiagonal()
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::SurfaceToggleDiagonal);
auto modifyTile = GameActions::TileModifyAction(_toolMap, GameActions::TileModifyType::SurfaceToggleDiagonal);
GameActions::Execute(&modifyTile);
}
void PathSetSloped(int32_t elementIndex, bool sloped)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathSetSlope, elementIndex, sloped);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathSetSlope, elementIndex, sloped);
GameActions::Execute(&modifyTile);
}
void PathSetJunctionRailings(int32_t elementIndex, bool hasJunctionRailings)
{
auto modifyTile = TileModifyAction(
_toolMap, TileModifyType::PathSetJunctionRailings, elementIndex, hasJunctionRailings);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathSetJunctionRailings, elementIndex, hasJunctionRailings);
GameActions::Execute(&modifyTile);
}
void PathSetBroken(int32_t elementIndex, bool broken)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathSetBroken, elementIndex, broken);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathSetBroken, elementIndex, broken);
GameActions::Execute(&modifyTile);
}
@@ -1967,14 +1973,16 @@ static uint64_t PageDisabledWidgets[] = {
{
Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range");
Guard::Assert(cornerIndex >= 0 && cornerIndex < 8, "cornerIndex out of range");
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::PathToggleEdge, elementIndex, cornerIndex);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::PathToggleEdge, elementIndex, cornerIndex);
GameActions::Execute(&modifyTile);
}
void EntranceMakeUsable(int32_t elementIndex)
{
Guard::ArgumentInRange(elementIndex, 0, windowTileInspectorElementCount - 1);
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::EntranceMakeUsable, elementIndex);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::EntranceMakeUsable, elementIndex);
GameActions::Execute(&modifyTile);
}
@@ -1982,41 +1990,45 @@ static uint64_t PageDisabledWidgets[] = {
{
// Make sure only the correct bits are set
Guard::Assert((slopeValue & 3) == slopeValue, "slopeValue doesn't match its mask");
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::WallSetSlope, elementIndex, slopeValue);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::WallSetSlope, elementIndex, slopeValue);
GameActions::Execute(&modifyTile);
}
void WallAnimationFrameOffset(int16_t elementIndex, int8_t animationFrameOffset)
{
auto modifyTile = TileModifyAction(
_toolMap, TileModifyType::WallSetAnimationFrame, elementIndex, animationFrameOffset);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::WallSetAnimationFrame, elementIndex, animationFrameOffset);
GameActions::Execute(&modifyTile);
}
void TrackBlockHeightOffset(int32_t elementIndex, int8_t heightOffset)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::TrackBaseHeightOffset, elementIndex, heightOffset);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::TrackBaseHeightOffset, elementIndex, heightOffset);
GameActions::Execute(&modifyTile);
}
void TrackBlockSetLift(int32_t elementIndex, bool entireTrackBlock, bool chain)
{
auto modifyTile = TileModifyAction(
_toolMap, entireTrackBlock ? TileModifyType::TrackSetChainBlock : TileModifyType::TrackSetChain, elementIndex,
chain);
auto modifyTile = GameActions::TileModifyAction(
_toolMap,
entireTrackBlock ? GameActions::TileModifyType::TrackSetChainBlock : GameActions::TileModifyType::TrackSetChain,
elementIndex, chain);
GameActions::Execute(&modifyTile);
}
void TrackSetBrakeClosed(int32_t elementIndex, bool isClosed)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::TrackSetBrake, elementIndex, isClosed);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::TrackSetBrake, elementIndex, isClosed);
GameActions::Execute(&modifyTile);
}
void TrackSetIndestructible(int32_t elementIndex, bool isIndestructible)
{
auto modifyTile = TileModifyAction(
_toolMap, TileModifyType::TrackSetIndestructible, elementIndex, isIndestructible);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::TrackSetIndestructible, elementIndex, isIndestructible);
GameActions::Execute(&modifyTile);
}
@@ -2024,16 +2036,17 @@ static uint64_t PageDisabledWidgets[] = {
{
// quarterIndex is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3
Guard::Assert(quarterIndex >= 0 && quarterIndex < 4, "quarterIndex out of range");
auto modifyTile = TileModifyAction(
_toolMap, TileModifyType::ScenerySetQuarterLocation, elementIndex, (quarterIndex - GetCurrentRotation()) & 3);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::ScenerySetQuarterLocation, elementIndex,
(quarterIndex - GetCurrentRotation()) & 3);
GameActions::Execute(&modifyTile);
}
// ToggleQuadrantCollision?
void ToggleQuadrantCollosion(int32_t elementIndex, const int32_t quadrantIndex)
{
auto modifyTile = TileModifyAction(
_toolMap, TileModifyType::ScenerySetQuarterCollision, elementIndex,
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::ScenerySetQuarterCollision, elementIndex,
(quadrantIndex + 2 - GetCurrentRotation()) & 3);
GameActions::Execute(&modifyTile);
}
@@ -2043,20 +2056,23 @@ static uint64_t PageDisabledWidgets[] = {
Guard::Assert(edgeIndex >= 0 && edgeIndex < 4, "edgeIndex out of range");
// Make edgeIndex = 0
edgeIndex = (edgeIndex - GetCurrentRotation()) & 3;
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex);
GameActions::Execute(&modifyTile);
}
void ToggleInvisibility(int32_t elementIndex)
{
Guard::Assert(elementIndex >= 0 && elementIndex < windowTileInspectorElementCount, "elementIndex out of range");
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::AnyToggleInvisilibity, elementIndex);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::AnyToggleInvisilibity, elementIndex);
GameActions::Execute(&modifyTile);
}
void WallSetAnimationIsBackwards(int32_t elementIndex, bool backwards)
{
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::WallSetAnimationIsBackwards, elementIndex, backwards);
auto modifyTile = GameActions::TileModifyAction(
_toolMap, GameActions::TileModifyType::WallSetAnimationIsBackwards, elementIndex, backwards);
GameActions::Execute(&modifyTile);
}

View File

@@ -308,7 +308,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_PAUSE:
if (NetworkGetMode() != NETWORK_MODE_CLIENT)
{
auto pauseToggleAction = PauseToggleAction();
auto pauseToggleAction = GameActions::PauseToggleAction();
GameActions::Execute(&pauseToggleAction);
_waitingForPause = true;
}

View File

@@ -9,20 +9,21 @@
#include "PauseToggleAction.h"
using namespace OpenRCT2;
uint16_t PauseToggleAction::GetActionFlags() const
namespace OpenRCT2::GameActions
{
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused | GameActions::Flags::IgnoreForReplays;
}
uint16_t PauseToggleAction::GetActionFlags() const
{
return GameAction::GetActionFlags() | Flags::AllowWhilePaused | Flags::IgnoreForReplays;
}
GameActions::Result PauseToggleAction::Query() const
{
return GameActions::Result();
}
Result PauseToggleAction::Query() const
{
return Result();
}
GameActions::Result PauseToggleAction::Execute() const
{
PauseToggle();
return GameActions::Result();
}
Result PauseToggleAction::Execute() const
{
PauseToggle();
return Result();
}
} // namespace OpenRCT2::GameActions

View File

@@ -11,16 +11,17 @@
#include "GameAction.h"
// Clang format is broken for small game actions
// clang-format off
class PauseToggleAction final : public GameActionBase<GameCommand::TogglePause>
namespace OpenRCT2::GameActions
{
public:
PauseToggleAction() = default;
class PauseToggleAction final : public GameActionBase<GameCommand::TogglePause>
{
public:
PauseToggleAction() = default;
uint16_t GetActionFlags() const override;
uint16_t GetActionFlags() const override;
OpenRCT2::GameActions::Result Query() const override;
OpenRCT2::GameActions::Result Execute() const override;
};
// clang-format on
Result Query() const override;
Result Execute() const override;
};
// clang-format on
} // namespace OpenRCT2::GameActions

View File

@@ -19,124 +19,121 @@
#include "../world/Park.h"
#include "../world/tile_element/SurfaceElement.h"
using namespace OpenRCT2;
PeepSpawnPlaceAction::PeepSpawnPlaceAction(const CoordsXYZD& location)
: _location(location)
namespace OpenRCT2::GameActions
{
}
void PeepSpawnPlaceAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
visitor.Visit(_location);
}
uint16_t PeepSpawnPlaceAction::GetActionFlags() const
{
return GameActionBase::GetActionFlags() | GameActions::Flags::EditorOnly | GameActions::Flags::AllowWhilePaused;
}
void PeepSpawnPlaceAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
stream << DS_TAG(_location.x) << DS_TAG(_location.y) << DS_TAG(_location.z) << DS_TAG(_location.direction);
}
GameActions::Result PeepSpawnPlaceAction::Query() const
{
if (!isInEditorMode() && !getGameState().cheats.sandboxMode)
PeepSpawnPlaceAction::PeepSpawnPlaceAction(const CoordsXYZD& location)
: _location(location)
{
return GameActions::Result(GameActions::Status::NotInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, kStringIdNone);
}
auto res = GameActions::Result();
res.Expenditure = ExpenditureType::landPurchase;
res.Position = _location;
auto mapSizeUnits = GetMapSizeUnits() - CoordsXY{ 16, 16 };
if (!LocationValid(_location) || _location.x <= 16 || _location.y <= 16 || _location.x >= mapSizeUnits.x
|| _location.y >= mapSizeUnits.y)
void PeepSpawnPlaceAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_OFF_EDGE_OF_MAP);
visitor.Visit(_location);
}
// Verify footpath exists at location, and retrieve coordinates
auto pathElement = MapGetPathElementAt(TileCoordsXYZ{ _location });
if (pathElement == nullptr)
uint16_t PeepSpawnPlaceAction::GetActionFlags() const
{
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ON_PATHS);
return GameActionBase::GetActionFlags() | Flags::EditorOnly | Flags::AllowWhilePaused;
}
// Verify location is unowned
auto surfaceMapElement = MapGetSurfaceElementAt(_location);
if (surfaceMapElement == nullptr)
void PeepSpawnPlaceAction::Serialise(DataSerialiser& stream)
{
return GameActions::Result(
GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
if (surfaceMapElement->GetOwnership() != OWNERSHIP_UNOWNED)
{
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE,
STR_ERR_MUST_BE_OUTSIDE_PARK_BOUNDARIES);
GameAction::Serialise(stream);
stream << DS_TAG(_location.x) << DS_TAG(_location.y) << DS_TAG(_location.z) << DS_TAG(_location.direction);
}
return res;
}
GameActions::Result PeepSpawnPlaceAction::Execute() const
{
auto res = GameActions::Result();
res.Expenditure = ExpenditureType::landPurchase;
res.Position = _location;
// Shift the spawn point to the edge of the tile
auto spawnPos = CoordsXY{ _location.ToTileCentre() }
+ CoordsXY{ DirectionOffsets[_location.direction].x * 15, DirectionOffsets[_location.direction].y * 15 };
PeepSpawn spawn;
spawn.x = spawnPos.x;
spawn.y = spawnPos.y;
spawn.z = _location.z;
spawn.direction = _location.direction;
auto& gameState = getGameState();
// When attempting to place a peep spawn on a tile that already contains it,
// remove that peep spawn instead.
if (!gameState.peepSpawns.empty())
Result PeepSpawnPlaceAction::Query() const
{
// When searching for existing spawns, ignore the direction.
auto foundSpawn = std::find_if(
gameState.peepSpawns.begin(), gameState.peepSpawns.end(), [spawn](const CoordsXYZ& existingSpawn) {
{
return existingSpawn.ToTileStart() == spawn.ToTileStart();
}
});
if (foundSpawn != std::end(gameState.peepSpawns))
if (!isInEditorMode() && !getGameState().cheats.sandboxMode)
{
gameState.peepSpawns.erase(foundSpawn);
MapInvalidateTileFull(spawn);
return res;
return Result(Status::NotInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, kStringIdNone);
}
auto res = Result();
res.Expenditure = ExpenditureType::landPurchase;
res.Position = _location;
auto mapSizeUnits = GetMapSizeUnits() - CoordsXY{ 16, 16 };
if (!LocationValid(_location) || _location.x <= 16 || _location.y <= 16 || _location.x >= mapSizeUnits.x
|| _location.y >= mapSizeUnits.y)
{
return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_OFF_EDGE_OF_MAP);
}
// Verify footpath exists at location, and retrieve coordinates
auto pathElement = MapGetPathElementAt(TileCoordsXYZ{ _location });
if (pathElement == nullptr)
{
return Result(Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ON_PATHS);
}
// Verify location is unowned
auto surfaceMapElement = MapGetSurfaceElementAt(_location);
if (surfaceMapElement == nullptr)
{
return Result(Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
if (surfaceMapElement->GetOwnership() != OWNERSHIP_UNOWNED)
{
return Result(
Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_MUST_BE_OUTSIDE_PARK_BOUNDARIES);
}
return res;
}
// If we have reached our max peep spawns, remove the oldest spawns
while (gameState.peepSpawns.size() >= Limits::kMaxPeepSpawns)
Result PeepSpawnPlaceAction::Execute() const
{
PeepSpawn oldestSpawn = *gameState.peepSpawns.begin();
gameState.peepSpawns.erase(gameState.peepSpawns.begin());
MapInvalidateTileFull(oldestSpawn);
auto res = Result();
res.Expenditure = ExpenditureType::landPurchase;
res.Position = _location;
// Shift the spawn point to the edge of the tile
auto spawnPos = CoordsXY{ _location.ToTileCentre() }
+ CoordsXY{ DirectionOffsets[_location.direction].x * 15, DirectionOffsets[_location.direction].y * 15 };
PeepSpawn spawn;
spawn.x = spawnPos.x;
spawn.y = spawnPos.y;
spawn.z = _location.z;
spawn.direction = _location.direction;
auto& gameState = getGameState();
// When attempting to place a peep spawn on a tile that already contains it,
// remove that peep spawn instead.
if (!gameState.peepSpawns.empty())
{
// When searching for existing spawns, ignore the direction.
auto foundSpawn = std::find_if(
gameState.peepSpawns.begin(), gameState.peepSpawns.end(), [spawn](const CoordsXYZ& existingSpawn) {
{
return existingSpawn.ToTileStart() == spawn.ToTileStart();
}
});
if (foundSpawn != std::end(gameState.peepSpawns))
{
gameState.peepSpawns.erase(foundSpawn);
MapInvalidateTileFull(spawn);
return res;
}
}
// If we have reached our max peep spawns, remove the oldest spawns
while (gameState.peepSpawns.size() >= Limits::kMaxPeepSpawns)
{
PeepSpawn oldestSpawn = *gameState.peepSpawns.begin();
gameState.peepSpawns.erase(gameState.peepSpawns.begin());
MapInvalidateTileFull(oldestSpawn);
}
// Set peep spawn
gameState.peepSpawns.push_back(spawn);
// Invalidate tile
MapInvalidateTileFull(_location);
return res;
}
// Set peep spawn
gameState.peepSpawns.push_back(spawn);
// Invalidate tile
MapInvalidateTileFull(_location);
return res;
}
} // namespace OpenRCT2::GameActions

View File

@@ -11,20 +11,23 @@
#include "GameAction.h"
class PeepSpawnPlaceAction final : public GameActionBase<GameCommand::PlacePeepSpawn>
namespace OpenRCT2::GameActions
{
private:
CoordsXYZD _location;
class PeepSpawnPlaceAction final : public GameActionBase<GameCommand::PlacePeepSpawn>
{
private:
CoordsXYZD _location;
public:
PeepSpawnPlaceAction() = default;
PeepSpawnPlaceAction(const CoordsXYZD& location);
public:
PeepSpawnPlaceAction() = default;
PeepSpawnPlaceAction(const CoordsXYZD& location);
void AcceptParameters(GameActionParameterVisitor& visitor) override;
void AcceptParameters(GameActionParameterVisitor& visitor) override;
uint16_t GetActionFlags() const override;
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
OpenRCT2::GameActions::Result Query() const override;
OpenRCT2::GameActions::Result Execute() const override;
};
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
};
} // namespace OpenRCT2::GameActions

View File

@@ -11,35 +11,36 @@
#include "../network/Network.h"
using namespace OpenRCT2;
PlayerKickAction::PlayerKickAction(NetworkPlayerId_t playerId)
: _playerId(playerId)
namespace OpenRCT2::GameActions
{
}
PlayerKickAction::PlayerKickAction(NetworkPlayerId_t playerId)
: _playerId(playerId)
{
}
void PlayerKickAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
visitor.Visit("playerId", _playerId);
}
void PlayerKickAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
visitor.Visit("playerId", _playerId);
}
uint16_t PlayerKickAction::GetActionFlags() const
{
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
}
uint16_t PlayerKickAction::GetActionFlags() const
{
return GameAction::GetActionFlags() | Flags::AllowWhilePaused;
}
void PlayerKickAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
void PlayerKickAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
stream << DS_TAG(_playerId);
}
GameActions::Result PlayerKickAction::Query() const
{
return NetworkKickPlayer(_playerId, false);
}
stream << DS_TAG(_playerId);
}
Result PlayerKickAction::Query() const
{
return NetworkKickPlayer(_playerId, false);
}
GameActions::Result PlayerKickAction::Execute() const
{
return NetworkKickPlayer(_playerId, true);
}
Result PlayerKickAction::Execute() const
{
return NetworkKickPlayer(_playerId, true);
}
} // namespace OpenRCT2::GameActions

View File

@@ -11,21 +11,24 @@
#include "GameAction.h"
class PlayerKickAction final : public GameActionBase<GameCommand::KickPlayer>
namespace OpenRCT2::GameActions
{
private:
NetworkPlayerId_t _playerId{ -1 };
class PlayerKickAction final : public GameActionBase<GameCommand::KickPlayer>
{
private:
NetworkPlayerId_t _playerId{ -1 };
public:
PlayerKickAction() = default;
public:
PlayerKickAction() = default;
PlayerKickAction(NetworkPlayerId_t playerId);
PlayerKickAction(NetworkPlayerId_t playerId);
void AcceptParameters(GameActionParameterVisitor& visitor) override;
void AcceptParameters(GameActionParameterVisitor& visitor) override;
uint16_t GetActionFlags() const override;
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
OpenRCT2::GameActions::Result Query() const override;
OpenRCT2::GameActions::Result Execute() const override;
};
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
};
} // namespace OpenRCT2::GameActions

View File

@@ -11,37 +11,38 @@
#include "../network/Network.h"
using namespace OpenRCT2;
PlayerSetGroupAction::PlayerSetGroupAction(NetworkPlayerId_t playerId, uint8_t groupId)
: _playerId(playerId)
, _groupId(groupId)
namespace OpenRCT2::GameActions
{
}
PlayerSetGroupAction::PlayerSetGroupAction(NetworkPlayerId_t playerId, uint8_t groupId)
: _playerId(playerId)
, _groupId(groupId)
{
}
void PlayerSetGroupAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
visitor.Visit("playerId", _playerId);
visitor.Visit("groupId", _groupId);
}
void PlayerSetGroupAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
visitor.Visit("playerId", _playerId);
visitor.Visit("groupId", _groupId);
}
uint16_t PlayerSetGroupAction::GetActionFlags() const
{
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
}
uint16_t PlayerSetGroupAction::GetActionFlags() const
{
return GameAction::GetActionFlags() | Flags::AllowWhilePaused;
}
void PlayerSetGroupAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
void PlayerSetGroupAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
stream << DS_TAG(_playerId) << DS_TAG(_groupId);
}
GameActions::Result PlayerSetGroupAction::Query() const
{
return NetworkSetPlayerGroup(GetPlayer(), _playerId, _groupId, false);
}
stream << DS_TAG(_playerId) << DS_TAG(_groupId);
}
Result PlayerSetGroupAction::Query() const
{
return NetworkSetPlayerGroup(GetPlayer(), _playerId, _groupId, false);
}
GameActions::Result PlayerSetGroupAction::Execute() const
{
return NetworkSetPlayerGroup(GetPlayer(), _playerId, _groupId, true);
}
Result PlayerSetGroupAction::Execute() const
{
return NetworkSetPlayerGroup(GetPlayer(), _playerId, _groupId, true);
}
} // namespace OpenRCT2::GameActions

View File

@@ -11,21 +11,24 @@
#include "GameAction.h"
class PlayerSetGroupAction final : public GameActionBase<GameCommand::SetPlayerGroup>
namespace OpenRCT2::GameActions
{
private:
NetworkPlayerId_t _playerId{ -1 };
uint8_t _groupId{ std::numeric_limits<uint8_t>::max() };
class PlayerSetGroupAction final : public GameActionBase<GameCommand::SetPlayerGroup>
{
private:
NetworkPlayerId_t _playerId{ -1 };
uint8_t _groupId{ std::numeric_limits<uint8_t>::max() };
public:
PlayerSetGroupAction() = default;
PlayerSetGroupAction(NetworkPlayerId_t playerId, uint8_t groupId);
public:
PlayerSetGroupAction() = default;
PlayerSetGroupAction(NetworkPlayerId_t playerId, uint8_t groupId);
void AcceptParameters(GameActionParameterVisitor& visitor) override;
void AcceptParameters(GameActionParameterVisitor& visitor) override;
uint16_t GetActionFlags() const override;
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
OpenRCT2::GameActions::Result Query() const override;
OpenRCT2::GameActions::Result Execute() const override;
};
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
};
} // namespace OpenRCT2::GameActions

View File

@@ -14,245 +14,245 @@
#include "../windows/Intent.h"
#include "../world/TileInspector.h"
using namespace OpenRCT2;
TileModifyAction::TileModifyAction(
CoordsXY loc, TileModifyType setting, uint32_t value1, uint32_t value2, TileElement pasteElement, Banner pasteBanner)
: _loc(loc)
, _setting(setting)
, _value1(value1)
, _value2(value2)
, _pasteElement(pasteElement)
, _pasteBanner(pasteBanner)
namespace OpenRCT2::GameActions
{
}
void TileModifyAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
visitor.Visit(_loc);
visitor.Visit("setting", _setting);
visitor.Visit("value1", _value1);
visitor.Visit("value2", _value2);
}
uint16_t TileModifyAction::GetActionFlags() const
{
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
}
void TileModifyAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
stream << DS_TAG(_loc) << DS_TAG(_setting) << DS_TAG(_value1) << DS_TAG(_value2) << DS_TAG(_pasteElement)
<< DS_TAG(_pasteBanner);
}
GameActions::Result TileModifyAction::Query() const
{
return QueryExecute(false);
}
GameActions::Result TileModifyAction::Execute() const
{
return QueryExecute(true);
}
GameActions::Result TileModifyAction::QueryExecute(bool isExecuting) const
{
if (!LocationValid(_loc))
TileModifyAction::TileModifyAction(
CoordsXY loc, TileModifyType setting, uint32_t value1, uint32_t value2, TileElement pasteElement, Banner pasteBanner)
: _loc(loc)
, _setting(setting)
, _value1(value1)
, _value2(value2)
, _pasteElement(pasteElement)
, _pasteBanner(pasteBanner)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_OFF_EDGE_OF_MAP);
}
auto res = GameActions::Result();
switch (_setting)
{
case TileModifyType::AnyRemove:
{
const auto elementIndex = _value1;
res = TileInspector::RemoveElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnySwap:
{
const auto firstIndex = _value1;
const auto secondIndex = _value2;
res = TileInspector::SwapElementsAt(_loc, firstIndex, secondIndex, isExecuting);
break;
}
case TileModifyType::AnyToggleInvisilibity:
{
const auto elementIndex = _value1;
res = TileInspector::ToggleInvisibilityOfElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnyRotate:
{
const auto elementIndex = _value1;
res = TileInspector::RotateElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnyPaste:
{
res = TileInspector::PasteElementAt(_loc, _pasteElement, _pasteBanner, isExecuting);
break;
}
case TileModifyType::AnySort:
{
res = TileInspector::SortElementsAt(_loc, isExecuting);
break;
}
case TileModifyType::AnyBaseHeightOffset:
{
const auto elementIndex = _value1;
const auto heightOffset = _value2;
res = TileInspector::AnyBaseHeightOffset(_loc, elementIndex, heightOffset, isExecuting);
break;
}
case TileModifyType::SurfaceShowParkFences:
{
const bool showFences = _value1;
res = TileInspector::SurfaceShowParkFences(_loc, showFences, isExecuting);
break;
}
case TileModifyType::SurfaceToggleCorner:
{
const auto cornerIndex = _value1;
res = TileInspector::SurfaceToggleCorner(_loc, cornerIndex, isExecuting);
break;
}
case TileModifyType::SurfaceToggleDiagonal:
{
res = TileInspector::SurfaceToggleDiagonal(_loc, isExecuting);
break;
}
case TileModifyType::PathSetSlope:
{
const auto elementIndex = _value1;
const bool sloped = _value2;
res = TileInspector::PathSetSloped(_loc, elementIndex, sloped, isExecuting);
break;
}
case TileModifyType::PathSetJunctionRailings:
{
const auto elementIndex = _value1;
const bool hasJunctionRailing = _value2;
res = TileInspector::PathSetJunctionRailings(_loc, elementIndex, hasJunctionRailing, isExecuting);
break;
}
case TileModifyType::PathSetBroken:
{
const auto elementIndex = _value1;
const bool broken = _value2;
res = TileInspector::PathSetBroken(_loc, elementIndex, broken, isExecuting);
break;
}
case TileModifyType::PathToggleEdge:
{
const auto elementIndex = _value1;
const auto edgeIndex = _value2;
res = TileInspector::PathToggleEdge(_loc, elementIndex, edgeIndex, isExecuting);
break;
}
case TileModifyType::EntranceMakeUsable:
{
const auto elementIndex = _value1;
res = TileInspector::EntranceMakeUsable(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::WallSetSlope:
{
const auto elementIndex = _value1;
const auto slopeValue = _value2;
res = TileInspector::WallSetSlope(_loc, elementIndex, slopeValue, isExecuting);
break;
}
case TileModifyType::WallSetAnimationFrame:
{
const auto elementIndex = _value1;
const auto animationFrameOffset = _value2;
res = TileInspector::WallAnimationFrameOffset(_loc, elementIndex, animationFrameOffset, isExecuting);
break;
}
case TileModifyType::TrackBaseHeightOffset:
{
const auto elementIndex = _value1;
const auto heightOffset = _value2;
res = TileInspector::TrackBaseHeightOffset(_loc, elementIndex, heightOffset, isExecuting);
break;
}
case TileModifyType::TrackSetChainBlock:
{
const auto elementIndex = _value1;
const bool setChain = _value2;
res = TileInspector::TrackSetChain(_loc, elementIndex, true, setChain, isExecuting);
break;
}
case TileModifyType::TrackSetChain:
{
const auto elementIndex = _value1;
const bool setChain = _value2;
res = TileInspector::TrackSetChain(_loc, elementIndex, false, setChain, isExecuting);
break;
}
case TileModifyType::TrackSetBrake:
{
const auto elementIndex = _value1;
const bool isClosed = _value2;
res = TileInspector::TrackSetBrakeClosed(_loc, elementIndex, isClosed, isExecuting);
break;
}
case TileModifyType::TrackSetIndestructible:
{
const auto elementIndex = _value1;
const bool isIndestructible = _value2;
res = TileInspector::TrackSetIndestructible(_loc, elementIndex, isIndestructible, isExecuting);
break;
}
case TileModifyType::ScenerySetQuarterLocation:
{
const auto elementIndex = _value1;
const auto quarterIndex = _value2;
res = TileInspector::ScenerySetQuarterLocation(_loc, elementIndex, quarterIndex, isExecuting);
break;
}
case TileModifyType::ScenerySetQuarterCollision:
{
const auto elementIndex = _value1;
const auto quarterIndex = _value2;
res = TileInspector::ScenerySetQuarterCollision(_loc, elementIndex, quarterIndex, isExecuting);
break;
}
case TileModifyType::BannerToggleBlockingEdge:
{
const auto elementIndex = _value1;
const auto edgeIndex = _value2;
res = TileInspector::BannerToggleBlockingEdge(_loc, elementIndex, edgeIndex, isExecuting);
break;
}
case TileModifyType::WallSetAnimationIsBackwards:
{
const auto elementIndex = _value1;
const bool broken = _value2;
res = TileInspector::WallSetAnimationIsBackwards(_loc, elementIndex, broken, isExecuting);
break;
}
default:
LOG_ERROR("Invalid tile modification type %u", _setting);
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
res.Position.x = _loc.x;
res.Position.y = _loc.y;
res.Position.z = TileElementHeight(_loc);
if (isExecuting)
void TileModifyAction::AcceptParameters(GameActionParameterVisitor& visitor)
{
MapInvalidateTileFull(_loc);
auto intent = Intent(INTENT_ACTION_TILE_MODIFY);
ContextBroadcastIntent(&intent);
visitor.Visit(_loc);
visitor.Visit("setting", _setting);
visitor.Visit("value1", _value1);
visitor.Visit("value2", _value2);
}
return res;
}
uint16_t TileModifyAction::GetActionFlags() const
{
return GameAction::GetActionFlags() | Flags::AllowWhilePaused;
}
void TileModifyAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
stream << DS_TAG(_loc) << DS_TAG(_setting) << DS_TAG(_value1) << DS_TAG(_value2) << DS_TAG(_pasteElement)
<< DS_TAG(_pasteBanner);
}
Result TileModifyAction::Query() const
{
return QueryExecute(false);
}
Result TileModifyAction::Execute() const
{
return QueryExecute(true);
}
Result TileModifyAction::QueryExecute(bool isExecuting) const
{
if (!LocationValid(_loc))
{
return Result(Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_OFF_EDGE_OF_MAP);
}
auto res = Result();
switch (_setting)
{
case TileModifyType::AnyRemove:
{
const auto elementIndex = _value1;
res = TileInspector::RemoveElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnySwap:
{
const auto firstIndex = _value1;
const auto secondIndex = _value2;
res = TileInspector::SwapElementsAt(_loc, firstIndex, secondIndex, isExecuting);
break;
}
case TileModifyType::AnyToggleInvisilibity:
{
const auto elementIndex = _value1;
res = TileInspector::ToggleInvisibilityOfElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnyRotate:
{
const auto elementIndex = _value1;
res = TileInspector::RotateElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnyPaste:
{
res = TileInspector::PasteElementAt(_loc, _pasteElement, _pasteBanner, isExecuting);
break;
}
case TileModifyType::AnySort:
{
res = TileInspector::SortElementsAt(_loc, isExecuting);
break;
}
case TileModifyType::AnyBaseHeightOffset:
{
const auto elementIndex = _value1;
const auto heightOffset = _value2;
res = TileInspector::AnyBaseHeightOffset(_loc, elementIndex, heightOffset, isExecuting);
break;
}
case TileModifyType::SurfaceShowParkFences:
{
const bool showFences = _value1;
res = TileInspector::SurfaceShowParkFences(_loc, showFences, isExecuting);
break;
}
case TileModifyType::SurfaceToggleCorner:
{
const auto cornerIndex = _value1;
res = TileInspector::SurfaceToggleCorner(_loc, cornerIndex, isExecuting);
break;
}
case TileModifyType::SurfaceToggleDiagonal:
{
res = TileInspector::SurfaceToggleDiagonal(_loc, isExecuting);
break;
}
case TileModifyType::PathSetSlope:
{
const auto elementIndex = _value1;
const bool sloped = _value2;
res = TileInspector::PathSetSloped(_loc, elementIndex, sloped, isExecuting);
break;
}
case TileModifyType::PathSetJunctionRailings:
{
const auto elementIndex = _value1;
const bool hasJunctionRailing = _value2;
res = TileInspector::PathSetJunctionRailings(_loc, elementIndex, hasJunctionRailing, isExecuting);
break;
}
case TileModifyType::PathSetBroken:
{
const auto elementIndex = _value1;
const bool broken = _value2;
res = TileInspector::PathSetBroken(_loc, elementIndex, broken, isExecuting);
break;
}
case TileModifyType::PathToggleEdge:
{
const auto elementIndex = _value1;
const auto edgeIndex = _value2;
res = TileInspector::PathToggleEdge(_loc, elementIndex, edgeIndex, isExecuting);
break;
}
case TileModifyType::EntranceMakeUsable:
{
const auto elementIndex = _value1;
res = TileInspector::EntranceMakeUsable(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::WallSetSlope:
{
const auto elementIndex = _value1;
const auto slopeValue = _value2;
res = TileInspector::WallSetSlope(_loc, elementIndex, slopeValue, isExecuting);
break;
}
case TileModifyType::WallSetAnimationFrame:
{
const auto elementIndex = _value1;
const auto animationFrameOffset = _value2;
res = TileInspector::WallAnimationFrameOffset(_loc, elementIndex, animationFrameOffset, isExecuting);
break;
}
case TileModifyType::TrackBaseHeightOffset:
{
const auto elementIndex = _value1;
const auto heightOffset = _value2;
res = TileInspector::TrackBaseHeightOffset(_loc, elementIndex, heightOffset, isExecuting);
break;
}
case TileModifyType::TrackSetChainBlock:
{
const auto elementIndex = _value1;
const bool setChain = _value2;
res = TileInspector::TrackSetChain(_loc, elementIndex, true, setChain, isExecuting);
break;
}
case TileModifyType::TrackSetChain:
{
const auto elementIndex = _value1;
const bool setChain = _value2;
res = TileInspector::TrackSetChain(_loc, elementIndex, false, setChain, isExecuting);
break;
}
case TileModifyType::TrackSetBrake:
{
const auto elementIndex = _value1;
const bool isClosed = _value2;
res = TileInspector::TrackSetBrakeClosed(_loc, elementIndex, isClosed, isExecuting);
break;
}
case TileModifyType::TrackSetIndestructible:
{
const auto elementIndex = _value1;
const bool isIndestructible = _value2;
res = TileInspector::TrackSetIndestructible(_loc, elementIndex, isIndestructible, isExecuting);
break;
}
case TileModifyType::ScenerySetQuarterLocation:
{
const auto elementIndex = _value1;
const auto quarterIndex = _value2;
res = TileInspector::ScenerySetQuarterLocation(_loc, elementIndex, quarterIndex, isExecuting);
break;
}
case TileModifyType::ScenerySetQuarterCollision:
{
const auto elementIndex = _value1;
const auto quarterIndex = _value2;
res = TileInspector::ScenerySetQuarterCollision(_loc, elementIndex, quarterIndex, isExecuting);
break;
}
case TileModifyType::BannerToggleBlockingEdge:
{
const auto elementIndex = _value1;
const auto edgeIndex = _value2;
res = TileInspector::BannerToggleBlockingEdge(_loc, elementIndex, edgeIndex, isExecuting);
break;
}
case TileModifyType::WallSetAnimationIsBackwards:
{
const auto elementIndex = _value1;
const bool broken = _value2;
res = TileInspector::WallSetAnimationIsBackwards(_loc, elementIndex, broken, isExecuting);
break;
}
default:
LOG_ERROR("Invalid tile modification type %u", _setting);
return Result(Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}
res.Position.x = _loc.x;
res.Position.y = _loc.y;
res.Position.z = TileElementHeight(_loc);
if (isExecuting)
{
MapInvalidateTileFull(_loc);
auto intent = Intent(INTENT_ACTION_TILE_MODIFY);
ContextBroadcastIntent(&intent);
}
return res;
}
} // namespace OpenRCT2::GameActions

View File

@@ -11,61 +11,64 @@
#include "GameAction.h"
enum class TileModifyType : uint8_t
namespace OpenRCT2::GameActions
{
AnyRemove,
AnySwap,
AnyToggleInvisilibity,
AnyRotate,
AnyPaste,
AnySort,
AnyBaseHeightOffset,
SurfaceShowParkFences,
SurfaceToggleCorner,
SurfaceToggleDiagonal,
PathSetSlope,
PathSetBroken,
PathToggleEdge,
PathSetJunctionRailings,
EntranceMakeUsable,
WallSetSlope,
WallSetAnimationFrame,
TrackBaseHeightOffset,
TrackSetChain,
TrackSetChainBlock,
TrackSetBrake,
TrackSetIndestructible,
ScenerySetQuarterLocation,
ScenerySetQuarterCollision,
BannerToggleBlockingEdge,
WallSetAnimationIsBackwards,
Count,
};
enum class TileModifyType : uint8_t
{
AnyRemove,
AnySwap,
AnyToggleInvisilibity,
AnyRotate,
AnyPaste,
AnySort,
AnyBaseHeightOffset,
SurfaceShowParkFences,
SurfaceToggleCorner,
SurfaceToggleDiagonal,
PathSetSlope,
PathSetBroken,
PathToggleEdge,
PathSetJunctionRailings,
EntranceMakeUsable,
WallSetSlope,
WallSetAnimationFrame,
TrackBaseHeightOffset,
TrackSetChain,
TrackSetChainBlock,
TrackSetBrake,
TrackSetIndestructible,
ScenerySetQuarterLocation,
ScenerySetQuarterCollision,
BannerToggleBlockingEdge,
WallSetAnimationIsBackwards,
Count,
};
class TileModifyAction final : public GameActionBase<GameCommand::ModifyTile>
{
private:
CoordsXY _loc;
TileModifyType _setting{};
uint32_t _value1{};
uint32_t _value2{};
OpenRCT2::TileElement _pasteElement{};
Banner _pasteBanner{};
class TileModifyAction final : public GameActionBase<GameCommand::ModifyTile>
{
private:
CoordsXY _loc;
TileModifyType _setting{};
uint32_t _value1{};
uint32_t _value2{};
TileElement _pasteElement{};
Banner _pasteBanner{};
public:
TileModifyAction() = default;
TileModifyAction(
CoordsXY loc, TileModifyType setting, uint32_t value1 = 0, uint32_t value2 = 0, OpenRCT2::TileElement pasteElement = {},
Banner _pasteBanner = {});
public:
TileModifyAction() = default;
TileModifyAction(
CoordsXY loc, TileModifyType setting, uint32_t value1 = 0, uint32_t value2 = 0, TileElement pasteElement = {},
Banner _pasteBanner = {});
void AcceptParameters(GameActionParameterVisitor& visitor) override;
void AcceptParameters(GameActionParameterVisitor& visitor) override;
uint16_t GetActionFlags() const override;
uint16_t GetActionFlags() const override;
void Serialise(DataSerialiser& stream) override;
OpenRCT2::GameActions::Result Query() const override;
OpenRCT2::GameActions::Result Execute() const override;
void Serialise(DataSerialiser& stream) override;
Result Query() const override;
Result Execute() const override;
private:
OpenRCT2::GameActions::Result QueryExecute(bool isExecuting) const;
};
private:
Result QueryExecute(bool isExecuting) const;
};
} // namespace OpenRCT2::GameActions

View File

@@ -239,7 +239,7 @@ namespace OpenRCT2::Scripting
if (index < numPlayers)
{
auto playerId = NetworkGetPlayerID(index);
auto kickPlayerAction = PlayerKickAction(playerId);
auto kickPlayerAction = GameActions::PlayerKickAction(playerId);
GameActions::Execute(&kickPlayerAction);
}
}
@@ -248,7 +248,7 @@ namespace OpenRCT2::Scripting
auto index = NetworkGetPlayerIndex(id);
if (index != -1)
{
auto kickPlayerAction = PlayerKickAction(id);
auto kickPlayerAction = GameActions::PlayerKickAction(id);
GameActions::Execute(&kickPlayerAction);
}
}

View File

@@ -54,7 +54,7 @@ namespace OpenRCT2::Scripting
void ScPlayer::group_set(int32_t value)
{
#ifndef DISABLE_NETWORK
auto playerSetGroupAction = PlayerSetGroupAction(_id, value);
auto playerSetGroupAction = GameActions::PlayerSetGroupAction(_id, value);
GameActions::Execute(&playerSetGroupAction);
#endif
}