mirror of https://github.com/OpenRCT2/OpenRCT2.git
Rename GameActionResult and use GameActions namespace instead (#13184)
This commit is contained in:
parent
92e7b6244b
commit
645289f4ec
|
@ -864,8 +864,8 @@ static void window_footpath_place_path_at_point(const ScreenCoordsXY& screenCoor
|
|||
// Try and place path
|
||||
gGameCommandErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
|
||||
auto footpathPlaceAction = FootpathPlaceAction({ info.Loc, z }, slope, selectedType);
|
||||
footpathPlaceAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
footpathPlaceAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
// Don't play sound if it is no cost to prevent multiple sounds. TODO: make this work in no money scenarios
|
||||
if (result->Cost != 0)
|
||||
|
@ -954,8 +954,8 @@ static void window_footpath_construct()
|
|||
|
||||
gGameCommandErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
|
||||
auto footpathPlaceAction = FootpathPlaceAction(footpathLoc, slope, type, gFootpathConstructDirection);
|
||||
footpathPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
footpathPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
|
||||
|
|
|
@ -587,8 +587,8 @@ void window_guest_overview_mouse_up(rct_window* w, rct_widgetindex widgetIndex)
|
|||
CoordsXYZ nullLoc{};
|
||||
nullLoc.setNull();
|
||||
PeepPickupAction pickupAction{ PeepPickupType::Pickup, w->number, nullLoc, network_get_current_player_id() };
|
||||
pickupAction.SetCallback([peepnum = w->number](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
pickupAction.SetCallback([peepnum = w->number](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
rct_window* wind = window_find_by_number(WC_PEEP, peepnum);
|
||||
if (wind)
|
||||
|
@ -1188,8 +1188,8 @@ void window_guest_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex,
|
|||
PeepPickupAction pickupAction{
|
||||
PeepPickupType::Place, w->number, { destCoords, tileElement->GetBaseZ() }, network_get_current_player_id()
|
||||
};
|
||||
pickupAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
pickupAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
|
|
|
@ -354,7 +354,7 @@ static void window_land_rights_tool_update_land_rights(const ScreenCoordsXY& scr
|
|||
: LandBuyRightSetting::BuyConstructionRights);
|
||||
auto res = GameActions::Query(&landBuyRightsAction);
|
||||
|
||||
_landRightsCost = res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
_landRightsCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1291,7 +1291,7 @@ static void window_map_place_park_entrance_tool_down(const ScreenCoordsXY& scree
|
|||
{
|
||||
auto gameAction = PlaceParkEntranceAction(parkEntrancePosition);
|
||||
auto result = GameActions::Execute(&gameAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
}
|
||||
|
@ -1316,7 +1316,7 @@ static void window_map_set_peep_spawn_tool_down(const ScreenCoordsXY& screenCoor
|
|||
|
||||
auto gameAction = PlacePeepSpawnAction({ mapCoords, mapZ, static_cast<Direction>(direction) });
|
||||
auto result = GameActions::Execute(&gameAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
}
|
||||
|
|
|
@ -373,8 +373,8 @@ static void window_maze_construction_entrance_tooldown(const ScreenCoordsXY& scr
|
|||
entranceOrExitCoords, direction_reverse(entranceOrExitCoords.direction), rideIndex, gRideEntranceExitPlaceStationIndex,
|
||||
gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
|
||||
|
||||
rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
|
|
|
@ -186,8 +186,8 @@ static void window_new_campaign_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
case WIDX_START_BUTTON:
|
||||
{
|
||||
auto gameAction = ParkMarketingAction(w->campaign.campaign_type, w->campaign.RideId, w->campaign.no_weeks);
|
||||
gameAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
window_close_by_class(WC_NEW_CAMPAIGN);
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ private:
|
|||
req.method = Http::Method::GET;
|
||||
req.url = url;
|
||||
Http::DoAsync(req, [this, entry, name](Http::Response response) {
|
||||
if (response.status == Http::Status::OK)
|
||||
if (response.status == Http::Status::Ok)
|
||||
{
|
||||
// Check that download operation hasn't been cancelled
|
||||
if (_downloadingObjects)
|
||||
|
@ -208,7 +208,7 @@ private:
|
|||
req.method = Http::Method::GET;
|
||||
req.url = OPENRCT2_API_LEGACY_OBJECT_URL + name;
|
||||
Http::DoAsync(req, [this, entry, name](Http::Response response) {
|
||||
if (response.status == Http::Status::OK)
|
||||
if (response.status == Http::Status::Ok)
|
||||
{
|
||||
auto jresponse = Json::FromString(response.body);
|
||||
if (jresponse.is_object())
|
||||
|
|
|
@ -276,8 +276,8 @@ void window_player_overview_dropdown(rct_window* w, rct_widgetindex widgetIndex,
|
|||
}
|
||||
int32_t group = network_get_group_id(dropdownIndex);
|
||||
auto playerSetGroupAction = PlayerSetGroupAction(w->number, group);
|
||||
playerSetGroupAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
playerSetGroupAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
w->Invalidate();
|
||||
}
|
||||
|
|
|
@ -2252,7 +2252,7 @@ static void window_ride_main_dropdown(rct_window* w, rct_widgetindex widgetIndex
|
|||
if (rideType < RIDE_TYPE_COUNT)
|
||||
{
|
||||
auto rideSetSetting = RideSetSettingAction(w->number, RideSetSetting::RideType, rideType);
|
||||
rideSetSetting.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
||||
rideSetSetting.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
// Reset ghost track if ride construction window is open, prevents a crash
|
||||
// Will get set to the correct Alternative variable during set_default_next_piece.
|
||||
// TODO: Rework construction window to prevent the need for this.
|
||||
|
|
|
@ -1684,7 +1684,7 @@ static void CloseConstructWindowOnCompletion(Ride* ride)
|
|||
|
||||
static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const TrackPlaceActionResult* result)
|
||||
{
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
window_ride_construction_update_active_elements();
|
||||
return;
|
||||
|
@ -1728,7 +1728,7 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c
|
|||
|
||||
static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const TrackPlaceActionResult* result)
|
||||
{
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
window_ride_construction_update_active_elements();
|
||||
return;
|
||||
|
@ -1801,7 +1801,7 @@ static void window_ride_construction_construct(rct_window* w)
|
|||
}
|
||||
auto res = GameActions::Execute(&trackPlaceAction);
|
||||
// Used by some functions
|
||||
if (res->Error != GA_ERROR::OK)
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
{
|
||||
if (auto error = res->ErrorMessage.AsStringId())
|
||||
gGameCommandErrorText = *error;
|
||||
|
@ -1815,7 +1815,7 @@ static void window_ride_construction_construct(rct_window* w)
|
|||
_trackPlaceCost = res->Cost;
|
||||
}
|
||||
|
||||
if (res->Error != GA_ERROR::OK)
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1929,8 +1929,8 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
|
|||
_currentTrackPieceType, 0,
|
||||
{ _currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, _currentTrackPieceDirection });
|
||||
|
||||
trackRemoveAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
trackRemoveAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
window_ride_construction_update_active_elements();
|
||||
}
|
||||
|
@ -3413,7 +3413,7 @@ static void ride_construction_set_brakes_speed(int32_t brakesSpeed)
|
|||
auto trackSetBrakeSpeed = TrackSetBrakeSpeedAction(
|
||||
_currentTrackBegin, tileElement->AsTrack()->GetTrackType(), brakesSpeed);
|
||||
trackSetBrakeSpeed.SetCallback(
|
||||
[](const GameAction* ga, const GameActionResult* result) { window_ride_construction_update_active_elements(); });
|
||||
[](const GameAction* ga, const GameActions::Result* result) { window_ride_construction_update_active_elements(); });
|
||||
GameActions::Execute(&trackSetBrakeSpeed);
|
||||
return;
|
||||
}
|
||||
|
@ -3884,8 +3884,8 @@ static void ride_construction_tooldown_entrance_exit(const ScreenCoordsXY& scree
|
|||
entranceOrExitCoords, direction_reverse(gRideEntranceExitPlaceDirection), gRideEntranceExitPlaceRideIndex,
|
||||
gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
|
||||
|
||||
rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
|
|
|
@ -417,8 +417,8 @@ void window_staff_overview_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
|||
CoordsXYZ nullLoc{};
|
||||
nullLoc.setNull();
|
||||
PeepPickupAction pickupAction{ PeepPickupType::Pickup, w->number, nullLoc, network_get_current_player_id() };
|
||||
pickupAction.SetCallback([peepnum = w->number](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
pickupAction.SetCallback([peepnum = w->number](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
rct_window* wind = window_find_by_number(WC_PEEP, peepnum);
|
||||
if (wind)
|
||||
|
@ -1212,8 +1212,8 @@ void window_staff_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex,
|
|||
PeepPickupAction pickupAction{
|
||||
PeepPickupType::Place, w->number, { destCoords, tileElement->GetBaseZ() }, network_get_current_player_id()
|
||||
};
|
||||
pickupAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
pickupAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
|
|
|
@ -1807,7 +1807,7 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
zAttemptRange = 20;
|
||||
}
|
||||
|
||||
auto success = GA_ERROR::UNKNOWN;
|
||||
auto success = GameActions::Status::Unknown;
|
||||
// Try find a valid z coordinate
|
||||
for (; zAttemptRange != 0; zAttemptRange--)
|
||||
{
|
||||
|
@ -1816,12 +1816,12 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
primaryColour, secondaryColour);
|
||||
auto res = GameActions::Query(&smallSceneryPlaceAction);
|
||||
success = res->Error;
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (res->Error == GA_ERROR::INSUFFICIENT_FUNDS)
|
||||
if (res->Error == GameActions::Status::InsufficientFunds)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -1832,25 +1832,25 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
}
|
||||
|
||||
// Actually place
|
||||
if (success == GA_ERROR::OK || ((q + 1 == quantity) && forceError))
|
||||
if (success == GameActions::Status::Ok || ((q + 1 == quantity) && forceError))
|
||||
{
|
||||
auto smallSceneryPlaceAction = SmallSceneryPlaceAction(
|
||||
{ cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery,
|
||||
primaryColour, secondaryColour);
|
||||
|
||||
smallSceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
smallSceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
}
|
||||
});
|
||||
auto res = GameActions::Execute(&smallSceneryPlaceAction);
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
forceError = false;
|
||||
}
|
||||
|
||||
if (res->Error == GA_ERROR::INSUFFICIENT_FUNDS)
|
||||
if (res->Error == GameActions::Status::InsufficientFunds)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -1868,8 +1868,8 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
|
||||
auto footpathSceneryPlaceAction = FootpathSceneryPlaceAction({ gridPos, z }, selectedScenery + 1);
|
||||
|
||||
footpathSceneryPlaceAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
footpathSceneryPlaceAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1898,7 +1898,7 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
selectedScenery, { gridPos, gSceneryPlaceZ }, edges, primaryColour, _secondaryColour, _tertiaryColour);
|
||||
|
||||
auto res = GameActions::Query(&wallPlaceAction);
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -1920,8 +1920,8 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
auto wallPlaceAction = WallPlaceAction(
|
||||
selectedScenery, { gridPos, gSceneryPlaceZ }, edges, primaryColour, _secondaryColour, _tertiaryColour);
|
||||
|
||||
wallPlaceAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
wallPlaceAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
}
|
||||
|
@ -1951,7 +1951,7 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
auto sceneryPlaceAction = LargeSceneryPlaceAction(loc, selectedScenery, primaryColour, secondaryColour);
|
||||
|
||||
auto res = GameActions::Query(&sceneryPlaceAction);
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -1973,8 +1973,8 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
CoordsXYZD loc = { gridPos, gSceneryPlaceZ, direction };
|
||||
|
||||
auto sceneryPlaceAction = LargeSceneryPlaceAction(loc, selectedScenery, primaryColour, secondaryColour);
|
||||
sceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
sceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
}
|
||||
|
@ -2003,8 +2003,8 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
break;
|
||||
}
|
||||
auto bannerPlaceAction = BannerPlaceAction(loc, selectedScenery, bannerIndex, primaryColour);
|
||||
bannerPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
bannerPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
context_open_detail_window(WD_BANNER, bannerIndex);
|
||||
|
@ -2097,7 +2097,7 @@ static void top_toolbar_tool_update_scenery_clear(const ScreenCoordsXY& screenPo
|
|||
|
||||
auto action = GetClearAction();
|
||||
auto result = GameActions::Query(&action);
|
||||
auto cost = (result->Error == GA_ERROR::OK ? result->Cost : MONEY32_UNDEFINED);
|
||||
auto cost = (result->Error == GameActions::Status::Ok ? result->Cost : MONEY32_UNDEFINED);
|
||||
if (gClearSceneryCost != cost)
|
||||
{
|
||||
gClearSceneryCost = cost;
|
||||
|
@ -2362,10 +2362,10 @@ static void top_toolbar_tool_update_water(const ScreenCoordsXY& screenPos)
|
|||
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
|
||||
|
||||
auto res = GameActions::Query(&waterLowerAction);
|
||||
money32 lowerCost = res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
money32 lowerCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
|
||||
res = GameActions::Query(&waterRaiseAction);
|
||||
money32 raiseCost = res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
money32 raiseCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
|
||||
if (gWaterToolRaiseCost != raiseCost || gWaterToolLowerCost != lowerCost)
|
||||
{
|
||||
|
@ -2453,10 +2453,10 @@ static void top_toolbar_tool_update_water(const ScreenCoordsXY& screenPos)
|
|||
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y });
|
||||
|
||||
auto res = GameActions::Query(&waterLowerAction);
|
||||
money32 lowerCost = res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
money32 lowerCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
|
||||
res = GameActions::Query(&waterRaiseAction);
|
||||
money32 raiseCost = res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
money32 raiseCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
|
||||
if (gWaterToolRaiseCost != raiseCost || gWaterToolLowerCost != lowerCost)
|
||||
{
|
||||
|
@ -2496,7 +2496,7 @@ static money32 try_place_ghost_scenery(
|
|||
smallSceneryPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
|
||||
auto res = GameActions::Execute(&smallSceneryPlaceAction);
|
||||
auto sspar = dynamic_cast<SmallSceneryPlaceActionResult*>(res.get());
|
||||
if (sspar == nullptr || res->Error != GA_ERROR::OK)
|
||||
if (sspar == nullptr || res->Error != GameActions::Status::Ok)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
gSceneryPlaceRotation = static_cast<uint16_t>(parameter_3 & 0xFF);
|
||||
|
@ -2528,8 +2528,8 @@ static money32 try_place_ghost_scenery(
|
|||
int32_t z = (parameter_2 & 0xFF) * COORDS_Z_STEP;
|
||||
auto footpathSceneryPlaceAction = FootpathSceneryPlaceAction({ map_tile.x, map_tile.y, z }, entryIndex + 1);
|
||||
footpathSceneryPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
|
||||
footpathSceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
footpathSceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2537,7 +2537,7 @@ static money32 try_place_ghost_scenery(
|
|||
gSceneryGhostType |= SCENERY_GHOST_FLAG_1;
|
||||
});
|
||||
auto res = GameActions::Execute(&footpathSceneryPlaceAction);
|
||||
if (res->Error != GA_ERROR::OK)
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
cost = res->Cost;
|
||||
|
@ -2555,7 +2555,7 @@ static money32 try_place_ghost_scenery(
|
|||
wallPlaceAction.SetFlags(
|
||||
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
|
||||
wallPlaceAction.SetCallback([=](const GameAction* ga, const WallPlaceActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
|
||||
gSceneryGhostPosition = { map_tile, result->tileElement->GetBaseZ() };
|
||||
|
@ -2565,7 +2565,7 @@ static money32 try_place_ghost_scenery(
|
|||
});
|
||||
|
||||
auto res = GameActions::Execute(&wallPlaceAction);
|
||||
if (res->Error != GA_ERROR::OK)
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
return MONEY32_UNDEFINED;
|
||||
cost = res->Cost;
|
||||
break;
|
||||
|
@ -2584,7 +2584,7 @@ static money32 try_place_ghost_scenery(
|
|||
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
|
||||
auto res = GameActions::Execute(&sceneryPlaceAction);
|
||||
auto lspar = dynamic_cast<LargeSceneryPlaceActionResult*>(res.get());
|
||||
if (lspar == nullptr || res->Error != GA_ERROR::OK)
|
||||
if (lspar == nullptr || res->Error != GameActions::Status::Ok)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
gSceneryPlaceRotation = loc.direction;
|
||||
|
@ -2625,7 +2625,7 @@ static money32 try_place_ghost_scenery(
|
|||
bannerPlaceAction.SetFlags(
|
||||
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
|
||||
auto res = GameActions::Execute(&bannerPlaceAction);
|
||||
if (res->Error != GA_ERROR::OK)
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
gSceneryGhostPosition = loc;
|
||||
|
@ -3005,7 +3005,7 @@ static money32 selection_raise_land(uint8_t flags)
|
|||
false);
|
||||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction)
|
||||
: GameActions::Query(&landSmoothAction);
|
||||
return res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3015,7 +3015,7 @@ static money32 selection_raise_land(uint8_t flags)
|
|||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction)
|
||||
: GameActions::Query(&landRaiseAction);
|
||||
|
||||
return res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3038,7 +3038,7 @@ static money32 selection_lower_land(uint8_t flags)
|
|||
true);
|
||||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction)
|
||||
: GameActions::Query(&landSmoothAction);
|
||||
return res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3048,7 +3048,7 @@ static money32 selection_lower_land(uint8_t flags)
|
|||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction)
|
||||
: GameActions::Query(&landLowerAction);
|
||||
|
||||
return res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,9 +224,9 @@ static void window_track_place_update(rct_window* w)
|
|||
window_close(w);
|
||||
}
|
||||
|
||||
static GameActionResult::Ptr FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, uint32_t flags)
|
||||
static GameActions::Result::Ptr FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, uint32_t flags)
|
||||
{
|
||||
GameActionResult::Ptr res;
|
||||
GameActions::Result::Ptr res;
|
||||
for (int32_t i = 0; i < 7; i++, loc.z += 8)
|
||||
{
|
||||
auto tdAction = TrackDesignAction(CoordsXYZD{ loc.x, loc.y, loc.z, _currentTrackPieceDirection }, *_trackDesign);
|
||||
|
@ -235,7 +235,7 @@ static GameActionResult::Ptr FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, uin
|
|||
|
||||
// If successful dont keep trying.
|
||||
// If failure due to no money then increasing height only makes problem worse
|
||||
if (res->Error == GA_ERROR::OK || res->Error == GA_ERROR::INSUFFICIENT_FUNDS)
|
||||
if (res->Error == GameActions::Status::Ok || res->Error == GameActions::Status::InsufficientFunds)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
@ -282,13 +282,13 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI
|
|||
window_track_place_clear_provisional();
|
||||
auto res = FindValidTrackDesignPlaceHeight(trackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
|
||||
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
// Valid location found. Place the ghost at the location.
|
||||
auto tdAction = TrackDesignAction({ trackLoc, _currentTrackPieceDirection }, *_trackDesign);
|
||||
tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
|
||||
tdAction.SetCallback([trackLoc](const GameAction*, const TrackDesignActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
_window_track_place_ride_index = result->rideIndex;
|
||||
_windowTrackPlaceLastValid = trackLoc;
|
||||
|
@ -296,7 +296,7 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI
|
|||
}
|
||||
});
|
||||
res = GameActions::Execute(&tdAction);
|
||||
cost = res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
cost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,11 +331,11 @@ static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetInd
|
|||
CoordsXYZ trackLoc = { mapCoords, mapZ };
|
||||
|
||||
auto res = FindValidTrackDesignPlaceHeight(trackLoc, 0);
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
auto tdAction = TrackDesignAction({ trackLoc, _currentTrackPieceDirection }, *_trackDesign);
|
||||
tdAction.SetCallback([trackLoc](const GameAction*, const TrackDesignActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
auto ride = get_ride(result->rideIndex);
|
||||
if (ride != nullptr)
|
||||
|
@ -435,7 +435,7 @@ void TrackPlaceRestoreProvisional()
|
|||
auto tdAction = TrackDesignAction({ _windowTrackPlaceLastValid, _currentTrackPieceDirection }, *_trackDesign);
|
||||
tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
|
||||
auto res = GameActions::Execute(&tdAction);
|
||||
if (res->Error != GA_ERROR::OK)
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
{
|
||||
_window_track_place_last_was_valid = false;
|
||||
}
|
||||
|
|
|
@ -1159,7 +1159,7 @@ namespace OpenRCT2
|
|||
try
|
||||
{
|
||||
res = Do(request);
|
||||
if (res.status != Http::Status::OK)
|
||||
if (res.status != Http::Status::Ok)
|
||||
throw std::runtime_error("bad http status");
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
|
|
@ -851,8 +851,8 @@ namespace OpenRCT2
|
|||
GameAction* action = command.action.get();
|
||||
action->SetFlags(action->GetFlags() | GAME_COMMAND_FLAG_REPLAY);
|
||||
|
||||
GameActionResult::Ptr result = GameActions::Execute(action);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
GameActions::Result::Ptr result = GameActions::Execute(action);
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
isPositionValid = true;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ NewVersionInfo get_latest_version()
|
|||
try
|
||||
{
|
||||
res = Do(request);
|
||||
if (res.status != Http::Status::OK)
|
||||
if (res.status != Http::Status::Ok)
|
||||
throw std::runtime_error("bad http status");
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BalloonPressAction, GAME_COMMAND_BALLOON_PRESS, GameActionResult)
|
||||
DEFINE_GAME_ACTION(BalloonPressAction, GAME_COMMAND_BALLOON_PRESS, GameActions::Result)
|
||||
{
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
||||
|
@ -34,24 +34,24 @@ public:
|
|||
stream << DS_TAG(_spriteIndex);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto balloon = TryGetEntity<Balloon>(_spriteIndex);
|
||||
if (balloon == nullptr)
|
||||
{
|
||||
log_error("Tried getting invalid sprite for balloon: %u", _spriteIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto balloon = TryGetEntity<Balloon>(_spriteIndex);
|
||||
if (balloon == nullptr)
|
||||
{
|
||||
log_error("Tried getting invalid sprite for balloon: %u", _spriteIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
balloon->Press();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "../world/Scenery.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BannerPlaceAction, GAME_COMMAND_PLACE_BANNER, GameActionResult)
|
||||
DEFINE_GAME_ACTION(BannerPlaceAction, GAME_COMMAND_PLACE_BANNER, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_bannerType) << DS_TAG(_bannerIndex) << DS_TAG(_primaryColour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Position.x = _loc.x + 16;
|
||||
|
@ -65,57 +65,58 @@ public:
|
|||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
log_error("No free map elements.");
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
auto pathElement = GetValidPathElement();
|
||||
|
||||
if (pathElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS);
|
||||
return MakeResult(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS);
|
||||
}
|
||||
|
||||
if (!map_can_build_at(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
auto baseHeight = _loc.z + PATH_HEIGHT_STEP;
|
||||
BannerElement* existingBannerElement = map_get_banner_element_at({ _loc.x, _loc.y, baseHeight }, _loc.direction);
|
||||
if (existingBannerElement != nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::ITEM_ALREADY_PLACED, STR_CANT_POSITION_THIS_HERE, STR_BANNER_SIGN_IN_THE_WAY);
|
||||
return MakeResult(GameActions::Status::ItemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE, STR_BANNER_SIGN_IN_THE_WAY);
|
||||
}
|
||||
|
||||
if (_bannerIndex == BANNER_INDEX_NULL || _bannerIndex >= MAX_BANNERS)
|
||||
{
|
||||
log_error("Invalid banner index, bannerIndex = %u", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
auto banner = GetBanner(_bannerIndex);
|
||||
if (!banner->IsNull())
|
||||
{
|
||||
log_error("Banner index in use, bannerIndex = %u", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
rct_scenery_entry* bannerEntry = get_banner_entry(_bannerType);
|
||||
if (bannerEntry == nullptr)
|
||||
{
|
||||
log_error("Invalid banner object type. bannerType = ", _bannerType);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
res->Cost = bannerEntry->banner.price;
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Position.x = _loc.x + 16;
|
||||
|
@ -127,27 +128,27 @@ public:
|
|||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
log_error("No free map elements.");
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
if (_bannerIndex == BANNER_INDEX_NULL || _bannerIndex >= MAX_BANNERS)
|
||||
{
|
||||
log_error("Invalid banner index, bannerIndex = %u", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
rct_scenery_entry* bannerEntry = get_banner_entry(_bannerType);
|
||||
if (bannerEntry == nullptr)
|
||||
{
|
||||
log_error("Invalid banner object type. bannerType = ", _bannerType);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
auto banner = GetBanner(_bannerIndex);
|
||||
if (!banner->IsNull())
|
||||
{
|
||||
log_error("Banner index in use, bannerIndex = %u", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
TileElement* newTileElement = tile_element_insert({ _loc, _loc.z + (2 * COORDS_Z_STEP) }, 0b0000);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "../world/Scenery.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BannerRemoveAction, GAME_COMMAND_REMOVE_BANNER, GameActionResult)
|
||||
DEFINE_GAME_ACTION(BannerRemoveAction, GAME_COMMAND_REMOVE_BANNER, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
stream << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
if (!LocationValid(_loc) || !map_can_build_at({ _loc.x, _loc.y, _loc.z - 16 }))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
BannerElement* bannerElement = GetBannerElementAt();
|
||||
|
@ -63,20 +63,20 @@ public:
|
|||
{
|
||||
log_error(
|
||||
"Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
if (bannerElement->GetIndex() >= MAX_BANNERS || bannerElement->GetIndex() == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Invalid banner index. index = ", bannerElement->GetIndex());
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
auto banner = bannerElement->GetBanner();
|
||||
if (banner == nullptr)
|
||||
{
|
||||
log_error("Invalid banner index. index = ", bannerElement->GetIndex());
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
rct_scenery_entry* bannerEntry = get_banner_entry(banner->type);
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
@ -102,20 +102,20 @@ public:
|
|||
{
|
||||
log_error(
|
||||
"Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
if (bannerElement->GetIndex() >= MAX_BANNERS || bannerElement->GetIndex() == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Invalid banner index. index = ", bannerElement->GetIndex());
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
auto banner = bannerElement->GetBanner();
|
||||
if (banner == nullptr)
|
||||
{
|
||||
log_error("Invalid banner index. index = ", bannerElement->GetIndex());
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
rct_scenery_entry* bannerEntry = get_banner_entry(banner->type);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "../world/Banner.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BannerSetColourAction, GAME_COMMAND_SET_BANNER_COLOUR, GameActionResult)
|
||||
DEFINE_GAME_ACTION(BannerSetColourAction, GAME_COMMAND_SET_BANNER_COLOUR, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -42,18 +42,18 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_primaryColour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
@ -65,18 +65,18 @@ private:
|
|||
if (!LocationValid(_loc))
|
||||
{
|
||||
log_error("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (_primaryColour > 31)
|
||||
{
|
||||
log_error("Invalid primary colour: colour = %u", _primaryColour);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (!map_can_build_at({ _loc.x, _loc.y, _loc.z - 16 }))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
auto bannerElement = map_get_banner_element_at(_loc, _loc.direction);
|
||||
|
@ -85,14 +85,14 @@ private:
|
|||
{
|
||||
log_error(
|
||||
"Could not find banner at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
auto index = bannerElement->GetIndex();
|
||||
if (index >= MAX_BANNERS || index == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Invalid banner index: index = %u", index);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (isExecuting)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BannerSetNameAction, GAME_COMMAND_SET_BANNER_NAME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(BannerSetNameAction, GAME_COMMAND_SET_BANNER_NAME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
BannerIndex _bannerIndex{ BANNER_INDEX_NULL };
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -45,17 +45,17 @@ public:
|
|||
stream << DS_TAG(_bannerIndex) << DS_TAG(_name);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_bannerIndex >= MAX_BANNERS)
|
||||
{
|
||||
log_warning("Invalid game command for setting banner name, banner id = %d", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto banner = GetBanner(_bannerIndex);
|
||||
banner->text = _name;
|
||||
|
|
|
@ -26,7 +26,7 @@ enum class BannerSetStyleType : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(BannerSetStyleAction, GAME_COMMAND_SET_BANNER_STYLE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(BannerSetStyleAction, GAME_COMMAND_SET_BANNER_STYLE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
BannerSetStyleType _type{ BannerSetStyleType::Count };
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -55,13 +55,13 @@ public:
|
|||
stream << DS_TAG(_type) << DS_TAG(_bannerIndex) << DS_TAG(_parameter);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
|
||||
if (_bannerIndex >= MAX_BANNERS || _bannerIndex == BANNER_INDEX_NULL)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
auto banner = GetBanner(_bannerIndex);
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
if (tileElement == nullptr)
|
||||
{
|
||||
log_error("Could not find banner index = %u", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
if (_parameter > 31)
|
||||
{
|
||||
log_error("Invalid primary colour: colour = %u", _parameter);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -92,24 +92,24 @@ public:
|
|||
if (_parameter > 13)
|
||||
{
|
||||
log_error("Invalid text colour: colour = %u", _parameter);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
break;
|
||||
case BannerSetStyleType::NoEntry:
|
||||
if (tileElement->AsBanner() == nullptr)
|
||||
{
|
||||
log_error("Tile element was not a banner.");
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_NONE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log_error("Invalid type: %u", _type);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
if (tileElement == nullptr)
|
||||
{
|
||||
log_error("Could not find banner index = %u", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
if (bannerElement == nullptr)
|
||||
{
|
||||
log_error("Tile element was not a banner.");
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_NONE);
|
||||
}
|
||||
|
||||
banner->flags &= ~BANNER_FLAG_NO_ENTRY;
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
}
|
||||
default:
|
||||
log_error("Invalid type: %u", _type);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace CLEARABLE_ITEMS
|
|||
constexpr ClearableItems SCENERY_FOOTPATH = 1 << 2;
|
||||
} // namespace CLEARABLE_ITEMS
|
||||
|
||||
DEFINE_GAME_ACTION(ClearAction, GAME_COMMAND_CLEAR_SCENERY, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ClearAction, GAME_COMMAND_CLEAR_SCENERY, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
@ -57,18 +57,18 @@ public:
|
|||
stream << DS_TAG(_range) << DS_TAG(_itemsToClear);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr CreateResult() const
|
||||
GameActions::Result::Ptr CreateResult() const
|
||||
{
|
||||
auto result = MakeResult();
|
||||
result->ErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
||||
|
@ -82,12 +82,12 @@ private:
|
|||
return result;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr QueryExecute(bool executing) const
|
||||
GameActions::Result::Ptr QueryExecute(bool executing) const
|
||||
{
|
||||
auto result = CreateResult();
|
||||
|
||||
auto noValidTiles = true;
|
||||
auto error = GA_ERROR::OK;
|
||||
auto error = GameActions::Status::Ok;
|
||||
rct_string_id errorMessage = STR_NONE;
|
||||
money32 totalCost = 0;
|
||||
|
||||
|
@ -111,7 +111,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
error = GA_ERROR::NOT_OWNED;
|
||||
error = GameActions::Status::NotOwned;
|
||||
errorMessage = STR_LAND_NOT_OWNED_BY_PARK;
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ private:
|
|||
auto res = executing ? GameActions::ExecuteNested(&footpathRemoveAction)
|
||||
: GameActions::QueryNested(&footpathRemoveAction);
|
||||
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
totalCost += res->Cost;
|
||||
tileEdited = executing;
|
||||
|
@ -179,7 +179,7 @@ private:
|
|||
auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction)
|
||||
: GameActions::QueryNested(&removeSceneryAction);
|
||||
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
totalCost += res->Cost;
|
||||
tileEdited = executing;
|
||||
|
@ -196,7 +196,7 @@ private:
|
|||
auto res = executing ? GameActions::ExecuteNested(&wallRemoveAction)
|
||||
: GameActions::QueryNested(&wallRemoveAction);
|
||||
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
totalCost += res->Cost;
|
||||
tileEdited = executing;
|
||||
|
@ -214,7 +214,7 @@ private:
|
|||
auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction)
|
||||
: GameActions::QueryNested(&removeSceneryAction);
|
||||
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
totalCost += res->Cost;
|
||||
tileEdited = executing;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../world/Climate.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ClimateSetAction, GAME_COMMAND_SET_CLIMATE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ClimateSetAction, GAME_COMMAND_SET_CLIMATE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
ClimateType _climate{};
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -36,22 +36,23 @@ public:
|
|||
stream << DS_TAG(_climate);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_climate >= ClimateType::Count)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_CLIMATE_ID, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_INVALID_CLIMATE_ID, STR_NONE);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
gClimate = ClimateType{ _climate };
|
||||
|
||||
gfx_invalidate_screen();
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# include "../scripting/ScriptEngine.h"
|
||||
# include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(CustomAction, GAME_COMMAND_CUSTOM, GameActionResult)
|
||||
DEFINE_GAME_ACTION(CustomAction, GAME_COMMAND_CUSTOM, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
std::string _id;
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -50,13 +50,13 @@ public:
|
|||
stream << DS_TAG(_id) << DS_TAG(_json);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto& scriptingEngine = OpenRCT2::GetContext()->GetScriptEngine();
|
||||
return scriptingEngine.QueryOrExecuteCustomGameAction(_id, _json, false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto& scriptingEngine = OpenRCT2::GetContext()->GetScriptEngine();
|
||||
return scriptingEngine.QueryOrExecuteCustomGameAction(_id, _json, true);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "../world/Wall.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathPlaceAction, GAME_COMMAND_PLACE_PATH, GameActionResult)
|
||||
DEFINE_GAME_ACTION(FootpathPlaceAction, GAME_COMMAND_PLACE_PATH, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -61,9 +61,9 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_slope) << DS_TAG(_type) << DS_TAG(_direction);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
res->Position = _loc.ToTileCentre();
|
||||
|
@ -72,33 +72,33 @@ public:
|
|||
|
||||
if (!LocationValid(_loc) || map_is_edge(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (_slope & SLOPE_IS_IRREGULAR_FLAG)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_SLOPE_UNSUITABLE);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_SLOPE_UNSUITABLE);
|
||||
}
|
||||
|
||||
if (_loc.z < FootpathMinHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_LOW);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_LOW);
|
||||
}
|
||||
|
||||
if (_loc.z > FootpathMaxHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH);
|
||||
}
|
||||
|
||||
if (_direction != INVALID_DIRECTION && !direction_valid(_direction))
|
||||
{
|
||||
log_error("Direction invalid. direction = %u", _direction);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
}
|
||||
|
||||
footpath_provisional_remove();
|
||||
|
@ -113,9 +113,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
res->Position = _loc.ToTileCentre();
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr ElementUpdateQuery(PathElement * pathElement, GameActionResult::Ptr res) const
|
||||
GameActions::Result::Ptr ElementUpdateQuery(PathElement * pathElement, GameActions::Result::Ptr res) const
|
||||
{
|
||||
const int32_t newFootpathType = (_type & (FOOTPATH_PROPERTIES_TYPE_MASK >> 4));
|
||||
const bool newPathIsQueue = ((_type >> 7) == 1);
|
||||
|
@ -169,12 +169,12 @@ private:
|
|||
|
||||
if (GetFlags() & GAME_COMMAND_FLAG_GHOST && !pathElement->IsGhost())
|
||||
{
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr ElementUpdateExecute(PathElement * pathElement, GameActionResult::Ptr res) const
|
||||
GameActions::Result::Ptr ElementUpdateExecute(PathElement * pathElement, GameActions::Result::Ptr res) const
|
||||
{
|
||||
const int32_t newFootpathType = (_type & (FOOTPATH_PROPERTIES_TYPE_MASK >> 4));
|
||||
const bool newPathIsQueue = ((_type >> 7) == 1);
|
||||
|
@ -222,13 +222,13 @@ private:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr ElementInsertQuery(GameActionResult::Ptr res) const
|
||||
GameActions::Result::Ptr ElementInsertQuery(GameActions::Result::Ptr res) const
|
||||
{
|
||||
bool entrancePath = false, entranceIsSamePath = false;
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
}
|
||||
|
||||
res->Cost = MONEY(12, 00);
|
||||
|
@ -262,19 +262,20 @@ private:
|
|||
&& !map_can_construct_with_clear_at(
|
||||
{ _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GetFlags(), &res->Cost, crossingMode))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, STR_CANT_BUILD_FOOTPATH_HERE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
return MakeResult(
|
||||
GameActions::Status::NoClearance, STR_CANT_BUILD_FOOTPATH_HERE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
gFootpathGroundFlags = gMapGroundFlags;
|
||||
if (!gCheatsDisableClearanceChecks && (gMapGroundFlags & ELEMENT_IS_UNDERWATER))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
|
||||
auto surfaceElement = map_get_surface_element_at(_loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
}
|
||||
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
|
||||
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
|
||||
|
@ -286,7 +287,7 @@ private:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr ElementInsertExecute(GameActionResult::Ptr res) const
|
||||
GameActions::Result::Ptr ElementInsertExecute(GameActions::Result::Ptr res) const
|
||||
{
|
||||
bool entrancePath = false, entranceIsSamePath = false;
|
||||
|
||||
|
@ -327,7 +328,8 @@ private:
|
|||
{ _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(),
|
||||
&res->Cost, crossingMode))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, STR_CANT_BUILD_FOOTPATH_HERE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
return MakeResult(
|
||||
GameActions::Status::NoClearance, STR_CANT_BUILD_FOOTPATH_HERE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
gFootpathGroundFlags = gMapGroundFlags;
|
||||
|
@ -335,7 +337,7 @@ private:
|
|||
auto surfaceElement = map_get_surface_element_at(_loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE);
|
||||
}
|
||||
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
|
||||
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../world/Wall.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathPlaceFromTrackAction, GAME_COMMAND_PLACE_PATH_FROM_TRACK, GameActionResult)
|
||||
DEFINE_GAME_ACTION(FootpathPlaceFromTrackAction, GAME_COMMAND_PLACE_PATH_FROM_TRACK, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -52,9 +52,9 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_slope) << DS_TAG(_type) << DS_TAG(_edges);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
res->Position = _loc.ToTileCentre();
|
||||
|
@ -64,30 +64,31 @@ public:
|
|||
if (!LocationValid(_loc) || map_is_edge(_loc))
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(
|
||||
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (_loc.z < FootpathMinHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_LOW);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_LOW);
|
||||
}
|
||||
|
||||
if (_loc.z > FootpathMaxHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_HIGH);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_HIGH);
|
||||
}
|
||||
|
||||
return ElementInsertQuery(std::move(res));
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
res->Position = _loc.ToTileCentre();
|
||||
|
@ -106,13 +107,13 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr ElementInsertQuery(GameActionResult::Ptr res) const
|
||||
GameActions::Result::Ptr ElementInsertQuery(GameActions::Result::Ptr res) const
|
||||
{
|
||||
bool entrancePath = false, entranceIsSamePath = false;
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
|
||||
}
|
||||
|
||||
res->Cost = MONEY(12, 00);
|
||||
|
@ -147,7 +148,7 @@ private:
|
|||
{ _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GetFlags(), &res->Cost, crossingMode))
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::NO_CLEARANCE, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, gGameCommandErrorText,
|
||||
GameActions::Status::NoClearance, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, gGameCommandErrorText,
|
||||
gCommonFormatArgs);
|
||||
}
|
||||
|
||||
|
@ -155,13 +156,14 @@ private:
|
|||
if (!gCheatsDisableClearanceChecks && (gMapGroundFlags & ELEMENT_IS_UNDERWATER))
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE,
|
||||
STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
|
||||
auto surfaceElement = map_get_surface_element_at(_loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
|
||||
}
|
||||
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
|
||||
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
|
||||
|
@ -173,7 +175,7 @@ private:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr ElementInsertExecute(GameActionResult::Ptr res) const
|
||||
GameActions::Result::Ptr ElementInsertExecute(GameActions::Result::Ptr res) const
|
||||
{
|
||||
bool entrancePath = false, entranceIsSamePath = false;
|
||||
|
||||
|
@ -215,7 +217,7 @@ private:
|
|||
&res->Cost, crossingMode))
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::NO_CLEARANCE, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, gGameCommandErrorText,
|
||||
GameActions::Status::NoClearance, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, gGameCommandErrorText,
|
||||
gCommonFormatArgs);
|
||||
}
|
||||
|
||||
|
@ -224,7 +226,7 @@ private:
|
|||
auto surfaceElement = map_get_surface_element_at(_loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
|
||||
}
|
||||
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
|
||||
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "BannerRemoveAction.hpp"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathRemoveAction, GAME_COMMAND_REMOVE_PATH, GameActionResult)
|
||||
DEFINE_GAME_ACTION(FootpathRemoveAction, GAME_COMMAND_REMOVE_PATH, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -51,27 +51,27 @@ public:
|
|||
stream << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
res->Position = { _loc.x + 16, _loc.y + 16, _loc.z };
|
||||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
TileElement* footpathElement = GetFootpathElement();
|
||||
if (footpathElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
|
||||
}
|
||||
|
||||
res->Cost = GetRefundPrice(footpathElement);
|
||||
|
@ -79,9 +79,9 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
res->Position = { _loc.x + 16, _loc.y + 16, _loc.z };
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
{
|
||||
footpath_queue_chain_reset();
|
||||
auto bannerRes = RemoveBannersAtElement(_loc, footpathElement);
|
||||
if (bannerRes->Error == GA_ERROR::OK)
|
||||
if (bannerRes->Error == GameActions::Status::Ok)
|
||||
{
|
||||
res->Cost += bannerRes->Cost;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
|
||||
}
|
||||
|
||||
res->Cost += GetRefundPrice(footpathElement);
|
||||
|
@ -167,7 +167,7 @@ private:
|
|||
*
|
||||
* rct2: 0x006BA23E
|
||||
*/
|
||||
GameActionResult::Ptr RemoveBannersAtElement(const CoordsXY& loc, TileElement* tileElement) const
|
||||
GameActions::Result::Ptr RemoveBannersAtElement(const CoordsXY& loc, TileElement* tileElement) const
|
||||
{
|
||||
auto result = MakeResult();
|
||||
while (!(tileElement++)->IsLastForTile())
|
||||
|
@ -184,7 +184,7 @@ private:
|
|||
bannerRemoveAction.SetFlags(bannerFlags);
|
||||
auto res = GameActions::ExecuteNested(&bannerRemoveAction);
|
||||
// Ghost removal is free
|
||||
if (res->Error == GA_ERROR::OK && !isGhost)
|
||||
if (res->Error == GameActions::Status::Ok && !isGhost)
|
||||
{
|
||||
result->Cost += res->Cost;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../world/Wall.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathSceneryPlaceAction, GAME_COMMAND_PLACE_FOOTPATH_SCENERY, GameActionResult)
|
||||
DEFINE_GAME_ACTION(FootpathSceneryPlaceAction, GAME_COMMAND_PLACE_FOOTPATH_SCENERY, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -54,43 +54,44 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_pathItemType);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
res->Position = _loc;
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (_loc.z < FootpathMinHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_TOO_LOW);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_LOW);
|
||||
}
|
||||
|
||||
if (_loc.z > FootpathMaxHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_TOO_HIGH);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_HIGH);
|
||||
}
|
||||
|
||||
auto tileElement = map_get_footpath_element(_loc);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
log_error("Could not find path element.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
auto pathElement = tileElement->AsPath();
|
||||
if (pathElement->IsLevelCrossing(_loc))
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_CANNOT_BUILD_PATH_ADDITIONS_ON_LEVEL_CROSSINGS);
|
||||
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE,
|
||||
STR_CANNOT_BUILD_PATH_ADDITIONS_ON_LEVEL_CROSSINGS);
|
||||
}
|
||||
|
||||
// No change
|
||||
|
@ -105,32 +106,35 @@ public:
|
|||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(_pathItemType - 1);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
uint16_t sceneryFlags = sceneryEntry->path_bit.flags;
|
||||
|
||||
if ((sceneryFlags & PATH_BIT_FLAG_DONT_ALLOW_ON_SLOPE) && pathElement->IsSloped())
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH);
|
||||
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE,
|
||||
STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH);
|
||||
}
|
||||
|
||||
if ((sceneryFlags & PATH_BIT_FLAG_DONT_ALLOW_ON_QUEUE) && pathElement->IsQueue())
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_CANNOT_PLACE_THESE_ON_QUEUE_LINE_AREA);
|
||||
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE,
|
||||
STR_CANNOT_PLACE_THESE_ON_QUEUE_LINE_AREA);
|
||||
}
|
||||
|
||||
if (!(sceneryFlags & (PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER | PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW))
|
||||
&& (pathElement->GetEdges()) == 0x0F)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
if ((sceneryFlags & PATH_BIT_FLAG_IS_QUEUE_SCREEN) && !pathElement->IsQueue())
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA);
|
||||
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE,
|
||||
STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA);
|
||||
}
|
||||
|
||||
res->Cost = sceneryEntry->path_bit.price;
|
||||
|
@ -142,13 +146,13 @@ public:
|
|||
// Check if there is something on the path already
|
||||
if (pathElement->HasAddition())
|
||||
{
|
||||
return MakeResult(GA_ERROR::ITEM_ALREADY_PLACED, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::ItemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Position = _loc;
|
||||
|
@ -160,7 +164,7 @@ public:
|
|||
if (pathElement == nullptr)
|
||||
{
|
||||
log_error("Could not find path element.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
// No change
|
||||
|
@ -175,7 +179,7 @@ public:
|
|||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(_pathItemType - 1);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
|
||||
}
|
||||
|
||||
res->Cost = sceneryEntry->path_bit.price;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "../world/Wall.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(FootpathSceneryRemoveAction, GAME_COMMAND_REMOVE_FOOTPATH_SCENERY, GameActionResult)
|
||||
DEFINE_GAME_ACTION(FootpathSceneryRemoveAction, GAME_COMMAND_REMOVE_FOOTPATH_SCENERY, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -51,46 +51,46 @@ public:
|
|||
stream << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (_loc.z < FootpathMinHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_TOO_LOW);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_LOW);
|
||||
}
|
||||
|
||||
if (_loc.z > FootpathMaxHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_TOO_HIGH);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_HIGH);
|
||||
}
|
||||
|
||||
auto tileElement = map_get_footpath_element(_loc);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
log_warning("Could not find path element.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
auto pathElement = tileElement->AsPath();
|
||||
if (pathElement == nullptr)
|
||||
{
|
||||
log_warning("Could not find path element.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
if (!pathElement->AdditionIsGhost() && (GetFlags() & GAME_COMMAND_FLAG_GHOST))
|
||||
{
|
||||
log_warning("Tried to remove non ghost during ghost removal.");
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
auto res = MakeResult();
|
||||
res->Position = _loc;
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto tileElement = map_get_footpath_element(_loc);
|
||||
auto pathElement = tileElement->AsPath();
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
if (pathElement == nullptr)
|
||||
{
|
||||
log_error("Could not find path element.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
pathElement->SetAddition(0);
|
||||
|
|
|
@ -31,57 +31,57 @@
|
|||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
GameActionResult::GameActionResult(GA_ERROR error, rct_string_id message)
|
||||
{
|
||||
Error = error;
|
||||
ErrorMessage = message;
|
||||
}
|
||||
|
||||
GameActionResult::GameActionResult(GA_ERROR error, rct_string_id title, rct_string_id message)
|
||||
{
|
||||
Error = error;
|
||||
ErrorTitle = title;
|
||||
ErrorMessage = message;
|
||||
}
|
||||
|
||||
GameActionResult::GameActionResult(GA_ERROR error, rct_string_id title, rct_string_id message, uint8_t* args)
|
||||
{
|
||||
Error = error;
|
||||
ErrorTitle = title;
|
||||
ErrorMessage = message;
|
||||
std::copy_n(args, ErrorMessageArgs.size(), ErrorMessageArgs.begin());
|
||||
}
|
||||
|
||||
std::string GameActionResult::GetErrorTitle() const
|
||||
{
|
||||
std::string title;
|
||||
if (auto error = ErrorTitle.AsString())
|
||||
{
|
||||
title = *error;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = format_string(ErrorTitle.GetStringId(), ErrorMessageArgs.data());
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
std::string GameActionResult::GetErrorMessage() const
|
||||
{
|
||||
std::string message;
|
||||
if (auto error = ErrorMessage.AsString())
|
||||
{
|
||||
message = *error;
|
||||
}
|
||||
else
|
||||
{
|
||||
message = format_string(ErrorMessage.GetStringId(), ErrorMessageArgs.data());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
namespace GameActions
|
||||
{
|
||||
Result::Result(GameActions::Status error, rct_string_id message)
|
||||
{
|
||||
Error = error;
|
||||
ErrorMessage = message;
|
||||
}
|
||||
|
||||
Result::Result(GameActions::Status error, rct_string_id title, rct_string_id message)
|
||||
{
|
||||
Error = error;
|
||||
ErrorTitle = title;
|
||||
ErrorMessage = message;
|
||||
}
|
||||
|
||||
Result::Result(GameActions::Status error, rct_string_id title, rct_string_id message, uint8_t* args)
|
||||
{
|
||||
Error = error;
|
||||
ErrorTitle = title;
|
||||
ErrorMessage = message;
|
||||
std::copy_n(args, ErrorMessageArgs.size(), ErrorMessageArgs.begin());
|
||||
}
|
||||
|
||||
std::string GameActions::Result::GetErrorTitle() const
|
||||
{
|
||||
std::string title;
|
||||
if (auto error = ErrorTitle.AsString())
|
||||
{
|
||||
title = *error;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = format_string(ErrorTitle.GetStringId(), ErrorMessageArgs.data());
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
std::string GameActions::Result::GetErrorMessage() const
|
||||
{
|
||||
std::string message;
|
||||
if (auto error = ErrorMessage.AsString())
|
||||
{
|
||||
message = *error;
|
||||
}
|
||||
else
|
||||
{
|
||||
message = format_string(ErrorMessage.GetStringId(), ErrorMessageArgs.data());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
struct QueuedGameAction
|
||||
{
|
||||
uint32_t tick;
|
||||
|
@ -207,8 +207,8 @@ namespace GameActions
|
|||
|
||||
Guard::Assert(action != nullptr);
|
||||
|
||||
GameActionResult::Ptr result = Execute(action);
|
||||
if (result->Error == GA_ERROR::OK && network_get_mode() == NETWORK_MODE_SERVER)
|
||||
GameActions::Result::Ptr result = Execute(action);
|
||||
if (result->Error == GameActions::Status::Ok && network_get_mode() == NETWORK_MODE_SERVER)
|
||||
{
|
||||
// Relay this action to all other clients.
|
||||
network_send_game_action(action);
|
||||
|
@ -278,21 +278,21 @@ namespace GameActions
|
|||
return true;
|
||||
if (gCheatsBuildInPauseMode)
|
||||
return true;
|
||||
if (actionFlags & GA_FLAGS::ALLOW_WHILE_PAUSED)
|
||||
if (actionFlags & GameActions::Flags::AllowWhilePaused)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static GameActionResult::Ptr QueryInternal(const GameAction* action, bool topLevel)
|
||||
static GameActions::Result::Ptr QueryInternal(const GameAction* action, bool topLevel)
|
||||
{
|
||||
Guard::ArgumentNotNull(action);
|
||||
|
||||
uint16_t actionFlags = action->GetActionFlags();
|
||||
if (topLevel && !CheckActionInPausedMode(actionFlags))
|
||||
{
|
||||
GameActionResult::Ptr result = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr result = std::make_unique<GameActions::Result>();
|
||||
|
||||
result->Error = GA_ERROR::GAME_PAUSED;
|
||||
result->Error = GameActions::Status::GamePaused;
|
||||
result->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
result->ErrorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
|
||||
|
||||
|
@ -301,11 +301,11 @@ namespace GameActions
|
|||
|
||||
auto result = action->Query();
|
||||
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
if (!finance_check_affordability(result->Cost, action->GetFlags()))
|
||||
{
|
||||
result->Error = GA_ERROR::INSUFFICIENT_FUNDS;
|
||||
result->Error = GameActions::Status::InsufficientFunds;
|
||||
result->ErrorTitle = STR_CANT_DO_THIS;
|
||||
result->ErrorMessage = STR_NOT_ENOUGH_CASH_REQUIRES;
|
||||
Formatter(result->ErrorMessageArgs.data()).Add<uint32_t>(result->Cost);
|
||||
|
@ -314,12 +314,12 @@ namespace GameActions
|
|||
return result;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query(const GameAction* action)
|
||||
GameActions::Result::Ptr Query(const GameAction* action)
|
||||
{
|
||||
return QueryInternal(action, true);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr QueryNested(const GameAction* action)
|
||||
GameActions::Result::Ptr QueryNested(const GameAction* action)
|
||||
{
|
||||
return QueryInternal(action, false);
|
||||
}
|
||||
|
@ -355,13 +355,13 @@ namespace GameActions
|
|||
action->Serialise(ds);
|
||||
}
|
||||
|
||||
static void LogActionFinish(ActionLogContext_t& ctx, const GameAction* action, const GameActionResult::Ptr& result)
|
||||
static void LogActionFinish(ActionLogContext_t& ctx, const GameAction* action, const GameActions::Result::Ptr& result)
|
||||
{
|
||||
MemoryStream& output = ctx.output;
|
||||
|
||||
char temp[128] = {};
|
||||
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
snprintf(temp, sizeof(temp), ") Failed, %u", static_cast<uint32_t>(result->Error));
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ namespace GameActions
|
|||
network_append_server_log(text);
|
||||
}
|
||||
|
||||
static GameActionResult::Ptr ExecuteInternal(const GameAction* action, bool topLevel)
|
||||
static GameActions::Result::Ptr ExecuteInternal(const GameAction* action, bool topLevel)
|
||||
{
|
||||
Guard::ArgumentNotNull(action);
|
||||
|
||||
|
@ -392,9 +392,9 @@ namespace GameActions
|
|||
if ((flags & GAME_COMMAND_FLAG_REPLAY) == 0)
|
||||
{
|
||||
// TODO: Introduce proper error.
|
||||
GameActionResult::Ptr result = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr result = std::make_unique<GameActions::Result>();
|
||||
|
||||
result->Error = GA_ERROR::GAME_PAUSED;
|
||||
result->Error = GameActions::Status::GamePaused;
|
||||
result->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
result->ErrorMessage = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
|
||||
|
||||
|
@ -402,9 +402,9 @@ namespace GameActions
|
|||
}
|
||||
}
|
||||
|
||||
GameActionResult::Ptr result = QueryInternal(action, topLevel);
|
||||
GameActions::Result::Ptr result = QueryInternal(action, topLevel);
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
if (result->Error == GA_ERROR::OK
|
||||
if (result->Error == GameActions::Status::Ok
|
||||
&& ((network_get_mode() == NETWORK_MODE_NONE) || (flags & GAME_COMMAND_FLAG_NETWORKED)))
|
||||
{
|
||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||
|
@ -412,7 +412,7 @@ namespace GameActions
|
|||
// Script hooks may now have changed the game action result...
|
||||
}
|
||||
#endif
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
if (topLevel)
|
||||
{
|
||||
|
@ -420,7 +420,7 @@ namespace GameActions
|
|||
if (network_get_mode() == NETWORK_MODE_CLIENT)
|
||||
{
|
||||
// As a client we have to wait or send it first.
|
||||
if (!(actionFlags & GA_FLAGS::CLIENT_ONLY) && !(flags & GAME_COMMAND_FLAG_NETWORKED))
|
||||
if (!(actionFlags & GameActions::Flags::ClientOnly) && !(flags & GAME_COMMAND_FLAG_NETWORKED))
|
||||
{
|
||||
log_verbose("[%s] GameAction::Execute %s (Out)", GetRealm(), action->GetName());
|
||||
network_send_game_action(action);
|
||||
|
@ -432,7 +432,7 @@ namespace GameActions
|
|||
{
|
||||
// If player is the server it would execute right away as where clients execute the commands
|
||||
// at the beginning of the frame, so we have to put them into the queue.
|
||||
if (!(actionFlags & GA_FLAGS::CLIENT_ONLY) && !(flags & GAME_COMMAND_FLAG_NETWORKED))
|
||||
if (!(actionFlags & GameActions::Flags::ClientOnly) && !(flags & GAME_COMMAND_FLAG_NETWORKED))
|
||||
{
|
||||
log_verbose("[%s] GameAction::Execute %s (Queue)", GetRealm(), action->GetName());
|
||||
Enqueue(action, gCurrentTicks);
|
||||
|
@ -448,7 +448,7 @@ namespace GameActions
|
|||
// Execute the action, changing the game state
|
||||
result = action->Execute();
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||
scriptEngine.RunGameActionHooks(*action, result, true);
|
||||
|
@ -463,13 +463,13 @@ namespace GameActions
|
|||
return result;
|
||||
|
||||
// Update money balance
|
||||
if (result->Error == GA_ERROR::OK && finance_check_money_required(flags) && result->Cost != 0)
|
||||
if (result->Error == GameActions::Status::Ok && finance_check_money_required(flags) && result->Cost != 0)
|
||||
{
|
||||
finance_payment(result->Cost, result->Expenditure);
|
||||
MoneyEffect::Create(result->Cost, result->Position);
|
||||
}
|
||||
|
||||
if (!(actionFlags & GA_FLAGS::CLIENT_ONLY) && result->Error == GA_ERROR::OK)
|
||||
if (!(actionFlags & GameActions::Flags::ClientOnly) && result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||
{
|
||||
|
@ -538,7 +538,7 @@ namespace GameActions
|
|||
}
|
||||
}
|
||||
|
||||
if (result->Error != GA_ERROR::OK && shouldShowError)
|
||||
if (result->Error != GameActions::Status::Ok && shouldShowError)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
windowManager->ShowError(result->GetErrorTitle(), result->GetErrorMessage());
|
||||
|
@ -547,12 +547,12 @@ namespace GameActions
|
|||
return result;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute(const GameAction* action)
|
||||
GameActions::Result::Ptr Execute(const GameAction* action)
|
||||
{
|
||||
return ExecuteInternal(action, true);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr ExecuteNested(const GameAction* action)
|
||||
GameActions::Result::Ptr ExecuteNested(const GameAction* action)
|
||||
{
|
||||
return ExecuteInternal(action, false);
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ bool GameAction::LocationValid(const CoordsXY& coords) const
|
|||
obj.Set("type", _type);
|
||||
|
||||
auto flags = GetActionFlags();
|
||||
obj.Set("isClientOnly", (flags & GA_FLAGS::CLIENT_ONLY) != 0);
|
||||
obj.Set("isClientOnly", (flags & GameActions::Flags::ClientOnly) != 0);
|
||||
obj.Set("result", true);
|
||||
|
||||
// Call the subscriptions
|
||||
|
|
|
@ -21,45 +21,6 @@
|
|||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* Common error codes for game actions.
|
||||
*/
|
||||
enum class GA_ERROR : uint16_t
|
||||
{
|
||||
OK,
|
||||
INVALID_PARAMETERS,
|
||||
DISALLOWED,
|
||||
GAME_PAUSED,
|
||||
INSUFFICIENT_FUNDS,
|
||||
NOT_IN_EDITOR_MODE,
|
||||
|
||||
NOT_OWNED,
|
||||
TOO_LOW,
|
||||
TOO_HIGH,
|
||||
NO_CLEARANCE,
|
||||
ITEM_ALREADY_PLACED,
|
||||
|
||||
NOT_CLOSED,
|
||||
BROKEN,
|
||||
|
||||
NO_FREE_ELEMENTS,
|
||||
|
||||
UNKNOWN = UINT16_MAX,
|
||||
};
|
||||
|
||||
namespace GA_FLAGS
|
||||
{
|
||||
constexpr uint16_t ALLOW_WHILE_PAUSED = 1 << 0;
|
||||
constexpr uint16_t CLIENT_ONLY = 1 << 1;
|
||||
constexpr uint16_t EDITOR_ONLY = 1 << 2;
|
||||
} // namespace GA_FLAGS
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
#endif
|
||||
|
||||
class StringVariant
|
||||
{
|
||||
private:
|
||||
|
@ -113,38 +74,81 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents the result of a game action query or execution.
|
||||
*/
|
||||
class GameActionResult
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
#endif
|
||||
|
||||
namespace GameActions
|
||||
{
|
||||
public:
|
||||
using Ptr = std::unique_ptr<GameActionResult>;
|
||||
/**
|
||||
* Common error codes for game actions.
|
||||
*/
|
||||
enum class Status : uint16_t
|
||||
{
|
||||
Ok,
|
||||
InvalidParameters,
|
||||
Disallowed,
|
||||
GamePaused,
|
||||
InsufficientFunds,
|
||||
NotInEditorMode,
|
||||
|
||||
GA_ERROR Error = GA_ERROR::OK;
|
||||
StringVariant ErrorTitle;
|
||||
StringVariant ErrorMessage;
|
||||
std::array<uint8_t, 32> ErrorMessageArgs;
|
||||
CoordsXYZ Position = { LOCATION_NULL, LOCATION_NULL, LOCATION_NULL };
|
||||
money32 Cost = 0;
|
||||
ExpenditureType Expenditure = ExpenditureType::Count;
|
||||
NotOwned,
|
||||
TooLow,
|
||||
TooHigh,
|
||||
NoClearance,
|
||||
ItemAlreadyPlaced,
|
||||
|
||||
GameActionResult() = default;
|
||||
GameActionResult(GA_ERROR error, rct_string_id message);
|
||||
GameActionResult(GA_ERROR error, rct_string_id title, rct_string_id message);
|
||||
GameActionResult(GA_ERROR error, rct_string_id title, rct_string_id message, uint8_t* args);
|
||||
GameActionResult(const GameActionResult&) = delete;
|
||||
virtual ~GameActionResult(){};
|
||||
NotClosed,
|
||||
Broken,
|
||||
|
||||
std::string GetErrorTitle() const;
|
||||
std::string GetErrorMessage() const;
|
||||
};
|
||||
NoFreeElements,
|
||||
|
||||
class ConstructClearResult final : public GameActionResult
|
||||
{
|
||||
public:
|
||||
uint8_t GroundFlags{ 0 };
|
||||
};
|
||||
Unknown = UINT16_MAX,
|
||||
};
|
||||
|
||||
namespace Flags
|
||||
{
|
||||
constexpr uint16_t AllowWhilePaused = 1 << 0;
|
||||
constexpr uint16_t ClientOnly = 1 << 1;
|
||||
constexpr uint16_t EditorOnly = 1 << 2;
|
||||
} // namespace Flags
|
||||
|
||||
/**
|
||||
* Represents the result of a game action query or execution.
|
||||
*/
|
||||
class Result
|
||||
{
|
||||
public:
|
||||
using Ptr = std::unique_ptr<GameActions::Result>;
|
||||
|
||||
GameActions::Status Error = GameActions::Status::Ok;
|
||||
StringVariant ErrorTitle;
|
||||
StringVariant ErrorMessage;
|
||||
std::array<uint8_t, 32> ErrorMessageArgs;
|
||||
CoordsXYZ Position = { LOCATION_NULL, LOCATION_NULL, LOCATION_NULL };
|
||||
money32 Cost = 0;
|
||||
ExpenditureType Expenditure = ExpenditureType::Count;
|
||||
|
||||
Result() = default;
|
||||
Result(GameActions::Status error, rct_string_id message);
|
||||
Result(GameActions::Status error, rct_string_id title, rct_string_id message);
|
||||
Result(GameActions::Status error, rct_string_id title, rct_string_id message, uint8_t* args);
|
||||
Result(const GameActions::Result&) = delete;
|
||||
virtual ~Result(){};
|
||||
|
||||
std::string GetErrorTitle() const;
|
||||
std::string GetErrorMessage() const;
|
||||
};
|
||||
|
||||
class ConstructClearResult final : public Result
|
||||
{
|
||||
public:
|
||||
uint8_t GroundFlags{ 0 };
|
||||
};
|
||||
|
||||
} // namespace GameActions
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -205,7 +209,7 @@ struct GameAction
|
|||
{
|
||||
public:
|
||||
using Ptr = std::unique_ptr<GameAction>;
|
||||
using Callback_t = std::function<void(const struct GameAction*, const GameActionResult*)>;
|
||||
using Callback_t = std::function<void(const struct GameAction*, const GameActions::Result*)>;
|
||||
|
||||
private:
|
||||
uint32_t const _type;
|
||||
|
@ -240,7 +244,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the GA_FLAGS flags that are enabled for this game action.
|
||||
* Gets the GameActions::Flags flags that are enabled for this game action.
|
||||
*/
|
||||
virtual uint16_t GetActionFlags() const
|
||||
{
|
||||
|
@ -249,12 +253,12 @@ public:
|
|||
|
||||
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) != 0 || (GetFlags() & GAME_COMMAND_FLAG_NO_SPEND) != 0)
|
||||
{
|
||||
flags |= GA_FLAGS::CLIENT_ONLY;
|
||||
flags |= GameActions::Flags::ClientOnly;
|
||||
}
|
||||
|
||||
if (GetFlags() & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)
|
||||
{
|
||||
flags |= GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
flags |= GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
return flags;
|
||||
|
@ -321,12 +325,12 @@ public:
|
|||
/**
|
||||
* Query the result of the game action without changing the game state.
|
||||
*/
|
||||
virtual GameActionResult::Ptr Query() const abstract;
|
||||
virtual GameActions::Result::Ptr Query() const abstract;
|
||||
|
||||
/**
|
||||
* Apply the game action and change the game state.
|
||||
*/
|
||||
virtual GameActionResult::Ptr Execute() const abstract;
|
||||
virtual GameActions::Result::Ptr Execute() const abstract;
|
||||
|
||||
bool LocationValid(const CoordsXY& coords) const;
|
||||
};
|
||||
|
@ -358,7 +362,7 @@ public:
|
|||
|
||||
void SetCallback(std::function<void(const struct GameAction*, const TResultType*)> typedCallback)
|
||||
{
|
||||
GameAction::SetCallback([typedCallback](const GameAction* ga, const GameActionResult* result) {
|
||||
GameAction::SetCallback([typedCallback](const GameAction* ga, const GameActions::Result* result) {
|
||||
typedCallback(ga, static_cast<const TResultType*>(result));
|
||||
});
|
||||
}
|
||||
|
@ -370,10 +374,10 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
using GameActionFactory = GameAction* (*)();
|
||||
|
||||
namespace GameActions
|
||||
{
|
||||
using GameActionFactory = GameAction* (*)();
|
||||
|
||||
void Initialize();
|
||||
void Register();
|
||||
bool IsValidId(uint32_t id);
|
||||
|
@ -395,12 +399,12 @@ namespace GameActions
|
|||
GameAction::Ptr Clone(const GameAction* action);
|
||||
|
||||
// This should be used if a round trip is to be expected.
|
||||
GameActionResult::Ptr Query(const GameAction* action);
|
||||
GameActionResult::Ptr Execute(const GameAction* action);
|
||||
GameActions::Result::Ptr Query(const GameAction* action);
|
||||
GameActions::Result::Ptr Execute(const GameAction* action);
|
||||
|
||||
// This should be used from within game actions.
|
||||
GameActionResult::Ptr QueryNested(const GameAction* action);
|
||||
GameActionResult::Ptr ExecuteNested(const GameAction* action);
|
||||
GameActions::Result::Ptr QueryNested(const GameAction* action);
|
||||
GameActions::Result::Ptr ExecuteNested(const GameAction* action);
|
||||
|
||||
GameActionFactory Register(uint32_t id, GameActionFactory action);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ money32 park_entrance_place_ghost(const CoordsXYZD& entranceLoc)
|
|||
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
|
||||
|
||||
auto result = GameActions::Execute(&gameAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
gParkEntranceGhostPosition = entranceLoc;
|
||||
gParkEntranceGhostExists = true;
|
||||
|
@ -64,7 +64,7 @@ void ride_construct_new(RideSelection listItem)
|
|||
auto gameAction = RideCreateAction(listItem.Type, listItem.EntryIndex, colour1, colour2);
|
||||
|
||||
gameAction.SetCallback([](const GameAction* ga, const RideCreateGameActionResult* result) {
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
|
||||
auto ride = get_ride(result->rideIndex);
|
||||
|
@ -131,7 +131,7 @@ money32 maze_set_track(
|
|||
auto gameAction = MazeSetTrackAction({ x, y, z, direction }, initialPlacement, rideIndex, mode);
|
||||
gameAction.SetFlags(flags);
|
||||
|
||||
GameActionResult::Ptr res;
|
||||
GameActions::Result::Ptr res;
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
||||
res = GameActions::Query(&gameAction);
|
||||
|
@ -149,7 +149,7 @@ money32 maze_set_track(
|
|||
else
|
||||
gGameCommandErrorText = STR_NONE;
|
||||
|
||||
if (res->Error != GA_ERROR::OK)
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(GuestSetFlagsAction, GAME_COMMAND_GUEST_SET_FLAGS, GameActionResult)
|
||||
DEFINE_GAME_ACTION(GuestSetFlagsAction, GAME_COMMAND_GUEST_SET_FLAGS, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint16_t _peepId{ SPRITE_INDEX_NULL };
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -40,28 +40,28 @@ public:
|
|||
stream << DS_TAG(_peepId) << DS_TAG(_newFlags);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
Peep* peep = TryGetEntity<Peep>(_peepId);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
log_error("Used invalid sprite index for peep: %u", static_cast<uint32_t>(_peepId));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS);
|
||||
}
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
Peep* peep = TryGetEntity<Peep>(_peepId);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
log_error("Used invalid sprite index for peep: %u", static_cast<uint32_t>(_peepId));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS);
|
||||
}
|
||||
|
||||
peep->PeepFlags = _newFlags;
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(GuestSetNameAction, GAME_COMMAND_SET_GUEST_NAME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(GuestSetNameAction, GAME_COMMAND_SET_GUEST_NAME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -63,41 +63,41 @@ public:
|
|||
stream << DS_TAG(_spriteIndex) << DS_TAG(_name);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
}
|
||||
|
||||
auto guest = TryGetEntity<Guest>(_spriteIndex);
|
||||
if (guest == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto guest = TryGetEntity<Guest>(_spriteIndex);
|
||||
if (guest == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
}
|
||||
|
||||
auto curName = guest->GetName();
|
||||
if (curName == _name)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::OK, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Ok, STR_NONE);
|
||||
}
|
||||
|
||||
if (!guest->SetName(_name))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
}
|
||||
|
||||
// Easter egg functions are for guests only
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Position.x = guest->x;
|
||||
res->Position.y = guest->y;
|
||||
res->Position.z = guest->z;
|
||||
|
|
|
@ -33,7 +33,7 @@ enum class LandBuyRightSetting : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(LandBuyRightsAction, GAME_COMMAND_BUY_LAND_RIGHTS, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LandBuyRightsAction, GAME_COMMAND_BUY_LAND_RIGHTS, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
@ -68,18 +68,18 @@ public:
|
|||
stream << DS_TAG(_range) << DS_TAG(_setting);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
auto result = map_buy_land_rights_for_tile({ x, y }, isExecuting);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
res->Cost += result->Cost;
|
||||
}
|
||||
|
@ -120,19 +120,19 @@ private:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr map_buy_land_rights_for_tile(const CoordsXY& loc, bool isExecuting) const
|
||||
GameActions::Result::Ptr map_buy_land_rights_for_tile(const CoordsXY& loc, bool isExecuting) const
|
||||
{
|
||||
if (_setting >= LandBuyRightSetting::Count)
|
||||
{
|
||||
log_warning("Tried calling buy land rights with an incorrect setting. setting = %u", _setting);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, _ErrorTitles[0], STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE);
|
||||
}
|
||||
|
||||
SurfaceElement* surfaceElement = map_get_surface_element_at(loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, _ErrorTitles[EnumValue(_setting)], STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, _ErrorTitles[EnumValue(_setting)], STR_NONE);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -147,7 +147,7 @@ private:
|
|||
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) != 0
|
||||
|| (surfaceElement->GetOwnership() & OWNERSHIP_AVAILABLE) == 0)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, _ErrorTitles[EnumValue(_setting)], STR_LAND_NOT_FOR_SALE);
|
||||
return MakeResult(GameActions::Status::NotOwned, _ErrorTitles[EnumValue(_setting)], STR_LAND_NOT_FOR_SALE);
|
||||
}
|
||||
if (isExecuting)
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ private:
|
|||
|| (surfaceElement->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) == 0)
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::NOT_OWNED, _ErrorTitles[EnumValue(_setting)], STR_CONSTRUCTION_RIGHTS_NOT_FOR_SALE);
|
||||
GameActions::Status::NotOwned, _ErrorTitles[EnumValue(_setting)], STR_CONSTRUCTION_RIGHTS_NOT_FOR_SALE);
|
||||
}
|
||||
|
||||
if (isExecuting)
|
||||
|
@ -181,7 +181,7 @@ private:
|
|||
|
||||
default:
|
||||
log_warning("Tried calling buy land rights with an incorrect setting. setting = %u", _setting);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, _ErrorTitles[0], STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandLowerAction, GAME_COMMAND_LOWER_LAND, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LandLowerAction, GAME_COMMAND_LOWER_LAND, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
@ -53,18 +53,18 @@ public:
|
|||
stream << DS_TAG(_coords) << DS_TAG(_range) << DS_TAG(_selectionType);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
size_t tableRow = _selectionType;
|
||||
|
@ -133,7 +133,7 @@ private:
|
|||
landSetHeightAction.SetFlags(GetFlags());
|
||||
auto result = isExecuting ? GameActions::ExecuteNested(&landSetHeightAction)
|
||||
: GameActions::QueryNested(&landSetHeightAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
res->Cost += result->Cost;
|
||||
}
|
||||
|
@ -147,8 +147,8 @@ private:
|
|||
|
||||
if (!withinOwnership)
|
||||
{
|
||||
GameActionResult::Ptr ownerShipResult = std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
ownerShipResult->ErrorTitle = STR_CANT_LOWER_LAND_HERE;
|
||||
return ownerShipResult;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandRaiseAction, GAME_COMMAND_RAISE_LAND, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LandRaiseAction, GAME_COMMAND_RAISE_LAND, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
@ -54,18 +54,18 @@ public:
|
|||
stream << DS_TAG(_coords) << DS_TAG(_range) << DS_TAG(_selectionType);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
size_t tableRow = _selectionType;
|
||||
|
@ -129,7 +129,7 @@ private:
|
|||
landSetHeightAction.SetFlags(GetFlags());
|
||||
auto result = isExecuting ? GameActions::ExecuteNested(&landSetHeightAction)
|
||||
: GameActions::QueryNested(&landSetHeightAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
res->Cost += result->Cost;
|
||||
}
|
||||
|
@ -143,8 +143,8 @@ private:
|
|||
|
||||
if (!withinOwnership)
|
||||
{
|
||||
GameActionResult::Ptr ownerShipResult = std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
ownerShipResult->ErrorTitle = STR_CANT_RAISE_LAND_HERE;
|
||||
return ownerShipResult;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandSetHeightAction, GAME_COMMAND_SET_LAND_HEIGHT, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LandSetHeightAction, GAME_COMMAND_SET_LAND_HEIGHT, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::EDITOR_ONLY;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::EditorOnly;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -52,24 +52,24 @@ public:
|
|||
stream << DS_TAG(_coords) << DS_TAG(_height) << DS_TAG(_style);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (gParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::DISALLOWED, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
|
||||
}
|
||||
|
||||
rct_string_id errorTitle = CheckParameters();
|
||||
if (errorTitle != STR_NONE)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::DISALLOWED, errorTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, errorTitle);
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
if (!map_is_location_in_park(_coords))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
TileElement* tileElement = CheckTreeObstructions();
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
auto res = MakeResult(GA_ERROR::DISALLOWED, STR_NONE);
|
||||
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE);
|
||||
map_obstruction_set_error_text(tileElement, *res);
|
||||
return res;
|
||||
}
|
||||
|
@ -96,13 +96,13 @@ public:
|
|||
errorTitle = CheckRideSupports();
|
||||
if (errorTitle != STR_NONE)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::DISALLOWED, errorTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, errorTitle);
|
||||
}
|
||||
}
|
||||
|
||||
auto* surfaceElement = map_get_surface_element_at(_coords);
|
||||
if (surfaceElement == nullptr)
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
|
||||
|
||||
// We need to check if there is _currently_ a level crossing on the tile.
|
||||
// For that, we need the old height, so we can't use the _height variable.
|
||||
|
@ -110,13 +110,13 @@ public:
|
|||
auto* pathElement = map_get_footpath_element(oldCoords);
|
||||
if (pathElement != nullptr && pathElement->AsPath()->IsLevelCrossing(oldCoords))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_REMOVE_LEVEL_CROSSING_FIRST);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_REMOVE_LEVEL_CROSSING_FIRST);
|
||||
}
|
||||
|
||||
TileElement* tileElement = CheckFloatingStructures(reinterpret_cast<TileElement*>(surfaceElement), _height);
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
auto res = MakeResult(GA_ERROR::DISALLOWED, STR_NONE);
|
||||
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE);
|
||||
map_obstruction_set_error_text(tileElement, *res);
|
||||
return res;
|
||||
}
|
||||
|
@ -136,28 +136,28 @@ public:
|
|||
auto clearResult = MapCanConstructWithClearAt(
|
||||
{ _coords, _height * COORDS_Z_STEP, zCorner * COORDS_Z_STEP }, &map_set_land_height_clear_func, { 0b1111, 0 },
|
||||
0, CREATE_CROSSING_MODE_NONE);
|
||||
if (clearResult->Error != GA_ERROR::OK)
|
||||
if (clearResult->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_NONE, clearResult->ErrorMessage.GetStringId(),
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_NONE, clearResult->ErrorMessage.GetStringId(),
|
||||
clearResult->ErrorMessageArgs.data());
|
||||
}
|
||||
|
||||
tileElement = CheckUnremovableObstructions(reinterpret_cast<TileElement*>(surfaceElement), zCorner);
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
auto res = MakeResult(GA_ERROR::DISALLOWED, STR_NONE);
|
||||
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE);
|
||||
map_obstruction_set_error_text(tileElement, *res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = sceneryRemovalCost + GetSurfaceHeightChangeCost(surfaceElement);
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
money32 cost = MONEY(0, 0);
|
||||
auto surfaceHeight = tile_element_height(_coords);
|
||||
|
@ -172,12 +172,12 @@ public:
|
|||
|
||||
auto* surfaceElement = map_get_surface_element_at(_coords);
|
||||
if (surfaceElement == nullptr)
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
|
||||
|
||||
cost += GetSurfaceHeightChangeCost(surfaceElement);
|
||||
SetSurfaceHeight(reinterpret_cast<TileElement*>(surfaceElement));
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Position = { _coords.x + 16, _coords.y + 16, surfaceHeight };
|
||||
res->Cost = cost;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
|
|
@ -36,7 +36,7 @@ enum class LandSetRightSetting : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(LandSetRightsAction, GAME_COMMAND_SET_LAND_OWNERSHIP, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LandSetRightsAction, GAME_COMMAND_SET_LAND_OWNERSHIP, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::EDITOR_ONLY;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::EditorOnly;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -72,18 +72,18 @@ public:
|
|||
stream << DS_TAG(_range) << DS_TAG(_setting) << DS_TAG(_ownership);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
|
||||
|
@ -105,7 +105,7 @@ private:
|
|||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_IN_EDITOR_MODE, STR_NONE, STR_LAND_NOT_FOR_SALE);
|
||||
return MakeResult(GameActions::Status::NotInEditorMode, STR_NONE, STR_LAND_NOT_FOR_SALE);
|
||||
}
|
||||
|
||||
// Game command modified to accept selection size
|
||||
|
@ -116,7 +116,7 @@ private:
|
|||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
auto result = map_buy_land_rights_for_tile({ x, y }, isExecuting);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
res->Cost += result->Cost;
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ private:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr map_buy_land_rights_for_tile(const CoordsXY& loc, bool isExecuting) const
|
||||
GameActions::Result::Ptr map_buy_land_rights_for_tile(const CoordsXY& loc, bool isExecuting) const
|
||||
{
|
||||
SurfaceElement* surfaceElement = map_get_surface_element_at(loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -230,7 +230,7 @@ private:
|
|||
}
|
||||
default:
|
||||
log_warning("Tried calling set land rights with an incorrect setting. setting = %u", _setting);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LandSmoothAction, GAME_COMMAND_EDIT_LAND_SMOOTH, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LandSmoothAction, GAME_COMMAND_EDIT_LAND_SMOOTH, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
@ -59,18 +59,18 @@ public:
|
|||
stream << DS_TAG(_coords) << DS_TAG(_range) << DS_TAG(_selectionType) << DS_TAG(_isLowering);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return SmoothLand(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return SmoothLand(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr SmoothLandTile(
|
||||
GameActions::Result::Ptr SmoothLandTile(
|
||||
int32_t direction, bool isExecuting, const CoordsXY& loc, SurfaceElement* surfaceElement) const
|
||||
{
|
||||
int32_t targetBaseZ = surfaceElement->base_height;
|
||||
|
@ -238,7 +238,7 @@ private:
|
|||
landSetHeightAction.SetFlags(GetFlags());
|
||||
auto res = isExecuting ? GameActions::ExecuteNested(&landSetHeightAction)
|
||||
: GameActions::QueryNested(&landSetHeightAction);
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
if (res->Error == GameActions::Status::Ok)
|
||||
{
|
||||
totalCost += res->Cost;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ private:
|
|||
expectedLandHeight += landChangePerTile;
|
||||
// change land of current tile
|
||||
auto result = SmoothLandTile(direction, isExecuting, nextLoc, surfaceElement);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
totalCost += result->Cost;
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ private:
|
|||
return totalCost;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr SmoothLand(bool isExecuting) const
|
||||
GameActions::Result::Ptr SmoothLand(bool isExecuting) const
|
||||
{
|
||||
const bool raiseLand = !_isLowering;
|
||||
const int32_t selectionType = _selectionType;
|
||||
|
@ -640,11 +640,11 @@ private:
|
|||
}
|
||||
default:
|
||||
log_error("Invalid map selection %u", _selectionType);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, res->ErrorTitle.GetStringId());
|
||||
return MakeResult(GameActions::Status::InvalidParameters, res->ErrorTitle.GetStringId());
|
||||
} // switch selectionType
|
||||
|
||||
// Raise / lower the land tool selection area
|
||||
GameActionResult::Ptr result;
|
||||
GameActions::Result::Ptr result;
|
||||
if (raiseLand)
|
||||
{
|
||||
auto raiseLandAction = LandRaiseAction({ _coords.x, _coords.y }, validRange, selectionType);
|
||||
|
@ -657,7 +657,7 @@ private:
|
|||
lowerLandAction.SetFlags(GetFlags());
|
||||
result = isExecuting ? GameActions::ExecuteNested(&lowerLandAction) : GameActions::QueryNested(&lowerLandAction);
|
||||
}
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -20,23 +20,23 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
class LargeSceneryPlaceActionResult final : public GameActionResult
|
||||
class LargeSceneryPlaceActionResult final : public GameActions::Result
|
||||
{
|
||||
public:
|
||||
LargeSceneryPlaceActionResult()
|
||||
: GameActionResult(GA_ERROR::OK, STR_CANT_POSITION_THIS_HERE)
|
||||
: GameActions::Result(GameActions::Status::Ok, STR_CANT_POSITION_THIS_HERE)
|
||||
{
|
||||
}
|
||||
LargeSceneryPlaceActionResult(GA_ERROR error)
|
||||
: GameActionResult(error, STR_CANT_POSITION_THIS_HERE)
|
||||
LargeSceneryPlaceActionResult(GameActions::Status error)
|
||||
: GameActions::Result(error, STR_CANT_POSITION_THIS_HERE)
|
||||
{
|
||||
}
|
||||
LargeSceneryPlaceActionResult(GA_ERROR error, rct_string_id message)
|
||||
: GameActionResult(error, STR_CANT_POSITION_THIS_HERE, message)
|
||||
LargeSceneryPlaceActionResult(GameActions::Status error, rct_string_id message)
|
||||
: GameActions::Result(error, STR_CANT_POSITION_THIS_HERE, message)
|
||||
{
|
||||
}
|
||||
LargeSceneryPlaceActionResult(GA_ERROR error, rct_string_id message, uint8_t* args)
|
||||
: GameActionResult(error, STR_CANT_POSITION_THIS_HERE, message, args)
|
||||
LargeSceneryPlaceActionResult(GameActions::Status error, rct_string_id message, uint8_t* args)
|
||||
: GameActions::Result(error, STR_CANT_POSITION_THIS_HERE, message, args)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
<< DS_TAG(_bannerId);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = std::make_unique<LargeSceneryPlaceActionResult>();
|
||||
res->ErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
||||
|
@ -119,20 +119,20 @@ public:
|
|||
log_error(
|
||||
"Invalid game command for scenery placement, primaryColour = %u, secondaryColour = %u", _primaryColour,
|
||||
_secondaryColour);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
if (_sceneryType >= MAX_LARGE_SCENERY_OBJECTS)
|
||||
{
|
||||
log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
rct_scenery_entry* sceneryEntry = get_large_scenery_entry(_sceneryType);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
uint32_t totalNumTiles = GetTotalNumTiles(sceneryEntry->large_scenery.tiles);
|
||||
|
@ -150,21 +150,21 @@ public:
|
|||
if (_bannerId == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Banner Index not specified.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
}
|
||||
|
||||
auto banner = GetBanner(_bannerId);
|
||||
if (!banner->IsNull())
|
||||
{
|
||||
log_error("No free banners available");
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::NoFreeElements);
|
||||
}
|
||||
}
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(totalNumTiles))
|
||||
{
|
||||
log_error("No free map elements available");
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::NoFreeElements);
|
||||
}
|
||||
|
||||
uint8_t tileNum = 0;
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(
|
||||
GA_ERROR::NO_CLEARANCE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
GameActions::Status::NoClearance, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
int32_t tempSceneryGroundFlags = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||
|
@ -193,12 +193,12 @@ public:
|
|||
if ((gMapGroundFlags & ELEMENT_IS_UNDERWATER) || (gMapGroundFlags & ELEMENT_IS_UNDERGROUND))
|
||||
{
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
if (res->GroundFlags && !(res->GroundFlags & tempSceneryGroundFlags))
|
||||
{
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
|
||||
GameActions::Status::Disallowed, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,13 +206,14 @@ public:
|
|||
|
||||
if (!LocationValid(curTile) || curTile.x >= gMapSizeUnits || curTile.y >= gMapSizeUnits)
|
||||
{
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_OFF_EDGE_OF_MAP);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::Disallowed, STR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_owned({ curTile, zLow })
|
||||
&& !gCheatsSandboxMode)
|
||||
{
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +224,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = std::make_unique<LargeSceneryPlaceActionResult>();
|
||||
res->ErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
||||
|
@ -241,13 +242,13 @@ public:
|
|||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
if (sceneryEntry->large_scenery.tiles == nullptr)
|
||||
{
|
||||
log_error("Invalid large scenery object, sceneryType = %u", _sceneryType);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
uint32_t totalNumTiles = GetTotalNumTiles(sceneryEntry->large_scenery.tiles);
|
||||
|
@ -263,7 +264,7 @@ public:
|
|||
if (!map_check_free_elements_and_reorganise(totalNumTiles))
|
||||
{
|
||||
log_error("No free map elements available");
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::NoFreeElements);
|
||||
}
|
||||
|
||||
uint8_t tileNum = 0;
|
||||
|
@ -283,7 +284,7 @@ public:
|
|||
CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(
|
||||
GA_ERROR::NO_CLEARANCE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
GameActions::Status::NoClearance, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
res->GroundFlags = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||
|
@ -320,14 +321,14 @@ public:
|
|||
if (_bannerId == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("No free banners available");
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
}
|
||||
|
||||
auto banner = GetBanner(_bannerId);
|
||||
if (!banner->IsNull())
|
||||
{
|
||||
log_error("No free banners available");
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS);
|
||||
return std::make_unique<LargeSceneryPlaceActionResult>(GameActions::Status::NoFreeElements);
|
||||
}
|
||||
|
||||
banner->text = {};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LargeSceneryRemoveAction, GAME_COMMAND_REMOVE_LARGE_SCENERY, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LargeSceneryRemoveAction, GAME_COMMAND_REMOVE_LARGE_SCENERY, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -56,9 +56,9 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_tileIndex);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
|
||||
const uint32_t flags = GetFlags();
|
||||
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
if (tileElement == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
rct_scenery_entry* scenery_entry = tileElement->AsLargeScenery()->GetEntry();
|
||||
|
@ -99,13 +99,13 @@ public:
|
|||
{
|
||||
if (!map_is_location_owned({ currentTile.x, currentTile.y, currentTile.z }))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
}
|
||||
|
||||
if (!LocationValid(currentTile))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
// Prevent duplicate costs when using the clear scenery tool that overlaps multiple large
|
||||
// scenery tile elements.
|
||||
|
@ -125,9 +125,9 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
|
||||
const uint32_t flags = GetFlags();
|
||||
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
if (tileElement == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
tile_element_remove_banner_entry(tileElement);
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
{
|
||||
if (!map_is_location_owned({ currentTile.x, currentTile.y, currentTile.z }))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "../world/Scenery.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(LargeScenerySetColourAction, GAME_COMMAND_SET_LARGE_SCENERY_COLOUR, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LargeScenerySetColourAction, GAME_COMMAND_SET_LARGE_SCENERY_COLOUR, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -45,18 +45,18 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_tileIndex) << DS_TAG(_primaryColour) << DS_TAG(_secondaryColour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
@ -68,19 +68,19 @@ private:
|
|||
if (_loc.x < 0 || _loc.y < 0 || _loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY)
|
||||
{
|
||||
log_error("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (_primaryColour > 31)
|
||||
{
|
||||
log_error("Invalid primary colour: colour = %u", _primaryColour);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (_secondaryColour > 31)
|
||||
{
|
||||
log_error("Invalid primary colour: colour = %u", _secondaryColour);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
auto largeElement = map_get_large_scenery_segment(_loc, _tileIndex);
|
||||
|
@ -90,7 +90,7 @@ private:
|
|||
log_error(
|
||||
"Could not find large scenery at: x = %d, y = %d, z = %d, direction = %d, tileIndex = %u", _loc.x, _loc.y,
|
||||
_loc.z, _loc.direction, _tileIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(largeElement->IsGhost()))
|
||||
|
@ -103,7 +103,7 @@ private:
|
|||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
log_error("Could not find scenery object. type = %u", largeElement->GetEntryIndex());
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
// Work out the base tile coordinates (Tile with index 0)
|
||||
auto rotatedBaseCoordsOffset = CoordsXYZ{ CoordsXY{ sceneryEntry->large_scenery.tiles[_tileIndex].x_offset,
|
||||
|
@ -125,13 +125,13 @@ private:
|
|||
{
|
||||
if (!map_is_location_owned(currentTile))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
}
|
||||
|
||||
if (!LocationValid(currentTile))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
auto tileElement = map_get_large_scenery_segment({ currentTile.x, currentTile.y, _loc.z, _loc.direction }, i);
|
||||
|
@ -141,7 +141,7 @@ private:
|
|||
log_error(
|
||||
"Large scenery element not found at: x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z,
|
||||
_loc.direction);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
if (isExecuting)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ enum class LoadOrQuitModes : uint8_t
|
|||
CloseSavePrompt
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(LoadOrQuitAction, GAME_COMMAND_LOAD_OR_QUIT, GameActionResult)
|
||||
DEFINE_GAME_ACTION(LoadOrQuitAction, GAME_COMMAND_LOAD_OR_QUIT, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
LoadOrQuitModes _mode{};
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::CLIENT_ONLY | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::ClientOnly | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -45,12 +45,12 @@ public:
|
|||
stream << DS_TAG(_mode) << DS_TAG(_savePromptMode);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto mode = static_cast<LoadOrQuitModes>(_mode);
|
||||
switch (mode)
|
||||
|
@ -66,6 +66,6 @@ public:
|
|||
game_load_or_quit_no_save_prompt();
|
||||
break;
|
||||
}
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "../ride/TrackData.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(MazePlaceTrackAction, GAME_COMMAND_PLACE_MAZE_DESIGN, GameActionResult)
|
||||
DEFINE_GAME_ACTION(MazePlaceTrackAction, GAME_COMMAND_PLACE_MAZE_DESIGN, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -43,29 +43,29 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_rideIndex) << DS_TAG(_mazeEntry);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
|
||||
res->Position = _loc + CoordsXYZ{ 8, 8, 0 };
|
||||
res->Expenditure = ExpenditureType::RideConstruction;
|
||||
res->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
res->Error = GA_ERROR::NO_FREE_ELEMENTS;
|
||||
res->Error = GameActions::Status::NoFreeElements;
|
||||
res->ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
|
||||
return res;
|
||||
}
|
||||
if ((_loc.z & 0xF) != 0)
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = STR_CONSTRUCTION_ERR_UNKNOWN;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!LocationValid(_loc) || (!map_is_location_owned(_loc) && !gCheatsSandboxMode))
|
||||
{
|
||||
res->Error = GA_ERROR::NOT_OWNED;
|
||||
res->Error = GameActions::Status::NotOwned;
|
||||
res->ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK;
|
||||
return res;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
auto surfaceElement = map_get_surface_element_at(_loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||
return res;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
if (heightDifference > RideTypeDescriptors[RIDE_TYPE_MAZE].Heights.MaxHeight)
|
||||
{
|
||||
res->Error = GA_ERROR::TOO_HIGH;
|
||||
res->Error = GameActions::Status::TooHigh;
|
||||
res->ErrorMessage = STR_TOO_HIGH_FOR_SUPPORTS;
|
||||
return res;
|
||||
}
|
||||
|
@ -100,19 +100,20 @@ public:
|
|||
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, &map_place_non_scenery_clear_func, { 0b1111, 0 },
|
||||
GetFlags(), &clearCost, CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, res->ErrorTitle.GetStringId(), gGameCommandErrorText, gCommonFormatArgs);
|
||||
return MakeResult(
|
||||
GameActions::Status::NoClearance, res->ErrorTitle.GetStringId(), gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
if (gMapGroundFlags & ELEMENT_IS_UNDERWATER)
|
||||
{
|
||||
res->Error = GA_ERROR::NO_CLEARANCE;
|
||||
res->Error = GameActions::Status::NoClearance;
|
||||
res->ErrorMessage = STR_RIDE_CANT_BUILD_THIS_UNDERWATER;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (gMapGroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
res->Error = GA_ERROR::NO_CLEARANCE;
|
||||
res->Error = GameActions::Status::NoClearance;
|
||||
res->ErrorMessage = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
return res;
|
||||
}
|
||||
|
@ -120,7 +121,7 @@ public:
|
|||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
{
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->Error = GameActions::Status::InvalidParameters;
|
||||
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||
return res;
|
||||
}
|
||||
|
@ -131,9 +132,9 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
|
||||
res->Position = _loc + CoordsXYZ{ 8, 8, 0 };
|
||||
res->Expenditure = ExpenditureType::RideConstruction;
|
||||
|
@ -142,14 +143,14 @@ public:
|
|||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->Error = GameActions::Status::InvalidParameters;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
res->Error = GA_ERROR::NO_FREE_ELEMENTS;
|
||||
res->Error = GameActions::Status::NoFreeElements;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
}
|
||||
|
@ -169,7 +170,8 @@ public:
|
|||
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, &map_place_non_scenery_clear_func, { 0b1111, 0 },
|
||||
GetFlags() | GAME_COMMAND_FLAG_APPLY, &clearCost, CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, res->ErrorTitle.GetStringId(), gGameCommandErrorText, gCommonFormatArgs);
|
||||
return MakeResult(
|
||||
GameActions::Status::NoClearance, res->ErrorTitle.GetStringId(), gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
money32 price = (((RideTypeDescriptors[ride->type].BuildCosts.TrackPrice * TrackPricing[TrackElemType::Maze]) >> 16));
|
||||
|
|
|
@ -47,7 +47,7 @@ static constexpr const uint8_t byte_993D0C[] = {
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
DEFINE_GAME_ACTION(MazeSetTrackAction, GAME_COMMAND_SET_MAZE_TRACK, GameActionResult)
|
||||
DEFINE_GAME_ACTION(MazeSetTrackAction, GAME_COMMAND_SET_MAZE_TRACK, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -79,29 +79,29 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_loc.direction) << DS_TAG(_initialPlacement) << DS_TAG(_rideIndex) << DS_TAG(_mode);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
|
||||
res->Position = _loc + CoordsXYZ{ 8, 8, 0 };
|
||||
res->Expenditure = ExpenditureType::RideConstruction;
|
||||
res->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
res->Error = GA_ERROR::NO_FREE_ELEMENTS;
|
||||
res->Error = GameActions::Status::NoFreeElements;
|
||||
res->ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
|
||||
return res;
|
||||
}
|
||||
if ((_loc.z & 0xF) != 0 && _mode == GC_SET_MAZE_TRACK_BUILD)
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = STR_CONSTRUCTION_ERR_UNKNOWN;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!LocationValid(_loc) || (!map_is_location_owned(_loc) && !gCheatsSandboxMode))
|
||||
{
|
||||
res->Error = GA_ERROR::NOT_OWNED;
|
||||
res->Error = GameActions::Status::NotOwned;
|
||||
res->ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK;
|
||||
return res;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
auto surfaceElement = map_get_surface_element_at(_loc);
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||
return res;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
|
||||
if (heightDifference > RideTypeDescriptors[RIDE_TYPE_MAZE].Heights.MaxHeight)
|
||||
{
|
||||
res->Error = GA_ERROR::TOO_HIGH;
|
||||
res->Error = GameActions::Status::TooHigh;
|
||||
res->ErrorMessage = STR_TOO_HIGH_FOR_SUPPORTS;
|
||||
return res;
|
||||
}
|
||||
|
@ -135,28 +135,28 @@ public:
|
|||
{
|
||||
if (_mode != GC_SET_MAZE_TRACK_BUILD)
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||
return res;
|
||||
}
|
||||
auto constructResult = MapCanConstructAt({ _loc.ToTileStart(), baseHeight, clearanceHeight }, { 0b1111, 0 });
|
||||
if (constructResult->Error != GA_ERROR::OK)
|
||||
if (constructResult->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::NO_CLEARANCE, res->ErrorTitle.GetStringId(), constructResult->ErrorMessage.GetStringId(),
|
||||
constructResult->ErrorMessageArgs.data());
|
||||
GameActions::Status::NoClearance, res->ErrorTitle.GetStringId(),
|
||||
constructResult->ErrorMessage.GetStringId(), constructResult->ErrorMessageArgs.data());
|
||||
}
|
||||
|
||||
if (constructResult->GroundFlags & ELEMENT_IS_UNDERWATER)
|
||||
{
|
||||
res->Error = GA_ERROR::NO_CLEARANCE;
|
||||
res->Error = GameActions::Status::NoClearance;
|
||||
res->ErrorMessage = STR_RIDE_CANT_BUILD_THIS_UNDERWATER;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (constructResult->GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
res->Error = GA_ERROR::NO_CLEARANCE;
|
||||
res->Error = GameActions::Status::NoClearance;
|
||||
res->ErrorMessage = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
return res;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_CRASH_TYPE_NONE)
|
||||
{
|
||||
res->Error = GA_ERROR::NO_CLEARANCE;
|
||||
res->Error = GameActions::Status::NoClearance;
|
||||
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||
return res;
|
||||
}
|
||||
|
@ -176,12 +176,12 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
|
||||
res->Position = _loc + CoordsXYZ{ 8, 8, 0 };
|
||||
res->Expenditure = ExpenditureType::RideConstruction;
|
||||
|
@ -190,14 +190,14 @@ public:
|
|||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->Error = GameActions::Status::InvalidParameters;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
res->Error = GA_ERROR::NO_FREE_ELEMENTS;
|
||||
res->Error = GameActions::Status::NoFreeElements;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
if (tileElement == nullptr)
|
||||
{
|
||||
log_error("No surface found");
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ enum class PermissionState : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(NetworkModifyGroupAction, GAME_COMMAND_MODIFY_GROUPS, GameActionResult)
|
||||
DEFINE_GAME_ACTION(NetworkModifyGroupAction, GAME_COMMAND_MODIFY_GROUPS, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
ModifyGroupType _type{ ModifyGroupType::Count };
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -66,12 +66,12 @@ public:
|
|||
stream << DS_TAG(_type) << DS_TAG(_groupId) << DS_TAG(_name) << DS_TAG(_permissionIndex) << DS_TAG(_permissionState);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return network_modify_groups(GetPlayer(), _type, _groupId, _name, _permissionIndex, _permissionState, false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return network_modify_groups(GetPlayer(), _type, _groupId, _name, _permissionIndex, _permissionState, true);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "../world/Park.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkEntranceRemoveAction, GAME_COMMAND_REMOVE_PARK_ENTRANCE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ParkEntranceRemoveAction, GAME_COMMAND_REMOVE_PARK_ENTRANCE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::EDITOR_ONLY;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::EditorOnly;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -40,11 +40,11 @@ public:
|
|||
stream << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_IN_EDITOR_MODE, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::NotInEditorMode, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -56,12 +56,12 @@ public:
|
|||
if (!LocationValid(_loc) || entranceIndex == -1)
|
||||
{
|
||||
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::LandPurchase;
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
if (entranceIndex == -1)
|
||||
{
|
||||
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
auto direction = (gParkEntrances[entranceIndex].direction - 1) & 3;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <iterator>
|
||||
|
||||
DEFINE_GAME_ACTION(ParkMarketingAction, GAME_COMMAND_START_MARKETING_CAMPAIGN, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ParkMarketingAction, GAME_COMMAND_START_MARKETING_CAMPAIGN, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
int32_t _type{};
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -49,22 +49,23 @@ public:
|
|||
stream << DS_TAG(_type) << DS_TAG(_item) << DS_TAG(_numWeeks);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (static_cast<size_t>(_type) >= std::size(AdvertisingCampaignPricePerWeek) || _numWeeks >= 256)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_START_MARKETING_CAMPAIGN);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN);
|
||||
}
|
||||
if (gParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN)
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_START_MARKETING_CAMPAIGN, STR_MARKETING_CAMPAIGNS_FORBIDDEN_BY_LOCAL_AUTHORITY);
|
||||
GameActions::Status::Disallowed, STR_CANT_START_MARKETING_CAMPAIGN,
|
||||
STR_MARKETING_CAMPAIGNS_FORBIDDEN_BY_LOCAL_AUTHORITY);
|
||||
}
|
||||
|
||||
return CreateResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
MarketingCampaign campaign{};
|
||||
campaign.Type = _type;
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr CreateResult() const
|
||||
GameActions::Result::Ptr CreateResult() const
|
||||
{
|
||||
auto result = MakeResult();
|
||||
result->ErrorTitle = STR_CANT_START_MARKETING_CAMPAIGN;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetDateAction, GAME_COMMAND_SET_DATE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ParkSetDateAction, GAME_COMMAND_SET_DATE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
int32_t _year{};
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -45,17 +45,17 @@ public:
|
|||
stream << DS_TAG(_year) << DS_TAG(_month) << DS_TAG(_day);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_year <= 0 || _year > MAX_YEAR || _month <= 0 || _month > MONTH_COUNT || _day <= 0 || _day > 31)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
date_set(_year, _month, _day);
|
||||
return MakeResult();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetLoanAction, GAME_COMMAND_SET_CURRENT_LOAN, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ParkSetLoanAction, GAME_COMMAND_SET_CURRENT_LOAN, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
money32 _value{ MONEY32_UNDEFINED };
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
stream << DS_TAG(_value);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto currentLoan = gBankLoan;
|
||||
auto loanDifference = currentLoan - _value;
|
||||
|
@ -49,20 +49,22 @@ public:
|
|||
{
|
||||
if (_value > gMaxBankLoan)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BORROW_ANY_MORE_MONEY, STR_BANK_REFUSES_TO_INCREASE_LOAN);
|
||||
return MakeResult(
|
||||
GameActions::Status::Disallowed, STR_CANT_BORROW_ANY_MORE_MONEY, STR_BANK_REFUSES_TO_INCREASE_LOAN);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (loanDifference > gCash)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INSUFFICIENT_FUNDS, STR_CANT_PAY_BACK_LOAN, STR_NOT_ENOUGH_CASH_AVAILABLE);
|
||||
return MakeResult(
|
||||
GameActions::Status::InsufficientFunds, STR_CANT_PAY_BACK_LOAN, STR_NOT_ENOUGH_CASH_AVAILABLE);
|
||||
}
|
||||
}
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
gCash -= (gBankLoan - _value);
|
||||
gBankLoan = _value;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "../world/Park.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetNameAction, GAME_COMMAND_SET_PARK_NAME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ParkSetNameAction, GAME_COMMAND_SET_PARK_NAME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
std::string _name;
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -51,16 +51,16 @@ public:
|
|||
stream << DS_TAG(_name);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_name.empty())
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_PARK, STR_INVALID_NAME_FOR_PARK);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_RENAME_PARK, STR_INVALID_NAME_FOR_PARK);
|
||||
}
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
// Do a no-op if new name is the same as the current name is the same
|
||||
auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark();
|
||||
|
|
|
@ -23,7 +23,7 @@ enum class ParkParameter : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetParameterAction, GAME_COMMAND_SET_PARK_OPEN, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ParkSetParameterAction, GAME_COMMAND_SET_PARK_OPEN, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
ParkParameter _parameter{ ParkParameter::Count };
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -50,11 +50,11 @@ public:
|
|||
stream << DS_TAG(_parameter) << DS_TAG(_value);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_parameter >= ParkParameter::Count)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
switch (_parameter)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
window_invalidate_by_class(WC_RIDE);
|
||||
break;
|
||||
default:
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkSetResearchFundingAction, GAME_COMMAND_SET_RESEARCH_FUNDING, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ParkSetResearchFundingAction, GAME_COMMAND_SET_RESEARCH_FUNDING, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
// TODO change to std::optional when C++17
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -44,16 +44,16 @@ public:
|
|||
stream << DS_TAG(_priorities) << DS_TAG(_fundingAmount);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_fundingAmount >= RESEARCH_FUNDING_COUNT)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
gResearchPriorities = _priorities;
|
||||
gResearchFundingLevel = _fundingAmount;
|
||||
|
|
|
@ -13,25 +13,25 @@
|
|||
|
||||
// Clang format is broken for small game actions
|
||||
// clang-format off
|
||||
DEFINE_GAME_ACTION(PauseToggleAction, GAME_COMMAND_TOGGLE_PAUSE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(PauseToggleAction, GAME_COMMAND_TOGGLE_PAUSE, GameActions::Result)
|
||||
{
|
||||
public:
|
||||
PauseToggleAction() = default;
|
||||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
pause_toggle();
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
};
|
||||
// clang-format on
|
||||
|
|
|
@ -23,7 +23,7 @@ enum class PeepPickupType : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(PeepPickupAction, GAME_COMMAND_PICKUP_GUEST, GameActionResult)
|
||||
DEFINE_GAME_ACTION(PeepPickupAction, GAME_COMMAND_PICKUP_GUEST, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
PeepPickupType _type{ PeepPickupType::Count };
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -53,24 +53,24 @@ public:
|
|||
stream << DS_TAG(_type) << DS_TAG(_spriteId) << DS_TAG(_loc) << DS_TAG(_owner);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_spriteId >= MAX_SPRITES || _spriteId == SPRITE_INDEX_NULL)
|
||||
{
|
||||
log_error("Failed to pick up peep for sprite %d", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
}
|
||||
|
||||
if (!_loc.isNull() && !LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
}
|
||||
|
||||
auto* const peep = TryGetEntity<Peep>(_spriteId);
|
||||
if (!peep || peep->sprite_identifier != SPRITE_IDENTIFIER_PEEP)
|
||||
{
|
||||
log_error("Failed to pick up peep for sprite %d", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
res->Position = { peep->x, peep->y, peep->z };
|
||||
if (!peep_can_be_picked_up(peep))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
}
|
||||
Peep* existing = network_get_pickup_peep(_owner);
|
||||
if (existing)
|
||||
|
@ -107,29 +107,29 @@ public:
|
|||
res->Position = _loc;
|
||||
if (network_get_pickup_peep(_owner) != peep)
|
||||
{
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
}
|
||||
|
||||
if (auto res2 = peep->Place(TileCoordsXYZ(_loc), false); res2->Error != GA_ERROR::OK)
|
||||
if (auto res2 = peep->Place(TileCoordsXYZ(_loc), false); res2->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return res2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log_error("Invalid pickup type: %u", _type);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
Peep* const peep = TryGetEntity<Peep>(_spriteId);
|
||||
if (!peep || peep->sprite_identifier != SPRITE_IDENTIFIER_PEEP)
|
||||
{
|
||||
log_error("Failed to pick up peep for sprite %d", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -180,7 +180,7 @@ public:
|
|||
break;
|
||||
case PeepPickupType::Place:
|
||||
res->Position = _loc;
|
||||
if (auto res2 = peep->Place(TileCoordsXYZ(_loc), true); res2->Error != GA_ERROR::OK)
|
||||
if (auto res2 = peep->Place(TileCoordsXYZ(_loc), true); res2->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return res2;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
break;
|
||||
default:
|
||||
log_error("Invalid pickup type: %u", _type);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlaceParkEntranceAction, GAME_COMMAND_PLACE_PARK_ENTRANCE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(PlaceParkEntranceAction, GAME_COMMAND_PLACE_PARK_ENTRANCE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameActionBase::GetActionFlags() | GA_FLAGS::EDITOR_ONLY;
|
||||
return GameActionBase::GetActionFlags() | GameActions::Flags::EditorOnly;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -46,34 +46,35 @@ public:
|
|||
stream << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::NOT_IN_EDITOR_MODE, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::NotInEditorMode, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE);
|
||||
}
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::LandPurchase;
|
||||
res->Position = { _loc.x, _loc.y, _loc.z };
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(3))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::NO_FREE_ELEMENTS, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::NoFreeElements, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE);
|
||||
}
|
||||
|
||||
if (!LocationValid(_loc) || _loc.x <= 32 || _loc.y <= 32 || _loc.x >= (gMapSizeUnits - 32)
|
||||
|| _loc.y >= (gMapSizeUnits - 32))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
if (gParkEntrances.size() >= MAX_PARK_ENTRANCES)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES);
|
||||
}
|
||||
|
||||
auto zLow = _loc.z;
|
||||
|
@ -91,10 +92,11 @@ public:
|
|||
entranceLoc.y += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].y * 2;
|
||||
}
|
||||
|
||||
if (auto res2 = MapCanConstructAt({ entranceLoc, zLow, zHigh }, { 0b1111, 0 }); res2->Error != GA_ERROR::OK)
|
||||
if (auto res2 = MapCanConstructAt({ entranceLoc, zLow, zHigh }, { 0b1111, 0 });
|
||||
res2->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::NO_CLEARANCE, STR_CANT_BUILD_PARK_ENTRANCE_HERE, res2->ErrorMessage.GetStringId(),
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::NoClearance, STR_CANT_BUILD_PARK_ENTRANCE_HERE, res2->ErrorMessage.GetStringId(),
|
||||
res2->ErrorMessageArgs.data());
|
||||
}
|
||||
|
||||
|
@ -102,17 +104,17 @@ public:
|
|||
EntranceElement* entranceElement = map_get_park_entrance_element_at(entranceLoc, false);
|
||||
if (entranceElement != nullptr)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::ITEM_ALREADY_PLACED, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::ItemAlreadyPlaced, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::LandPurchase;
|
||||
res->Position = CoordsXYZ{ _loc.x, _loc.y, _loc.z };
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlacePeepSpawnAction, GAME_COMMAND_PLACE_PEEP_SPAWN, GameActionResult)
|
||||
DEFINE_GAME_ACTION(PlacePeepSpawnAction, GAME_COMMAND_PLACE_PEEP_SPAWN, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _location;
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameActionBase::GetActionFlags() | GA_FLAGS::EDITOR_ONLY | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameActionBase::GetActionFlags() | GameActions::Flags::EditorOnly | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -43,56 +43,59 @@ public:
|
|||
stream << DS_TAG(_location.x) << DS_TAG(_location.y) << DS_TAG(_location.z) << DS_TAG(_location.direction);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::NOT_IN_EDITOR_MODE, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::NotInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE);
|
||||
}
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::LandPurchase;
|
||||
res->Position = _location;
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(3))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::NO_FREE_ELEMENTS, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::NoFreeElements, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE);
|
||||
}
|
||||
|
||||
if (!LocationValid(_location) || _location.x <= 16 || _location.y <= 16 || _location.x >= (gMapSizeUnits - 16)
|
||||
|| _location.y >= (gMapSizeUnits - 16))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
// Verify footpath exists at location, and retrieve coordinates
|
||||
auto pathElement = map_get_path_element_at(TileCoordsXYZ{ _location });
|
||||
if (pathElement == nullptr)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS);
|
||||
}
|
||||
|
||||
// Verify location is unowned
|
||||
auto surfaceMapElement = map_get_surface_element_at(_location);
|
||||
if (surfaceMapElement == nullptr)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE);
|
||||
}
|
||||
if (surfaceMapElement->GetOwnership() != OWNERSHIP_UNOWNED)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_ERR_MUST_BE_OUTSIDE_PARK_BOUNDARIES);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE,
|
||||
STR_ERR_MUST_BE_OUTSIDE_PARK_BOUNDARIES);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::LandPurchase;
|
||||
res->Position = _location;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../network/network.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlayerKickAction, GAME_COMMAND_KICK_PLAYER, GameActionResult)
|
||||
DEFINE_GAME_ACTION(PlayerKickAction, GAME_COMMAND_KICK_PLAYER, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkPlayerId_t _playerId{ -1 };
|
||||
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -36,12 +36,12 @@ public:
|
|||
|
||||
stream << DS_TAG(_playerId);
|
||||
}
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return network_kick_player(_playerId, false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return network_kick_player(_playerId, true);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../network/network.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(PlayerSetGroupAction, GAME_COMMAND_SET_PLAYER_GROUP, GameActionResult)
|
||||
DEFINE_GAME_ACTION(PlayerSetGroupAction, GAME_COMMAND_SET_PLAYER_GROUP, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkPlayerId_t _playerId{ -1 };
|
||||
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -38,12 +38,12 @@ public:
|
|||
|
||||
stream << DS_TAG(_playerId) << DS_TAG(_groupId);
|
||||
}
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return network_set_player_group(GetPlayer(), _playerId, _groupId, false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return network_set_player_group(GetPlayer(), _playerId, _groupId, true);
|
||||
}
|
||||
|
|
|
@ -26,15 +26,15 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
class RideCreateGameActionResult final : public GameActionResult
|
||||
class RideCreateGameActionResult final : public GameActions::Result
|
||||
{
|
||||
public:
|
||||
RideCreateGameActionResult()
|
||||
: GameActionResult(GA_ERROR::OK, STR_NONE)
|
||||
: GameActions::Result(GameActions::Status::Ok, STR_NONE)
|
||||
{
|
||||
}
|
||||
RideCreateGameActionResult(GA_ERROR error, rct_string_id message)
|
||||
: GameActionResult(error, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, message)
|
||||
RideCreateGameActionResult(GameActions::Status error, rct_string_id message)
|
||||
: GameActions::Result(error, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, message)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -90,48 +90,48 @@ public:
|
|||
stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_colour1) << DS_TAG(_colour2);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto rideIndex = GetNextFreeRideId();
|
||||
if (rideIndex == RIDE_ID_NULL)
|
||||
{
|
||||
// No more free slots available.
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TOO_MANY_RIDES);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_TOO_MANY_RIDES);
|
||||
}
|
||||
|
||||
if (_rideType >= RIDE_TYPE_COUNT)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_RIDE_TYPE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_RIDE_TYPE);
|
||||
}
|
||||
|
||||
int32_t rideEntryIndex = ride_get_entry_index(_rideType, _subType);
|
||||
if (rideEntryIndex >= MAX_RIDE_OBJECTS)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_RIDE_TYPE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_RIDE_TYPE);
|
||||
}
|
||||
|
||||
const auto& colourPresets = RideTypeDescriptors[_rideType].ColourPresets;
|
||||
if (_colour1 >= colourPresets.count)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
rct_ride_entry* rideEntry = get_ride_entry(rideEntryIndex);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
vehicle_colour_preset_list* presetList = rideEntry->vehicle_preset_list;
|
||||
if ((presetList->count > 0 && presetList->count != 255) && _colour2 >= presetList->count)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
rct_ride_entry* rideEntry;
|
||||
auto res = MakeResult();
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid request for ride %u", rideIndex);
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = STR_UNKNOWN_OBJECT_TYPE;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
DEFINE_GAME_ACTION(RideDemolishAction, GAME_COMMAND_DEMOLISH_RIDE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideDemolishAction, GAME_COMMAND_DEMOLISH_RIDE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RideIdNewNull };
|
||||
|
@ -61,44 +61,45 @@ public:
|
|||
stream << DS_TAG(_rideIndex) << DS_TAG(_modifyType);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_DEMOLISH_RIDE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE);
|
||||
}
|
||||
|
||||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
|
||||
&& _modifyType == RIDE_MODIFY_DEMOLISH)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::NO_CLEARANCE, STR_CANT_DEMOLISH_RIDE,
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::NoClearance, STR_CANT_DEMOLISH_RIDE,
|
||||
STR_LOCAL_AUTHORITY_FORBIDS_DEMOLITION_OR_MODIFICATIONS_TO_THIS_RIDE);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr result = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr result = std::make_unique<GameActions::Result>();
|
||||
|
||||
if (_modifyType == RIDE_MODIFY_RENEW)
|
||||
{
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->status != RIDE_STATUS_SIMULATING)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_REFURBISH_RIDE, STR_MUST_BE_CLOSED_FIRST);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_CANT_REFURBISH_RIDE, STR_MUST_BE_CLOSED_FIRST);
|
||||
}
|
||||
|
||||
if (ride->num_riders > 0)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_REFURBISH_RIDE, STR_RIDE_NOT_YET_EMPTY);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_CANT_REFURBISH_RIDE, STR_RIDE_NOT_YET_EMPTY);
|
||||
}
|
||||
|
||||
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)
|
||||
|| RideTypeDescriptors[ride->type].AvailableBreakdowns == 0)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_REFURBISH_RIDE, STR_CANT_REFURBISH_NOT_NEEDED);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_CANT_REFURBISH_RIDE, STR_CANT_REFURBISH_NOT_NEEDED);
|
||||
}
|
||||
|
||||
result->ErrorTitle = STR_CANT_REFURBISH_RIDE;
|
||||
|
@ -108,13 +109,14 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_DEMOLISH_RIDE, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE);
|
||||
}
|
||||
|
||||
switch (_modifyType)
|
||||
|
@ -125,11 +127,11 @@ public:
|
|||
return RefurbishRide(ride);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_DO_THIS);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr DemolishRide(Ride * ride) const
|
||||
GameActions::Result::Ptr DemolishRide(Ride * ride) const
|
||||
{
|
||||
money32 refundPrice = DemolishTracks();
|
||||
|
||||
|
@ -240,7 +242,7 @@ private:
|
|||
|
||||
MarketingCancelCampaignsForRide(_rideIndex);
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::RideConstruction;
|
||||
res->Cost = refundPrice;
|
||||
|
||||
|
@ -280,7 +282,7 @@ private:
|
|||
setMazeTrack.SetFlags(GetFlags());
|
||||
|
||||
auto execRes = GameActions::ExecuteNested(&setMazeTrack);
|
||||
if (execRes->Error == GA_ERROR::OK)
|
||||
if (execRes->Error == GameActions::Status::Ok)
|
||||
{
|
||||
return execRes->Cost;
|
||||
}
|
||||
|
@ -317,7 +319,7 @@ private:
|
|||
|
||||
auto removRes = GameActions::ExecuteNested(&trackRemoveAction);
|
||||
|
||||
if (removRes->Error != GA_ERROR::OK)
|
||||
if (removRes->Error != GameActions::Status::Ok)
|
||||
{
|
||||
tile_element_remove(it.element);
|
||||
}
|
||||
|
@ -354,9 +356,9 @@ private:
|
|||
return refundPrice;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr RefurbishRide(Ride * ride) const
|
||||
GameActions::Result::Ptr RefurbishRide(Ride * ride) const
|
||||
{
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::RideConstruction;
|
||||
res->Cost = GetRefurbishPrice(ride);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideEntranceExitPlaceAction, GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideEntranceExitPlaceAction, GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
|
@ -61,36 +61,36 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_direction) << DS_TAG(_rideIndex) << DS_TAG(_stationNum) << DS_TAG(_isExit);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto errorTitle = _isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
|
||||
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, errorTitle);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, errorTitle);
|
||||
}
|
||||
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %d", static_cast<int32_t>(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
|
||||
}
|
||||
|
||||
if (_stationNum >= MAX_STATIONS)
|
||||
{
|
||||
log_warning("Invalid station number for ride. stationNum: %u", _stationNum);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
|
||||
}
|
||||
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->status != RIDE_STATUS_SIMULATING)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_CLOSED, errorTitle, STR_MUST_BE_CLOSED_FIRST);
|
||||
return MakeResult(GameActions::Status::NotClosed, errorTitle, STR_MUST_BE_CLOSED_FIRST);
|
||||
}
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, errorTitle, STR_NOT_ALLOWED_TO_MODIFY_STATION);
|
||||
return MakeResult(GameActions::Status::Disallowed, errorTitle, STR_NOT_ALLOWED_TO_MODIFY_STATION);
|
||||
}
|
||||
|
||||
const auto location = _isExit ? ride_get_exit_location(ride, _stationNum)
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
rideEntranceExitRemove.SetFlags(GetFlags());
|
||||
|
||||
auto result = GameActions::QueryNested(&rideEntranceExitRemove);
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
auto z = ride->stations[_stationNum].GetBaseZ();
|
||||
if (!LocationValid(_loc) || (!gCheatsSandboxMode && !map_is_location_owned({ _loc, z })))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, errorTitle);
|
||||
return MakeResult(GameActions::Status::NotOwned, errorTitle);
|
||||
}
|
||||
|
||||
auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight);
|
||||
|
@ -120,17 +120,17 @@ public:
|
|||
{ _loc, z, clear_z }, &map_place_non_scenery_clear_func, { 0b1111, 0 }, GetFlags(), &cost,
|
||||
CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, errorTitle, gGameCommandErrorText, gCommonFormatArgs);
|
||||
return MakeResult(GameActions::Status::NoClearance, errorTitle, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
if (gMapGroundFlags & ELEMENT_IS_UNDERWATER)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
|
||||
return MakeResult(GameActions::Status::Disallowed, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
|
||||
if (z > MaxRideEntranceOrExitHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, errorTitle, STR_TOO_HIGH);
|
||||
return MakeResult(GameActions::Status::Disallowed, errorTitle, STR_TOO_HIGH);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
// Remember when in unknown station num mode rideIndex is unknown and z is set
|
||||
// When in known station num mode rideIndex is known and z is unknown
|
||||
|
@ -149,7 +149,7 @@ public:
|
|||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %d", static_cast<int32_t>(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
|
||||
}
|
||||
|
||||
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
rideEntranceExitRemove.SetFlags(GetFlags());
|
||||
|
||||
auto result = GameActions::ExecuteNested(&rideEntranceExitRemove);
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public:
|
|||
{ _loc, z, clear_z }, &map_place_non_scenery_clear_func, { 0b1111, 0 }, GetFlags() | GAME_COMMAND_FLAG_APPLY,
|
||||
&cost, CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, errorTitle, gGameCommandErrorText, gCommonFormatArgs);
|
||||
return MakeResult(GameActions::Status::NoClearance, errorTitle, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
@ -234,18 +234,18 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
static GameActionResult::Ptr TrackPlaceQuery(const CoordsXYZ& loc, const bool isExit)
|
||||
static GameActions::Result::Ptr TrackPlaceQuery(const CoordsXYZ& loc, const bool isExit)
|
||||
{
|
||||
auto errorTitle = isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
|
||||
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, errorTitle);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, errorTitle);
|
||||
}
|
||||
|
||||
if (!gCheatsSandboxMode && !map_is_location_owned(loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, errorTitle);
|
||||
return MakeResult(GameActions::Status::NotOwned, errorTitle);
|
||||
}
|
||||
|
||||
int16_t baseZ = loc.z;
|
||||
|
@ -254,17 +254,17 @@ public:
|
|||
if (!map_can_construct_with_clear_at(
|
||||
{ loc, baseZ, clearZ }, &map_place_non_scenery_clear_func, { 0b1111, 0 }, 0, &cost, CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_CLEARANCE, errorTitle, gGameCommandErrorText, gCommonFormatArgs);
|
||||
return MakeResult(GameActions::Status::NoClearance, errorTitle, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
if (gMapGroundFlags & ELEMENT_IS_UNDERWATER)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
|
||||
return MakeResult(GameActions::Status::Disallowed, errorTitle, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
|
||||
if (baseZ > MaxRideEntranceOrExitHeight)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, errorTitle, STR_TOO_HIGH);
|
||||
return MakeResult(GameActions::Status::Disallowed, errorTitle, STR_TOO_HIGH);
|
||||
}
|
||||
auto res = MakeResult();
|
||||
res->Position = { loc.ToTileCentre(), tile_element_height(loc) };
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "../world/Entrance.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideEntranceExitRemoveAction, GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideEntranceExitRemoveAction, GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
|
@ -53,28 +53,28 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_rideIndex) << DS_TAG(_stationNum) << DS_TAG(_isExit);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride id %d for entrance/exit removal", static_cast<int32_t>(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->status != RIDE_STATUS_SIMULATING)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_MUST_BE_CLOSED_FIRST);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_MUST_BE_CLOSED_FIRST);
|
||||
}
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NOT_ALLOWED_TO_MODIFY_STATION);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NOT_ALLOWED_TO_MODIFY_STATION);
|
||||
}
|
||||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
|
@ -115,19 +115,19 @@ public:
|
|||
log_warning(
|
||||
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y,
|
||||
static_cast<int32_t>(_rideIndex), _stationNum);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride id %d for entrance/exit removal", static_cast<int32_t>(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
log_warning(
|
||||
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y,
|
||||
static_cast<int32_t>(_rideIndex), _stationNum);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
|
|
|
@ -35,7 +35,7 @@ enum class RideSetAppearanceType : uint8_t
|
|||
EntranceStyle
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetAppearanceAction, GAME_COMMAND_SET_RIDE_APPEARANCE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideSetAppearanceAction, GAME_COMMAND_SET_RIDE_APPEARANCE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RideIdNewNull };
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -72,13 +72,13 @@ public:
|
|||
stream << DS_TAG(_rideIndex) << DS_TAG(_type) << DS_TAG(_value) << DS_TAG(_index);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
if (_index >= std::size(ride->track_colour))
|
||||
{
|
||||
log_warning("Invalid game command, index %d out of bounds", _index);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
break;
|
||||
case RideSetAppearanceType::VehicleColourBody:
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
if (_index >= std::size(ride->vehicle_colours))
|
||||
{
|
||||
log_warning("Invalid game command, index %d out of bounds", _index);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
break;
|
||||
case RideSetAppearanceType::VehicleColourScheme:
|
||||
|
@ -106,19 +106,19 @@ public:
|
|||
break;
|
||||
default:
|
||||
log_warning("Invalid game command, type %d not recognised", _type);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
}
|
||||
window_invalidate_by_number(WC_RIDE, _rideIndex);
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
if (!ride->overall_view.isNull())
|
||||
{
|
||||
auto location = ride->overall_view.ToTileCentre();
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetColourSchemeAction, GAME_COMMAND_SET_COLOUR_SCHEME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideSetColourSchemeAction, GAME_COMMAND_SET_COLOUR_SCHEME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -56,18 +56,18 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_trackType) << DS_TAG(_newColourScheme);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::RideConstruction;
|
||||
res->ErrorTitle = STR_CANT_SET_COLOUR_SCHEME;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../world/Park.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetNameAction, GAME_COMMAND_SET_RIDE_NAME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideSetNameAction, GAME_COMMAND_SET_RIDE_NAME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RideIdNewNull };
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -54,31 +54,33 @@ public:
|
|||
stream << DS_TAG(_rideIndex) << DS_TAG(_name);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
|
||||
}
|
||||
|
||||
if (!_name.empty() && Ride::NameExists(_name, ride->id))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_RIDE_ATTRACTION, STR_ERROR_EXISTING_NAME);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_ERROR_EXISTING_NAME);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
|
||||
}
|
||||
|
||||
if (_name.empty())
|
||||
|
@ -99,7 +101,7 @@ public:
|
|||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_RIDE_LIST));
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST));
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
auto location = ride->overall_view.ToTileCentre();
|
||||
res->Position = { location, tile_element_height(location) };
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetPriceAction, GAME_COMMAND_SET_RIDE_PRICE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideSetPriceAction, GAME_COMMAND_SET_RIDE_PRICE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RideIdNewNull };
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -58,44 +58,44 @@ public:
|
|||
stream << DS_TAG(_rideIndex) << DS_TAG(_price) << DS_TAG(_primaryPrice);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::ParkRideTickets;
|
||||
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (!ride->overall_view.isNull())
|
||||
|
|
|
@ -28,7 +28,7 @@ enum class RideSetSetting : uint8_t
|
|||
RideType,
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetSettingAction, GAME_COMMAND_SET_RIDE_SETTING, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideSetSettingAction, GAME_COMMAND_SET_RIDE_SETTING, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RideIdNewNull };
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -63,13 +63,13 @@ public:
|
|||
stream << DS_TAG(_rideIndex) << DS_TAG(_setting) << DS_TAG(_value);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride: #%d.", static_cast<int32_t>(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
|
||||
switch (_setting)
|
||||
|
@ -78,18 +78,20 @@ public:
|
|||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_CHANGE_OPERATING_MODE, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING);
|
||||
GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE,
|
||||
STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING);
|
||||
}
|
||||
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->status != RIDE_STATUS_SIMULATING)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_CHANGE_OPERATING_MODE, STR_MUST_BE_CLOSED_FIRST);
|
||||
return MakeResult(
|
||||
GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, STR_MUST_BE_CLOSED_FIRST);
|
||||
}
|
||||
|
||||
if (!ride_is_mode_valid(ride) && !gCheatsShowAllOperatingModes)
|
||||
{
|
||||
log_warning("Invalid ride mode: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::Departure:
|
||||
|
@ -98,28 +100,28 @@ public:
|
|||
if (_value > 250)
|
||||
{
|
||||
log_warning("Invalid minimum waiting time: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::MaxWaitingTime:
|
||||
if (_value > 250)
|
||||
{
|
||||
log_warning("Invalid maximum waiting time: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::Operation:
|
||||
if (!ride_is_valid_operation_option(ride))
|
||||
{
|
||||
log_warning("Invalid operation option value: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, GetOperationErrorMessage(ride));
|
||||
return MakeResult(GameActions::Status::InvalidParameters, GetOperationErrorMessage(ride));
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::InspectionInterval:
|
||||
if (_value > RIDE_INSPECTION_NEVER)
|
||||
{
|
||||
log_warning("Invalid inspection interval: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::Music:
|
||||
|
@ -128,53 +130,53 @@ public:
|
|||
if (_value >= MUSIC_STYLE_COUNT)
|
||||
{
|
||||
log_warning("Invalid music style: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::LiftHillSpeed:
|
||||
if (!ride_is_valid_lift_hill_speed(ride))
|
||||
{
|
||||
log_warning("Invalid lift hill speed: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::NumCircuits:
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_CABLE_LIFT && _value > 1)
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE,
|
||||
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE,
|
||||
STR_MULTICIRCUIT_NOT_POSSIBLE_WITH_CABLE_LIFT_HILL);
|
||||
}
|
||||
|
||||
if (!ride_is_valid_num_circuits())
|
||||
{
|
||||
log_warning("Invalid number of circuits: %u", _value);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::RideType:
|
||||
if (!gCheatsAllowArbitraryRideTypeChanges)
|
||||
{
|
||||
log_warning("Arbitary ride type changes not allowed.");
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log_warning("Invalid RideSetSetting: %u", static_cast<uint8_t>(_setting));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
break;
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride: #%d.", static_cast<int32_t>(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
|
||||
switch (_setting)
|
||||
|
@ -247,7 +249,7 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
if (!ride->overall_view.isNull())
|
||||
{
|
||||
auto location = ride->overall_view.ToTileCentre();
|
||||
|
|
|
@ -30,7 +30,7 @@ static rct_string_id _StatusErrorTitles[] = {
|
|||
STR_CANT_SIMULATE,
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetStatusAction, GAME_COMMAND_SET_RIDE_STATUS, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideSetStatusAction, GAME_COMMAND_SET_RIDE_STATUS, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RideIdNewNull };
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -62,15 +62,15 @@ public:
|
|||
stream << DS_TAG(_rideIndex) << DS_TAG(_status);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->Error = GameActions::Status::InvalidParameters;
|
||||
res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
if (_status >= RIDE_STATUS_COUNT)
|
||||
{
|
||||
log_warning("Invalid ride status %u for ride %u", uint32_t(_status), uint32_t(_rideIndex));
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->Error = GameActions::Status::InvalidParameters;
|
||||
res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
if (_status == RIDE_STATUS_SIMULATING && (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
|
||||
{
|
||||
// Simulating will force clear the track, so make sure player can't cheat around a break down
|
||||
res->Error = GA_ERROR::DISALLOWED;
|
||||
res->Error = GameActions::Status::Disallowed;
|
||||
res->ErrorMessage = STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING;
|
||||
return res;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
{
|
||||
if (!ride_is_valid_for_test(ride, _status, false))
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = gGameCommandErrorText;
|
||||
return res;
|
||||
}
|
||||
|
@ -112,25 +112,25 @@ public:
|
|||
{
|
||||
if (!ride_is_valid_for_open(ride, _status == RIDE_STATUS_OPEN, false))
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = gGameCommandErrorText;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Expenditure = ExpenditureType::RideRunningCosts;
|
||||
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->Error = GameActions::Status::InvalidParameters;
|
||||
res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
|
||||
if (!ride_is_valid_for_test(ride, _status, true))
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = gGameCommandErrorText;
|
||||
return res;
|
||||
}
|
||||
|
@ -215,14 +215,14 @@ public:
|
|||
{
|
||||
if (!ride_is_valid_for_test(ride, _status, true))
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = gGameCommandErrorText;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else if (!ride_is_valid_for_open(ride, _status == RIDE_STATUS_OPEN, true))
|
||||
{
|
||||
res->Error = GA_ERROR::UNKNOWN;
|
||||
res->Error = GameActions::Status::Unknown;
|
||||
res->ErrorMessage = gGameCommandErrorText;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ enum class RideSetVehicleType : uint8_t
|
|||
Count,
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(RideSetVehicleAction, GAME_COMMAND_SET_RIDE_VEHICLES, GameActionResult)
|
||||
DEFINE_GAME_ACTION(RideSetVehicleAction, GAME_COMMAND_SET_RIDE_VEHICLES, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RideIdNewNull };
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
stream << DS_TAG(_rideIndex) << DS_TAG(_type) << DS_TAG(_value) << DS_TAG(_colour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_type >= RideSetVehicleType::Count)
|
||||
{
|
||||
|
@ -87,17 +87,18 @@ public:
|
|||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::BROKEN, errTitle, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Broken, errTitle, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING);
|
||||
}
|
||||
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->status != RIDE_STATUS_SIMULATING)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::NOT_CLOSED, errTitle, STR_MUST_BE_CLOSED_FIRST);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::NotClosed, errTitle, STR_MUST_BE_CLOSED_FIRST);
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
|
@ -110,13 +111,13 @@ public:
|
|||
if (!ride_is_vehicle_type_valid(ride))
|
||||
{
|
||||
log_error("Invalid vehicle type. type = %d", _value);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
auto rideEntry = get_ride_entry(_value);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
|
||||
// Validate preset
|
||||
|
@ -124,27 +125,27 @@ public:
|
|||
if (_colour >= presetList->count && _colour != 255 && _colour != 0)
|
||||
{
|
||||
log_error("Unknown vehicle colour preset. colour = %d", _colour);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
log_error("Unknown vehicle command. type = %d", _type);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto errTitle = SetVehicleTypeErrorTitle[EnumValue(_type)];
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
|
@ -167,7 +168,7 @@ public:
|
|||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
auto clampValue = _value;
|
||||
if (!gCheatsDisableTrainLengthLimit)
|
||||
|
@ -189,7 +190,7 @@ public:
|
|||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
|
||||
ride_set_vehicle_colours_to_random_preset(ride, _colour);
|
||||
|
@ -203,13 +204,13 @@ public:
|
|||
|
||||
default:
|
||||
log_error("Unknown vehicle command. type = %d", _type);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
|
||||
}
|
||||
|
||||
ride->num_circuits = 1;
|
||||
ride->UpdateMaxVehicles();
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
if (!ride->overall_view.isNull())
|
||||
{
|
||||
auto location = ride->overall_view.ToTileCentre();
|
||||
|
|
|
@ -45,7 +45,7 @@ enum class ScenarioSetSetting : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(ScenarioSetSettingAction, GAME_COMMAND_EDIT_SCENARIO_OPTIONS, GameActionResult)
|
||||
DEFINE_GAME_ACTION(ScenarioSetSettingAction, GAME_COMMAND_EDIT_SCENARIO_OPTIONS, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
ScenarioSetSetting _setting{ ScenarioSetSetting::Count };
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -71,18 +71,18 @@ public:
|
|||
stream << DS_TAG(_setting) << DS_TAG(_value);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_setting >= ScenarioSetSetting::Count)
|
||||
{
|
||||
log_error("Invalid setting: %u", _setting);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
switch (_setting)
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ public:
|
|||
break;
|
||||
default:
|
||||
log_error("Invalid setting: %u", _setting);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
break;
|
||||
}
|
||||
window_invalidate_by_class(WC_EDITOR_SCENARIO_OPTIONS);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "ParkSetLoanAction.hpp"
|
||||
#include "ParkSetParameterAction.hpp"
|
||||
|
||||
DEFINE_GAME_ACTION(SetCheatAction, GAME_COMMAND_CHEAT, GameActionResult)
|
||||
DEFINE_GAME_ACTION(SetCheatAction, GAME_COMMAND_CHEAT, GameActions::Result)
|
||||
{
|
||||
using ParametersRange = std::pair<std::pair<int32_t, int32_t>, std::pair<int32_t, int32_t>>;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -72,28 +72,28 @@ public:
|
|||
stream << DS_TAG(_cheatType) << DS_TAG(_param1) << DS_TAG(_param2);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (static_cast<uint32_t>(_cheatType) >= static_cast<uint32_t>(CheatType::Count))
|
||||
{
|
||||
MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
ParametersRange validRange = GetParameterRange(static_cast<CheatType>(_cheatType.id));
|
||||
|
||||
if (_param1 < validRange.first.first || _param1 > validRange.first.second)
|
||||
{
|
||||
MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
if (_param2 < validRange.second.first || _param2 > validRange.second.second)
|
||||
{
|
||||
MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
switch (static_cast<CheatType>(_cheatType.id))
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ public:
|
|||
default:
|
||||
{
|
||||
log_error("Unabled cheat: %d", _cheatType.id);
|
||||
MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "../world/Park.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SetParkEntranceFeeAction, GAME_COMMAND_SET_PARK_ENTRANCE_FEE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(SetParkEntranceFeeAction, GAME_COMMAND_SET_PARK_ENTRANCE_FEE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
money16 _fee{ MONEY16_UNDEFINED };
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -40,25 +40,25 @@ public:
|
|||
stream << DS_TAG(_fee);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
bool noMoney = (gParkFlags & PARK_FLAGS_NO_MONEY) != 0;
|
||||
bool forceFreeEntry = !park_entry_price_unlocked();
|
||||
if (noMoney || forceFreeEntry)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::DISALLOWED, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_NONE);
|
||||
}
|
||||
if (_fee < MONEY_FREE || _fee > MAX_ENTRANCE_FEE)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
gParkEntranceFee = _fee;
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
DEFINE_GAME_ACTION(SignSetNameAction, GAME_COMMAND_SET_SIGN_NAME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(SignSetNameAction, GAME_COMMAND_SET_SIGN_NAME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
BannerIndex _bannerIndex{ BANNER_INDEX_NULL };
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -46,17 +46,17 @@ public:
|
|||
stream << DS_TAG(_bannerIndex) << DS_TAG(_name);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_bannerIndex >= MAX_BANNERS)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign name, banner id = %d", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto banner = GetBanner(_bannerIndex);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SignSetStyleAction, GAME_COMMAND_SET_SIGN_STYLE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(SignSetStyleAction, GAME_COMMAND_SET_SIGN_STYLE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
BannerIndex _bannerIndex{ BANNER_INDEX_NULL };
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -49,12 +49,12 @@ public:
|
|||
stream << DS_TAG(_bannerIndex) << DS_TAG(_mainColour) << DS_TAG(_textColour) << DS_TAG(_isLarge);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_bannerIndex >= MAX_BANNERS)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign style, banner id '%d' out of range", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (_isLarge)
|
||||
|
@ -63,12 +63,12 @@ public:
|
|||
if (tileElement == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign style, banner id '%d' is not large", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -78,14 +78,14 @@ public:
|
|||
if (!wallElement)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto banner = GetBanner(_bannerIndex);
|
||||
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
{ coords, tileElement->GetBaseZ(), tileElement->GetDirection() },
|
||||
tileElement->AsLargeScenery()->GetSequenceIndex(), _mainColour, _textColour))
|
||||
{
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_NONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -27,23 +27,23 @@
|
|||
#include "../world/TileElement.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
class SmallSceneryPlaceActionResult final : public GameActionResult
|
||||
class SmallSceneryPlaceActionResult final : public GameActions::Result
|
||||
{
|
||||
public:
|
||||
SmallSceneryPlaceActionResult()
|
||||
: GameActionResult(GA_ERROR::OK, STR_CANT_POSITION_THIS_HERE)
|
||||
: GameActions::Result(GameActions::Status::Ok, STR_CANT_POSITION_THIS_HERE)
|
||||
{
|
||||
}
|
||||
SmallSceneryPlaceActionResult(GA_ERROR error)
|
||||
: GameActionResult(error, STR_CANT_POSITION_THIS_HERE)
|
||||
SmallSceneryPlaceActionResult(GameActions::Status error)
|
||||
: GameActions::Result(error, STR_CANT_POSITION_THIS_HERE)
|
||||
{
|
||||
}
|
||||
SmallSceneryPlaceActionResult(GA_ERROR error, rct_string_id message)
|
||||
: GameActionResult(error, STR_CANT_POSITION_THIS_HERE, message)
|
||||
SmallSceneryPlaceActionResult(GameActions::Status error, rct_string_id message)
|
||||
: GameActions::Result(error, STR_CANT_POSITION_THIS_HERE, message)
|
||||
{
|
||||
}
|
||||
SmallSceneryPlaceActionResult(GA_ERROR error, rct_string_id message, uint8_t* args)
|
||||
: GameActionResult(error, STR_CANT_POSITION_THIS_HERE, message, args)
|
||||
SmallSceneryPlaceActionResult(GameActions::Status error, rct_string_id message, uint8_t* args)
|
||||
: GameActions::Result(error, STR_CANT_POSITION_THIS_HERE, message, args)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
<< DS_TAG(_secondaryColour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
bool isOnWater = false;
|
||||
bool supportsRequired = false;
|
||||
|
@ -129,23 +129,23 @@ public:
|
|||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GameActions::Status::NoFreeElements);
|
||||
}
|
||||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
if (!byte_9D8150 && (_loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY))
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
rct_scenery_entry* sceneryEntry = get_small_scenery_entry(_sceneryType);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
auto quadrant = _quadrant;
|
||||
|
@ -194,7 +194,7 @@ public:
|
|||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode
|
||||
&& !map_is_location_owned({ _loc.x, _loc.y, targetHeight }))
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::NOT_OWNED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GameActions::Status::NotOwned, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
auto* surfaceElement = map_get_surface_element_at(_loc);
|
||||
|
@ -204,7 +204,8 @@ public:
|
|||
int32_t water_height = surfaceElement->GetWaterHeight() - 1;
|
||||
if (water_height > targetHeight)
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +213,8 @@ public:
|
|||
{
|
||||
if (isOnWater)
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ON_LAND);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ON_LAND);
|
||||
}
|
||||
|
||||
if (surfaceElement != nullptr && surfaceElement->GetWaterHeight() > 0)
|
||||
|
@ -220,7 +222,7 @@ public:
|
|||
if (surfaceElement->GetWaterHeight() > targetHeight)
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ON_LAND);
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ON_LAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +231,7 @@ public:
|
|||
&& (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE)) && !supportsRequired
|
||||
&& !isOnWater && surfaceElement != nullptr && (surfaceElement->GetSlope() != TILE_ELEMENT_SLOPE_FLAT))
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_LEVEL_LAND_REQUIRED);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GameActions::Status::Disallowed, STR_LEVEL_LAND_REQUIRED);
|
||||
}
|
||||
|
||||
if (!gCheatsDisableSupportLimits && !(scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_STACKABLE))
|
||||
|
@ -241,13 +243,15 @@ public:
|
|||
{
|
||||
if (surfaceElement->GetWaterHeight() > 0 || (surfaceElement->GetBaseZ()) != targetHeight)
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_LEVEL_LAND_REQUIRED);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_LEVEL_LAND_REQUIRED);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ON_LAND);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ON_LAND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +300,7 @@ public:
|
|||
CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, gGameCommandErrorText, gCommonFormatArgs);
|
||||
GameActions::Status::Disallowed, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
res->GroundFlags = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||
|
@ -307,7 +311,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
bool supportsRequired = false;
|
||||
if (_loc.z != 0)
|
||||
|
@ -336,7 +340,7 @@ public:
|
|||
rct_scenery_entry* sceneryEntry = get_small_scenery_entry(_sceneryType);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
auto quadrant = _quadrant;
|
||||
|
@ -434,7 +438,7 @@ public:
|
|||
&clearCost, CREATE_CROSSING_MODE_NONE))
|
||||
{
|
||||
return std::make_unique<SmallSceneryPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, gGameCommandErrorText, gCommonFormatArgs);
|
||||
GameActions::Status::Disallowed, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
res->GroundFlags = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SmallSceneryRemoveAction, GAME_COMMAND_REMOVE_SCENERY, GameActionResult)
|
||||
DEFINE_GAME_ACTION(SmallSceneryRemoveAction, GAME_COMMAND_REMOVE_SCENERY, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -59,19 +59,19 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_quadrant) << DS_TAG(_sceneryType);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
rct_scenery_entry* entry = get_small_scenery_entry(_sceneryType);
|
||||
if (entry == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
res->Cost = entry->small_scenery.removal_price * 10;
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
{
|
||||
if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_IS_TREE))
|
||||
{
|
||||
res->Error = GA_ERROR::NO_CLEARANCE;
|
||||
res->Error = GameActions::Status::NoClearance;
|
||||
res->ErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
res->ErrorMessage = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY;
|
||||
return res;
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
// Check if the land is owned
|
||||
if (!map_is_location_owned(_loc))
|
||||
{
|
||||
res->Error = GA_ERROR::NO_CLEARANCE;
|
||||
res->Error = GameActions::Status::NoClearance;
|
||||
res->ErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
res->ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK;
|
||||
return res;
|
||||
|
@ -105,20 +105,20 @@ public:
|
|||
TileElement* tileElement = FindSceneryElement();
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
|
||||
rct_scenery_entry* entry = get_small_scenery_entry(_sceneryType);
|
||||
if (entry == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
res->Cost = entry->small_scenery.removal_price * 10;
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
TileElement* tileElement = FindSceneryElement();
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
res->Position.z = tile_element_height(res->Position);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "../world/TileElement.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SmallScenerySetColourAction, GAME_COMMAND_SET_SCENERY_COLOUR, GameActionResult)
|
||||
DEFINE_GAME_ACTION(SmallScenerySetColourAction, GAME_COMMAND_SET_SCENERY_COLOUR, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -62,18 +62,18 @@ public:
|
|||
<< DS_TAG(_secondaryColour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
@ -84,14 +84,14 @@ private:
|
|||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
if (!map_is_location_owned(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ private:
|
|||
if (sceneryElement == nullptr)
|
||||
{
|
||||
log_error("Small scenery not found at: x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(sceneryElement->IsGhost()))
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffFireAction, GAME_COMMAND_FIRE_STAFF_MEMBER, GameActionResult)
|
||||
DEFINE_GAME_ACTION(StaffFireAction, GAME_COMMAND_FIRE_STAFF_MEMBER, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteId{ SPRITE_INDEX_NULL };
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -37,31 +37,31 @@ public:
|
|||
stream << DS_TAG(_spriteId);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_spriteId >= MAX_SPRITES)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto staff = TryGetEntity<Staff>(_spriteId);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto staff = TryGetEntity<Staff>(_spriteId);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
window_close_by_class(WC_FIRE_PROMPT);
|
||||
peep_sprite_remove(staff);
|
||||
|
|
|
@ -35,15 +35,15 @@ static constexpr const PeepSpriteType spriteTypes[] = {
|
|||
PeepSpriteType::EntertainerPanda,
|
||||
};
|
||||
|
||||
class StaffHireNewActionResult final : public GameActionResult
|
||||
class StaffHireNewActionResult final : public GameActions::Result
|
||||
{
|
||||
public:
|
||||
StaffHireNewActionResult()
|
||||
: GameActionResult(GA_ERROR::OK, STR_CANT_HIRE_NEW_STAFF)
|
||||
: GameActions::Result(GameActions::Status::Ok, STR_CANT_HIRE_NEW_STAFF)
|
||||
{
|
||||
}
|
||||
StaffHireNewActionResult(GA_ERROR error, rct_string_id message)
|
||||
: GameActionResult(error, STR_CANT_HIRE_NEW_STAFF, message)
|
||||
StaffHireNewActionResult(GameActions::Status error, rct_string_id message)
|
||||
: GameActions::Result(error, STR_CANT_HIRE_NEW_STAFF, message)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -80,18 +80,18 @@ public:
|
|||
stream << DS_TAG(_autoPosition) << DS_TAG(_staffType) << DS_TAG(_entertainerType) << DS_TAG(_staffOrders);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool execute) const
|
||||
GameActions::Result::Ptr QueryExecute(bool execute) const
|
||||
{
|
||||
auto res = std::make_unique<StaffHireNewActionResult>();
|
||||
|
||||
|
@ -102,12 +102,12 @@ private:
|
|||
// Invalid staff type.
|
||||
log_error("Tried to use invalid staff type: %u", static_cast<uint32_t>(_staffType));
|
||||
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (GetEntityListCount(EntityListId::Free) < 400)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TOO_MANY_PEOPLE_IN_GAME);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_TOO_MANY_PEOPLE_IN_GAME);
|
||||
}
|
||||
|
||||
if (_staffType == static_cast<uint8_t>(StaffType::Entertainer))
|
||||
|
@ -117,7 +117,7 @@ private:
|
|||
// Invalid entertainer costume
|
||||
log_error("Tried to use invalid entertainer type: %u", static_cast<uint32_t>(_entertainerType));
|
||||
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
uint32_t availableCostumes = staff_get_available_entertainer_costumes();
|
||||
|
@ -126,7 +126,7 @@ private:
|
|||
// Entertainer costume unavailable
|
||||
log_error("Tried to use unavailable entertainer type: %u", static_cast<uint32_t>(_entertainerType));
|
||||
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,14 +141,14 @@ private:
|
|||
if (staffIndex == STAFF_MAX_COUNT)
|
||||
{
|
||||
// Too many staff members exist already.
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TOO_MANY_STAFF_IN_GAME);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_TOO_MANY_STAFF_IN_GAME);
|
||||
}
|
||||
|
||||
Peep* newPeep = &(create_sprite(SPRITE_IDENTIFIER_PEEP)->peep);
|
||||
if (newPeep == nullptr)
|
||||
{
|
||||
// Too many peeps exist already.
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TOO_MANY_PEOPLE_IN_GAME);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_TOO_MANY_PEOPLE_IN_GAME);
|
||||
}
|
||||
|
||||
if (execute == false)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetColourAction, GAME_COMMAND_SET_STAFF_COLOUR, GameActionResult)
|
||||
DEFINE_GAME_ACTION(StaffSetColourAction, GAME_COMMAND_SET_STAFF_COLOUR, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint8_t _staffType{};
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -45,22 +45,22 @@ public:
|
|||
stream << DS_TAG(_staffType) << DS_TAG(_colour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto staffType = static_cast<StaffType>(_staffType);
|
||||
if (staffType != StaffType::Handyman && staffType != StaffType::Mechanic && staffType != StaffType::Security)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
// Update global uniform colour property
|
||||
if (!staff_set_colour(static_cast<StaffType>(_staffType), _colour))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
// Update each staff member's uniform
|
||||
|
|
|
@ -38,7 +38,7 @@ constexpr const bool peep_slow_walking_types[] = {
|
|||
true, // PeepSpriteType::Balloon
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetCostumeAction, GAME_COMMAND_SET_STAFF_COSTUME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(StaffSetCostumeAction, GAME_COMMAND_SET_STAFF_COSTUME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -64,36 +64,36 @@ public:
|
|||
stream << DS_TAG(_spriteIndex) << DS_TAG(_costume);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto* staff = TryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto spriteType = EntertainerCostumeToSprite(_costume);
|
||||
if (EnumValue(spriteType) > std::size(peep_slow_walking_types))
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto* staff = TryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto spriteType = EntertainerCostumeToSprite(_costume);
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Position.x = staff->x;
|
||||
res->Position.y = staff->y;
|
||||
res->Position.z = staff->z;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetNameAction, GAME_COMMAND_SET_STAFF_NAME, GameActionResult)
|
||||
DEFINE_GAME_ACTION(StaffSetNameAction, GAME_COMMAND_SET_STAFF_NAME, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -48,44 +48,44 @@ public:
|
|||
stream << DS_TAG(_spriteIndex) << DS_TAG(_name);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE);
|
||||
}
|
||||
|
||||
auto staff = TryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto staff = TryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE);
|
||||
}
|
||||
|
||||
auto curName = staff->GetName();
|
||||
if (curName == _name)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::OK, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Ok, STR_NONE);
|
||||
}
|
||||
|
||||
if (!staff->SetName(_name))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
}
|
||||
|
||||
gfx_invalidate_screen();
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Position.x = staff->x;
|
||||
res->Position.y = staff->y;
|
||||
res->Position.z = staff->z;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetOrdersAction, GAME_COMMAND_SET_STAFF_ORDERS, GameActionResult)
|
||||
DEFINE_GAME_ACTION(StaffSetOrdersAction, GAME_COMMAND_SET_STAFF_ORDERS, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteIndex{ SPRITE_INDEX_NULL };
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -44,11 +44,11 @@ public:
|
|||
stream << DS_TAG(_spriteIndex) << DS_TAG(_ordersId);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto* staff = TryGetEntity<Staff>(_spriteIndex);
|
||||
|
@ -56,19 +56,19 @@ public:
|
|||
|| (staff->AssignedStaffType != StaffType::Handyman && staff->AssignedStaffType != StaffType::Mechanic))
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
return std::make_unique<GameActions::Result>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto* staff = TryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
staff->StaffOrders = _ordersId;
|
||||
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
auto res = std::make_unique<GameActions::Result>();
|
||||
res->Position.x = staff->x;
|
||||
res->Position.y = staff->y;
|
||||
res->Position.z = staff->z;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetPatrolAreaAction, GAME_COMMAND_SET_STAFF_PATROL, GameActionResult)
|
||||
DEFINE_GAME_ACTION(StaffSetPatrolAreaAction, GAME_COMMAND_SET_STAFF_PATROL, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
uint16_t _spriteId{ SPRITE_INDEX_NULL };
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -40,36 +40,36 @@ public:
|
|||
stream << DS_TAG(_spriteId) << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
if (_spriteId >= MAX_SPRITES)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto staff = TryGetEntity<Staff>(_spriteId);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto staff = TryGetEntity<Staff>(_spriteId);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
int32_t patrolOffset = staff->StaffId * STAFF_PATROL_AREA_SIZE;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../world/TileElement.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(SurfaceSetStyleAction, GAME_COMMAND_CHANGE_SURFACE_STYLE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(SurfaceSetStyleAction, GAME_COMMAND_CHANGE_SURFACE_STYLE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
stream << DS_TAG(_range) << DS_TAG(_surfaceStyle) << DS_TAG(_edgeStyle);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->ErrorTitle = STR_CANT_CHANGE_LAND_TYPE;
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
if (_surfaceStyle > 0x1F)
|
||||
{
|
||||
log_error("Invalid surface style.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_LAND_TYPE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
|
||||
}
|
||||
|
||||
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
if (surfaceObj == nullptr)
|
||||
{
|
||||
log_error("Invalid surface style.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_LAND_TYPE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
if (_edgeStyle > 0xF)
|
||||
{
|
||||
log_error("Invalid edge style.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_LAND_TYPE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
|
||||
}
|
||||
|
||||
const auto edgeObj = static_cast<TerrainEdgeObject*>(
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
if (edgeObj == nullptr)
|
||||
{
|
||||
log_error("Invalid edge style.");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_LAND_TYPE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode
|
||||
&& (gParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_CHANGE_LAND_TYPE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_CANT_CHANGE_LAND_TYPE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
|
||||
}
|
||||
|
||||
money32 surfaceCost = 0;
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->ErrorTitle = STR_CANT_CHANGE_LAND_TYPE;
|
||||
|
|
|
@ -42,7 +42,7 @@ enum class TileModifyType : uint8_t
|
|||
Count,
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(TileModifyAction, GAME_COMMAND_MODIFY_TILE, GameActionResult)
|
||||
DEFINE_GAME_ACTION(TileModifyAction, GAME_COMMAND_MODIFY_TILE, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -75,22 +75,22 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_setting) << DS_TAG(_value1) << DS_TAG(_value2) << DS_TAG(_pasteElement);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
auto res = MakeResult();
|
||||
switch (_setting)
|
||||
|
@ -259,7 +259,7 @@ private:
|
|||
}
|
||||
default:
|
||||
log_error("invalid instruction");
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static int32_t place_virtual_track(
|
|||
return place_virtual_track(const_cast<TrackDesign*>(&td6), ptdOperation, placeScenery, ride, loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr TrackDesignAction::Query() const
|
||||
GameActions::Result::Ptr TrackDesignAction::Query() const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Position.x = _loc.x + 16;
|
||||
|
@ -38,7 +38,7 @@ GameActionResult::Ptr TrackDesignAction::Query() const
|
|||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
const rct_object_entry* rideEntryObject = &_td.vehicle_object;
|
||||
|
@ -61,16 +61,16 @@ GameActionResult::Ptr TrackDesignAction::Query() const
|
|||
auto r = GameActions::ExecuteNested(&rideCreateAction);
|
||||
auto rideIndex = static_cast<RideCreateGameActionResult*>(r.get())->rideIndex;
|
||||
|
||||
if (r->Error != GA_ERROR::OK)
|
||||
if (r->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
|
||||
}
|
||||
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for track placement, ride id = %d", rideIndex);
|
||||
return MakeResult(GA_ERROR::UNKNOWN);
|
||||
return MakeResult(GameActions::Status::Unknown);
|
||||
}
|
||||
|
||||
money32 cost = 0;
|
||||
|
@ -90,13 +90,13 @@ GameActionResult::Ptr TrackDesignAction::Query() const
|
|||
GameActions::ExecuteNested(&gameAction);
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, error_reason);
|
||||
return MakeResult(GameActions::Status::Disallowed, error_reason);
|
||||
}
|
||||
res->Cost = cost;
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr TrackDesignAction::Execute() const
|
||||
GameActions::Result::Ptr TrackDesignAction::Execute() const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Position.x = _loc.x + 16;
|
||||
|
@ -124,16 +124,16 @@ GameActionResult::Ptr TrackDesignAction::Execute() const
|
|||
auto r = GameActions::ExecuteNested(&rideCreateAction);
|
||||
auto rideIndex = static_cast<RideCreateGameActionResult*>(r.get())->rideIndex;
|
||||
|
||||
if (r->Error != GA_ERROR::OK)
|
||||
if (r->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
|
||||
}
|
||||
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for track placement, ride id = %d", rideIndex);
|
||||
return MakeResult(GA_ERROR::UNKNOWN);
|
||||
return MakeResult(GameActions::Status::Unknown);
|
||||
}
|
||||
|
||||
money32 cost = 0;
|
||||
|
@ -171,7 +171,7 @@ GameActionResult::Ptr TrackDesignAction::Execute() const
|
|||
gameAction.SetFlags(GetFlags());
|
||||
|
||||
GameActions::ExecuteNested(&gameAction);
|
||||
return MakeResult(GA_ERROR::DISALLOWED, error_reason);
|
||||
return MakeResult(GameActions::Status::Disallowed, error_reason);
|
||||
}
|
||||
|
||||
if (entryIndex != 0xFF)
|
||||
|
@ -221,7 +221,7 @@ GameActionResult::Ptr TrackDesignAction::Execute() const
|
|||
ride->vehicle_colours[i].Ternary = _td.vehicle_additional_colour[i];
|
||||
}
|
||||
|
||||
for (int32_t count = 1; count == 1 || r->Error != GA_ERROR::OK; ++count)
|
||||
for (int32_t count = 1; count == 1 || r->Error != GameActions::Status::Ok; ++count)
|
||||
{
|
||||
auto name = count == 1 ? _td.name : (_td.name + " " + std::to_string(count));
|
||||
auto gameAction = RideSetNameAction(ride->id, name);
|
||||
|
|
|
@ -12,23 +12,23 @@
|
|||
#include "../ride/TrackDesign.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
class TrackDesignActionResult final : public GameActionResult
|
||||
class TrackDesignActionResult final : public GameActions::Result
|
||||
{
|
||||
public:
|
||||
TrackDesignActionResult()
|
||||
: GameActionResult(GA_ERROR::OK, STR_NONE)
|
||||
: GameActions::Result(GameActions::Status::Ok, STR_NONE)
|
||||
{
|
||||
}
|
||||
TrackDesignActionResult(GA_ERROR error)
|
||||
: GameActionResult(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE)
|
||||
TrackDesignActionResult(GameActions::Status error)
|
||||
: GameActions::Result(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE)
|
||||
{
|
||||
}
|
||||
TrackDesignActionResult(GA_ERROR error, rct_string_id title, rct_string_id message)
|
||||
: GameActionResult(error, title, message)
|
||||
TrackDesignActionResult(GameActions::Status error, rct_string_id title, rct_string_id message)
|
||||
: GameActions::Result(error, title, message)
|
||||
{
|
||||
}
|
||||
TrackDesignActionResult(GA_ERROR error, rct_string_id message)
|
||||
: GameActionResult(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, message)
|
||||
TrackDesignActionResult(GameActions::Status error, rct_string_id message)
|
||||
: GameActions::Result(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, message)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,6 @@ public:
|
|||
_td.Serialise(stream);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override;
|
||||
GameActionResult::Ptr Execute() const override;
|
||||
GameActions::Result::Ptr Query() const override;
|
||||
GameActions::Result::Ptr Execute() const override;
|
||||
};
|
||||
|
|
|
@ -19,23 +19,23 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
class TrackPlaceActionResult final : public GameActionResult
|
||||
class TrackPlaceActionResult final : public GameActions::Result
|
||||
{
|
||||
public:
|
||||
TrackPlaceActionResult()
|
||||
: GameActionResult(GA_ERROR::OK, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE)
|
||||
: GameActions::Result(GameActions::Status::Ok, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE)
|
||||
{
|
||||
}
|
||||
TrackPlaceActionResult(GA_ERROR error)
|
||||
: GameActionResult(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE)
|
||||
TrackPlaceActionResult(GameActions::Status error)
|
||||
: GameActions::Result(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE)
|
||||
{
|
||||
}
|
||||
TrackPlaceActionResult(GA_ERROR error, rct_string_id message)
|
||||
: GameActionResult(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, message)
|
||||
TrackPlaceActionResult(GameActions::Status error, rct_string_id message)
|
||||
: GameActions::Result(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, message)
|
||||
{
|
||||
}
|
||||
TrackPlaceActionResult(GA_ERROR error, rct_string_id message, uint8_t* args)
|
||||
: GameActionResult(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, message, args)
|
||||
TrackPlaceActionResult(GameActions::Status error, rct_string_id message, uint8_t* args)
|
||||
: GameActions::Result(error, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, message, args)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -96,25 +96,25 @@ public:
|
|||
<< DS_TAG(_seatRotation) << DS_TAG(_trackPlaceFlags);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride subtype for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (!direction_valid(_origin.direction))
|
||||
{
|
||||
log_warning("Invalid direction for track placement, direction = %d", _origin.direction);
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
auto res = std::make_unique<TrackPlaceActionResult>();
|
||||
|
@ -129,15 +129,15 @@ public:
|
|||
|
||||
if ((ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) && _trackType == TrackElemType::EndStation)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_NOT_ALLOWED_TO_MODIFY_STATION);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::Disallowed, STR_NOT_ALLOWED_TO_MODIFY_STATION);
|
||||
}
|
||||
|
||||
if (!(GetActionFlags() & GA_FLAGS::ALLOW_WHILE_PAUSED))
|
||||
if (!(GetActionFlags() & GameActions::Flags::AllowWhilePaused))
|
||||
{
|
||||
if (game_is_paused() && !gCheatsBuildInPauseMode)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED);
|
||||
GameActions::Status::Disallowed, STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,8 @@ public:
|
|||
{
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_ONLY_ONE_ON_RIDE_PHOTO_PER_RIDE);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_ONLY_ONE_ON_RIDE_PHOTO_PER_RIDE);
|
||||
}
|
||||
}
|
||||
else if (_trackType == TrackElemType::CableLiftHill)
|
||||
|
@ -155,7 +156,7 @@ public:
|
|||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_CABLE_LIFT_HILL_COMPONENT_USED)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_ONLY_ONE_CABLE_LIFT_HILL_PER_RIDE);
|
||||
GameActions::Status::Disallowed, STR_ONLY_ONE_CABLE_LIFT_HILL_PER_RIDE);
|
||||
}
|
||||
}
|
||||
// Backwards steep lift hills are allowed, even on roller coasters that do not support forwards steep lift hills.
|
||||
|
@ -165,7 +166,8 @@ public:
|
|||
{
|
||||
if (TrackFlags[_trackType] & TRACK_ELEM_FLAG_IS_STEEP_UP)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_TOO_STEEP_FOR_LIFT_HILL);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_TOO_STEEP_FOR_LIFT_HILL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +183,7 @@ public:
|
|||
|
||||
if (!LocationValid(tileCoords) || (!map_is_location_owned(tileCoords) && !gCheatsSandboxMode))
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
numElements++;
|
||||
}
|
||||
|
@ -189,7 +191,8 @@ public:
|
|||
if (!map_check_free_elements_and_reorganise(numElements))
|
||||
{
|
||||
log_warning("Not enough free map elments to place track.");
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS, STR_TILE_ELEMENT_LIMIT_REACHED);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::NoFreeElements, STR_TILE_ELEMENT_LIMIT_REACHED);
|
||||
}
|
||||
const uint16_t* trackFlags = (rideTypeFlags & RIDE_TYPE_FLAG_FLAT_RIDE) ? FlatTrackFlags : TrackFlags;
|
||||
if (!gCheatsAllowTrackPlaceInvalidHeights)
|
||||
|
@ -198,14 +201,16 @@ public:
|
|||
{
|
||||
if ((_origin.z & 0x0F) != 8)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CONSTRUCTION_ERR_UNKNOWN);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::InvalidParameters, STR_CONSTRUCTION_ERR_UNKNOWN);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((_origin.z & 0x0F) != 0)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CONSTRUCTION_ERR_UNKNOWN);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::InvalidParameters, STR_CONSTRUCTION_ERR_UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +226,7 @@ public:
|
|||
|
||||
if (mapLoc.z < 16)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_TOO_LOW);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_TOO_LOW);
|
||||
}
|
||||
|
||||
int32_t baseZ = floor2(mapLoc.z, COORDS_Z_STEP);
|
||||
|
@ -241,7 +246,7 @@ public:
|
|||
|
||||
if (clearanceZ > MAX_TRACK_HEIGHT)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_TOO_HIGH);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_TOO_HIGH);
|
||||
}
|
||||
|
||||
uint8_t crossingMode = (RideTypeDescriptors[ride->type].HasFlag(RIDE_TYPE_FLAG_SUPPORTS_LEVEL_CROSSINGS)
|
||||
|
@ -253,7 +258,7 @@ public:
|
|||
crossingMode))
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::NO_CLEARANCE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
GameActions::Status::NoClearance, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
// When building a level crossing, remove any pre-existing path furniture.
|
||||
|
@ -270,7 +275,7 @@ public:
|
|||
if (res->GroundFlags != 0 && (res->GroundFlags & mapGroundFlags) == 0)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
|
||||
GameActions::Status::Disallowed, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
|
||||
}
|
||||
|
||||
res->GroundFlags = mapGroundFlags;
|
||||
|
@ -281,7 +286,7 @@ public:
|
|||
if (res->GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +297,7 @@ public:
|
|||
if (res->GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +309,7 @@ public:
|
|||
if (!(gMapGroundFlags & ELEMENT_IS_UNDERWATER))
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_UNDERWATER);
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -315,31 +320,34 @@ public:
|
|||
if (gMapGroundFlags & ELEMENT_IS_UNDERWATER)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_UNDERWATER);
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gMapGroundFlags & ELEMENT_IS_UNDERWATER && !gCheatsDisableClearanceChecks)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_RIDE_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
|
||||
if ((rideTypeFlags & RIDE_TYPE_FLAG_TRACK_MUST_BE_ON_WATER) && !byte_9D8150)
|
||||
{
|
||||
auto surfaceElement = map_get_surface_element_at(mapLoc);
|
||||
if (surfaceElement == nullptr)
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::Unknown, STR_NONE);
|
||||
|
||||
auto waterHeight = surfaceElement->GetWaterHeight();
|
||||
if (waterHeight == 0)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ON_WATER);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ON_WATER);
|
||||
}
|
||||
|
||||
if (waterHeight != baseZ)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ON_WATER);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ON_WATER);
|
||||
}
|
||||
waterHeight -= LAND_HEIGHT_STEP;
|
||||
if (waterHeight == surfaceElement->GetBaseZ())
|
||||
|
@ -348,7 +356,8 @@ public:
|
|||
if (slope == TILE_ELEMENT_SLOPE_W_CORNER_DN || slope == TILE_ELEMENT_SLOPE_S_CORNER_DN
|
||||
|| slope == TILE_ELEMENT_SLOPE_E_CORNER_DN || slope == TILE_ELEMENT_SLOPE_N_CORNER_DN)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ON_WATER);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ON_WATER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,14 +375,14 @@ public:
|
|||
{
|
||||
if (!track_add_station_element({ mapLoc, baseZ, _origin.direction }, _rideIndex, 0, _fromTrackDesign))
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::UNKNOWN, gGameCommandErrorText);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::Unknown, gGameCommandErrorText);
|
||||
}
|
||||
}
|
||||
|
||||
// 6c5648 12 push
|
||||
auto surfaceElement = map_get_surface_element_at(mapLoc);
|
||||
if (surfaceElement == nullptr)
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::Unknown, STR_NONE);
|
||||
|
||||
if (!gCheatsDisableSupportLimits)
|
||||
{
|
||||
|
@ -395,7 +404,8 @@ public:
|
|||
ride_height /= COORDS_Z_PER_TINY_Z;
|
||||
if (ride_height > maxHeight && !byte_9D8150)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::DISALLOWED, STR_TOO_HIGH_FOR_SUPPORTS);
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_TOO_HIGH_FOR_SUPPORTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,20 +427,20 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride subtype for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex));
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
auto res = std::make_unique<TrackPlaceActionResult>();
|
||||
|
@ -488,7 +498,7 @@ public:
|
|||
&cost, crossingMode))
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::NO_CLEARANCE, gGameCommandErrorText, gCommonFormatArgs);
|
||||
GameActions::Status::NoClearance, gGameCommandErrorText, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsDisableClearanceChecks)
|
||||
|
@ -518,7 +528,7 @@ public:
|
|||
if (res->GroundFlags != 0 && (res->GroundFlags & mapGroundFlags) == 0)
|
||||
{
|
||||
return std::make_unique<TrackPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
|
||||
GameActions::Status::Disallowed, STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
|
||||
}
|
||||
|
||||
res->GroundFlags = mapGroundFlags;
|
||||
|
@ -526,7 +536,7 @@ public:
|
|||
// 6c5648 12 push
|
||||
auto surfaceElement = map_get_surface_element_at(mapLoc);
|
||||
if (surfaceElement == nullptr)
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::Unknown, STR_NONE);
|
||||
|
||||
int32_t supportHeight = baseZ - surfaceElement->GetBaseZ();
|
||||
if (supportHeight < 0)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(TrackRemoveAction, GAME_COMMAND_REMOVE_TRACK, GameActionResult)
|
||||
DEFINE_GAME_ACTION(TrackRemoveAction, GAME_COMMAND_REMOVE_TRACK, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
int32_t _trackType{};
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
stream << DS_TAG(_trackType) << DS_TAG(_sequence) << DS_TAG(_origin);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Position.x = _origin.x + 16;
|
||||
|
@ -118,13 +118,14 @@ public:
|
|||
log_warning(
|
||||
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z,
|
||||
_origin.direction, _sequence);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
if (tileElement->AsTrack()->IsIndestructible())
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_YOU_ARE_NOT_ALLOWED_TO_REMOVE_THIS_SECTION);
|
||||
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS,
|
||||
STR_YOU_ARE_NOT_ALLOWED_TO_REMOVE_THIS_SECTION);
|
||||
}
|
||||
|
||||
ride_id_t rideIndex = tileElement->AsTrack()->GetRideIndex();
|
||||
|
@ -134,7 +135,7 @@ public:
|
|||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Ride not found. ride index = %d.", rideIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, trackType);
|
||||
trackBlock += tileElement->AsTrack()->GetSequenceIndex();
|
||||
|
@ -160,7 +161,8 @@ public:
|
|||
|
||||
if (!LocationValid(mapLoc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(
|
||||
GameActions::Status::NotOwned, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
map_invalidate_tile_full(mapLoc);
|
||||
|
||||
|
@ -198,7 +200,7 @@ public:
|
|||
log_warning(
|
||||
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z,
|
||||
_origin.direction, trackBlock->index);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
int32_t entranceDirections;
|
||||
|
@ -215,7 +217,8 @@ public:
|
|||
{
|
||||
if (!track_remove_station_element({ mapLoc, _origin.direction }, rideIndex, 0))
|
||||
{
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, gGameCommandErrorText);
|
||||
return MakeResult(
|
||||
GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, gGameCommandErrorText);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +226,7 @@ public:
|
|||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
int8_t _support_height = tileElement->base_height - surfaceElement->base_height;
|
||||
|
@ -255,7 +258,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Position.x = _origin.x + 16;
|
||||
|
@ -318,7 +321,7 @@ public:
|
|||
log_warning(
|
||||
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z,
|
||||
_origin.direction, _sequence);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
ride_id_t rideIndex = tileElement->AsTrack()->GetRideIndex();
|
||||
|
@ -329,7 +332,7 @@ public:
|
|||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Ride not found. ride index = %d.", rideIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, trackType);
|
||||
trackBlock += tileElement->AsTrack()->GetSequenceIndex();
|
||||
|
@ -388,7 +391,7 @@ public:
|
|||
log_warning(
|
||||
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z,
|
||||
_origin.direction, trackBlock->index);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
int32_t entranceDirections;
|
||||
|
@ -405,7 +408,8 @@ public:
|
|||
{
|
||||
if (!track_remove_station_element({ mapLoc, _origin.direction }, rideIndex, 0))
|
||||
{
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, gGameCommandErrorText);
|
||||
return MakeResult(
|
||||
GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, gGameCommandErrorText);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,7 +417,7 @@ public:
|
|||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
int8_t _support_height = tileElement->base_height - surfaceElement->base_height;
|
||||
|
@ -428,7 +432,8 @@ public:
|
|||
{
|
||||
if (!track_remove_station_element({ mapLoc, _origin.direction }, rideIndex, GAME_COMMAND_FLAG_APPLY))
|
||||
{
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, gGameCommandErrorText);
|
||||
return MakeResult(
|
||||
GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, gGameCommandErrorText);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../management/Finance.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(TrackSetBrakeSpeedAction, GAME_COMMAND_SET_BRAKES_SPEED, GameActionResult)
|
||||
DEFINE_GAME_ACTION(TrackSetBrakeSpeedAction, GAME_COMMAND_SET_BRAKES_SPEED, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -46,18 +46,18 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_trackType) << DS_TAG(_brakeSpeed);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
|
||||
|
@ -68,14 +68,14 @@ private:
|
|||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_NONE);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_NONE);
|
||||
}
|
||||
|
||||
TileElement* tileElement = map_get_track_element_at_of_type(_loc, _trackType);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for setting brakes speed. x = %d, y = %d", _loc.x, _loc.y);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
||||
if (isExecuting)
|
||||
|
|
|
@ -24,26 +24,26 @@
|
|||
#include "../world/Wall.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
class WallPlaceActionResult final : public GameActionResult
|
||||
class WallPlaceActionResult final : public GameActions::Result
|
||||
{
|
||||
public:
|
||||
WallPlaceActionResult()
|
||||
: GameActionResult(GA_ERROR::OK, STR_CANT_BUILD_PARK_ENTRANCE_HERE)
|
||||
: GameActions::Result(GameActions::Status::Ok, STR_CANT_BUILD_PARK_ENTRANCE_HERE)
|
||||
{
|
||||
}
|
||||
|
||||
WallPlaceActionResult(GA_ERROR err)
|
||||
: GameActionResult(err, STR_CANT_BUILD_PARK_ENTRANCE_HERE)
|
||||
WallPlaceActionResult(GameActions::Status err)
|
||||
: GameActions::Result(err, STR_CANT_BUILD_PARK_ENTRANCE_HERE)
|
||||
{
|
||||
}
|
||||
|
||||
WallPlaceActionResult(GA_ERROR err, rct_string_id msg)
|
||||
: GameActionResult(err, STR_CANT_BUILD_PARK_ENTRANCE_HERE, msg)
|
||||
WallPlaceActionResult(GameActions::Status err, rct_string_id msg)
|
||||
: GameActions::Result(err, STR_CANT_BUILD_PARK_ENTRANCE_HERE, msg)
|
||||
{
|
||||
}
|
||||
|
||||
WallPlaceActionResult(GA_ERROR error, rct_string_id msg, uint8_t* args)
|
||||
: GameActionResult(error, STR_CANT_BUILD_PARK_ENTRANCE_HERE, msg, args)
|
||||
WallPlaceActionResult(GameActions::Status error, rct_string_id msg, uint8_t* args)
|
||||
: GameActions::Result(error, STR_CANT_BUILD_PARK_ENTRANCE_HERE, msg, args)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
<< DS_TAG(_tertiaryColour) << DS_TAG(_bannerId);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = std::make_unique<WallPlaceActionResult>();
|
||||
res->ErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE;
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED);
|
||||
return MakeResult(GameActions::Status::NotOwned);
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_PATH_SCENERY)
|
||||
|
@ -141,23 +141,23 @@ public:
|
|||
{
|
||||
if (!map_is_location_in_park(_loc))
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::NOT_OWNED);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::NotOwned);
|
||||
}
|
||||
}
|
||||
else if (!map_is_location_owned(_loc))
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::NOT_OWNED);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::NotOwned);
|
||||
}
|
||||
}
|
||||
else if (!byte_9D8150 && (_loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY))
|
||||
{
|
||||
log_error("Invalid x/y coordinates. x = %d y = %d", _loc.x, _loc.y);
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
if (_edge > 3)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
uint8_t edgeSlope = 0;
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_error("Surface element not found at %d, %d.", _loc.x, _loc.y);
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
targetHeight = surfaceElement->GetBaseZ();
|
||||
|
||||
|
@ -185,7 +185,7 @@ public:
|
|||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_error("Surface element not found at %d, %d.", _loc.x, _loc.y);
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
if (surfaceElement->GetWaterHeight() > 0)
|
||||
|
@ -194,13 +194,14 @@ public:
|
|||
|
||||
if (targetHeight < waterHeight && !gCheatsDisableClearanceChecks)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_UNDERWATER);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetHeight < surfaceElement->GetBaseZ() && !gCheatsDisableClearanceChecks)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
|
||||
if (!(edgeSlope & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS)))
|
||||
|
@ -212,7 +213,8 @@ public:
|
|||
{
|
||||
if (targetHeight / 8 < newBaseHeight)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
|
@ -228,7 +230,7 @@ public:
|
|||
if (targetHeight / 8 < newBaseHeight)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
newBaseHeight -= 2;
|
||||
}
|
||||
|
@ -241,7 +243,8 @@ public:
|
|||
{
|
||||
if (targetHeight / 8 < newBaseHeight)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
|
@ -257,7 +260,7 @@ public:
|
|||
if (targetHeight / 8 < newBaseHeight)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
GameActions::Status::Disallowed, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +273,7 @@ public:
|
|||
if (wallEntry == nullptr)
|
||||
{
|
||||
log_error("Wall Type not found %d", _wallType);
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
if (wallEntry->wall.scrolling_mode != SCROLLING_MODE_NONE)
|
||||
|
@ -278,14 +281,15 @@ public:
|
|||
if (_bannerId == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Banner Index not specified.");
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GameActions::Status::InvalidParameters, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
}
|
||||
|
||||
auto banner = GetBanner(_bannerId);
|
||||
if (!banner->IsNull())
|
||||
{
|
||||
log_error("No free banners available");
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::NoFreeElements);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +298,8 @@ public:
|
|||
{
|
||||
if (wallEntry->wall.flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE)
|
||||
{
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::DISALLOWED, STR_ERR_UNABLE_TO_BUILD_THIS_ON_SLOPE);
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GameActions::Status::Disallowed, STR_ERR_UNABLE_TO_BUILD_THIS_ON_SLOPE);
|
||||
}
|
||||
clearanceHeight += 2;
|
||||
}
|
||||
|
@ -304,7 +309,7 @@ public:
|
|||
if (!(GetFlags() & GAME_COMMAND_FLAG_PATH_SCENERY) && !gCheatsDisableClearanceChecks)
|
||||
{
|
||||
auto result = WallCheckObstruction(wallEntry, targetHeight / 8, clearanceHeight, &wallAcrossTrack);
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
@ -312,14 +317,14 @@ public:
|
|||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TILE_ELEMENT_LIMIT_REACHED);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_TILE_ELEMENT_LIMIT_REACHED);
|
||||
}
|
||||
|
||||
res->Cost = wallEntry->wall.price;
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = std::make_unique<WallPlaceActionResult>();
|
||||
res->ErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE;
|
||||
|
@ -342,7 +347,7 @@ public:
|
|||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_error("Surface element not found at %d, %d.", _loc.x, _loc.y);
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
targetHeight = surfaceElement->GetBaseZ();
|
||||
|
||||
|
@ -361,7 +366,7 @@ public:
|
|||
if (wallEntry == nullptr)
|
||||
{
|
||||
log_error("Wall Type not found %d", _wallType);
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::InvalidParameters);
|
||||
}
|
||||
|
||||
uint8_t clearanceHeight = targetHeight / COORDS_Z_STEP;
|
||||
|
@ -375,7 +380,7 @@ public:
|
|||
if (!(GetFlags() & GAME_COMMAND_FLAG_PATH_SCENERY) && !gCheatsDisableClearanceChecks)
|
||||
{
|
||||
auto result = WallCheckObstruction(wallEntry, targetHeight / COORDS_Z_STEP, clearanceHeight, &wallAcrossTrack);
|
||||
if (result->Error != GA_ERROR::OK)
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
@ -383,7 +388,7 @@ public:
|
|||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TILE_ELEMENT_LIMIT_REACHED);
|
||||
return MakeResult(GameActions::Status::NoFreeElements, STR_TILE_ELEMENT_LIMIT_REACHED);
|
||||
}
|
||||
|
||||
if (wallEntry->wall.scrolling_mode != SCROLLING_MODE_NONE)
|
||||
|
@ -391,14 +396,15 @@ public:
|
|||
if (_bannerId == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Banner Index not specified.");
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
return std::make_unique<WallPlaceActionResult>(
|
||||
GameActions::Status::InvalidParameters, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
}
|
||||
|
||||
auto banner = GetBanner(_bannerId);
|
||||
if (!banner->IsNull())
|
||||
{
|
||||
log_error("No free banners available");
|
||||
return std::make_unique<WallPlaceActionResult>(GA_ERROR::NO_FREE_ELEMENTS);
|
||||
return std::make_unique<WallPlaceActionResult>(GameActions::Status::NoFreeElements);
|
||||
}
|
||||
|
||||
banner->text = {};
|
||||
|
@ -556,7 +562,7 @@ private:
|
|||
*
|
||||
* rct2: 0x006E5C1A
|
||||
*/
|
||||
GameActionResult::Ptr WallCheckObstruction(rct_scenery_entry * wall, int32_t z0, int32_t z1, bool* wallAcrossTrack) const
|
||||
GameActions::Result::Ptr WallCheckObstruction(rct_scenery_entry * wall, int32_t z0, int32_t z1, bool* wallAcrossTrack) const
|
||||
{
|
||||
int32_t entryType, sequence;
|
||||
rct_scenery_entry* entry;
|
||||
|
@ -566,7 +572,7 @@ private:
|
|||
gMapGroundFlags = ELEMENT_IS_ABOVE_GROUND;
|
||||
if (map_is_location_at_edge(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_OFF_EDGE_OF_MAP);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
TileElement* tileElement = map_get_first_element_at(_loc);
|
||||
|
@ -588,7 +594,7 @@ private:
|
|||
int32_t direction = tileElement->GetDirection();
|
||||
if (_edge == direction)
|
||||
{
|
||||
auto res = MakeResult(GA_ERROR::NO_CLEARANCE, STR_NONE);
|
||||
auto res = MakeResult(GameActions::Status::NoClearance, STR_NONE);
|
||||
map_obstruction_set_error_text(tileElement, *res);
|
||||
return res;
|
||||
}
|
||||
|
@ -596,7 +602,7 @@ private:
|
|||
}
|
||||
if (tileElement->GetOccupiedQuadrants() == 0)
|
||||
continue;
|
||||
auto res = MakeResult(GA_ERROR::NO_CLEARANCE, STR_NONE);
|
||||
auto res = MakeResult(GameActions::Status::NoClearance, STR_NONE);
|
||||
switch (elementType)
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_ENTRANCE:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "../world/Wall.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WallRemoveAction, GAME_COMMAND_REMOVE_WALL, GameActionResult)
|
||||
DEFINE_GAME_ACTION(WallRemoveAction, GAME_COMMAND_REMOVE_WALL, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -43,38 +43,39 @@ public:
|
|||
stream << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
|
||||
if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(_loc))
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
TileElement* wallElement = GetFirstWallElementAt(_loc, isGhost);
|
||||
if (wallElement == nullptr)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
res->Cost = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
GameActions::Result::Ptr res = std::make_unique<GameActions::Result>();
|
||||
res->Cost = 0;
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
||||
|
@ -83,8 +84,8 @@ public:
|
|||
TileElement* wallElement = GetFirstWallElementAt(_loc, isGhost);
|
||||
if (wallElement == nullptr)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(
|
||||
GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
}
|
||||
|
||||
res->Position.x = _loc.x + 16;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WallSetColourAction, GAME_COMMAND_SET_WALL_COLOUR, GameActionResult)
|
||||
DEFINE_GAME_ACTION(WallSetColourAction, GAME_COMMAND_SET_WALL_COLOUR, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
stream << DS_TAG(_loc) << DS_TAG(_primaryColour) << DS_TAG(_secondaryColour) << DS_TAG(_tertiaryColour);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->ErrorTitle = STR_CANT_REPAINT_THIS;
|
||||
|
@ -64,12 +64,12 @@ public:
|
|||
|
||||
if (!LocationValid(_loc))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_in_park(_loc) && !gCheatsSandboxMode)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
auto wallElement = map_get_wall_element_at(_loc);
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
log_error(
|
||||
"Could not find wall element at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z,
|
||||
_loc.direction);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(wallElement->IsGhost()))
|
||||
|
@ -90,19 +90,19 @@ public:
|
|||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
log_error("Could not find wall object");
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (_primaryColour > 31)
|
||||
{
|
||||
log_error("Primary colour invalid: colour = %d", _primaryColour);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (_secondaryColour > 31)
|
||||
{
|
||||
log_error("Secondary colour invalid: colour = %d", _secondaryColour);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
|
||||
|
@ -110,13 +110,13 @@ public:
|
|||
if (_tertiaryColour > 31)
|
||||
{
|
||||
log_error("Tertiary colour invalid: colour = %d", _tertiaryColour);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->ErrorTitle = STR_CANT_REPAINT_THIS;
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
log_error(
|
||||
"Could not find wall element at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z,
|
||||
_loc.direction);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(wallElement->IsGhost()))
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
log_error("Could not find wall object");
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_REPAINT_THIS);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
|
||||
}
|
||||
|
||||
wallElement->SetPrimaryColour(_primaryColour);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "GameAction.h"
|
||||
#include "WaterSetHeightAction.hpp"
|
||||
|
||||
DEFINE_GAME_ACTION(WaterLowerAction, GAME_COMMAND_LOWER_WATER, GameActionResult)
|
||||
DEFINE_GAME_ACTION(WaterLowerAction, GAME_COMMAND_LOWER_WATER, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
@ -36,18 +36,18 @@ public:
|
|||
stream << DS_TAG(_range);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
|
||||
|
@ -105,7 +105,7 @@ private:
|
|||
waterSetHeightAction.SetFlags(GetFlags());
|
||||
auto result = isExecuting ? GameActions::ExecuteNested(&waterSetHeightAction)
|
||||
: GameActions::QueryNested(&waterSetHeightAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
res->Cost += result->Cost;
|
||||
hasChanged = true;
|
||||
|
@ -120,8 +120,8 @@ private:
|
|||
|
||||
if (!withinOwnership)
|
||||
{
|
||||
GameActionResult::Ptr ownerShipResult = std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
ownerShipResult->ErrorTitle = STR_CANT_LOWER_WATER_LEVEL_HERE;
|
||||
return ownerShipResult;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "GameAction.h"
|
||||
#include "WaterSetHeightAction.hpp"
|
||||
|
||||
DEFINE_GAME_ACTION(WaterRaiseAction, GAME_COMMAND_RAISE_WATER, GameActionResult)
|
||||
DEFINE_GAME_ACTION(WaterRaiseAction, GAME_COMMAND_RAISE_WATER, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
MapRange _range;
|
||||
|
@ -37,18 +37,18 @@ public:
|
|||
stream << DS_TAG(_range);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
return QueryExecute(false);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
return QueryExecute(true);
|
||||
}
|
||||
|
||||
private:
|
||||
GameActionResult::Ptr QueryExecute(bool isExecuting) const
|
||||
GameActions::Result::Ptr QueryExecute(bool isExecuting) const
|
||||
{
|
||||
auto res = MakeResult();
|
||||
|
||||
|
@ -113,7 +113,7 @@ private:
|
|||
waterSetHeightAction.SetFlags(GetFlags());
|
||||
auto result = isExecuting ? GameActions::ExecuteNested(&waterSetHeightAction)
|
||||
: GameActions::QueryNested(&waterSetHeightAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
res->Cost += result->Cost;
|
||||
hasChanged = true;
|
||||
|
@ -128,8 +128,8 @@ private:
|
|||
|
||||
if (!withinOwnership)
|
||||
{
|
||||
GameActionResult::Ptr ownerShipResult = std::make_unique<GameActionResult>(
|
||||
GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
ownerShipResult->ErrorTitle = STR_CANT_RAISE_WATER_LEVEL_HERE;
|
||||
return ownerShipResult;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "../world/Surface.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(WaterSetHeightAction, GAME_COMMAND_SET_WATER_HEIGHT, GameActionResult)
|
||||
DEFINE_GAME_ACTION(WaterSetHeightAction, GAME_COMMAND_SET_WATER_HEIGHT, GameActions::Result)
|
||||
{
|
||||
private:
|
||||
CoordsXY _coords;
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
stream << DS_TAG(_coords) << DS_TAG(_height);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
GameActions::Result::Ptr Query() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
@ -50,25 +50,25 @@ public:
|
|||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode
|
||||
&& gParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_NONE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_NONE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
|
||||
}
|
||||
|
||||
rct_string_id errorMsg = CheckParameters();
|
||||
if (errorMsg != STR_NONE)
|
||||
{
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE, errorMsg);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, errorMsg);
|
||||
}
|
||||
|
||||
if (!LocationValid(_coords))
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_OWNED, STR_NONE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::NotOwned, STR_NONE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
if (!map_is_location_in_park(_coords))
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_NONE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_NONE, STR_LAND_NOT_OWNED_BY_PARK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y);
|
||||
return MakeResult(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return MakeResult(GameActions::Status::Unknown, STR_NONE);
|
||||
}
|
||||
|
||||
int32_t zHigh = surfaceElement->GetBaseZ();
|
||||
|
@ -92,14 +92,14 @@ public:
|
|||
zLow = temp;
|
||||
}
|
||||
|
||||
if (auto res2 = MapCanConstructAt({ _coords, zLow, zHigh }, { 0b1111, 0b1111 }); res2->Error != GA_ERROR::OK)
|
||||
if (auto res2 = MapCanConstructAt({ _coords, zLow, zHigh }, { 0b1111, 0b1111 }); res2->Error != GameActions::Status::Ok)
|
||||
{
|
||||
return MakeResult(
|
||||
GA_ERROR::NO_CLEARANCE, STR_NONE, res2->ErrorMessage.GetStringId(), res2->ErrorMessageArgs.data());
|
||||
GameActions::Status::NoClearance, STR_NONE, res2->ErrorMessage.GetStringId(), res2->ErrorMessageArgs.data());
|
||||
}
|
||||
if (surfaceElement->HasTrackThatNeedsWater())
|
||||
{
|
||||
return MakeResult(GA_ERROR::DISALLOWED, STR_NONE);
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_NONE);
|
||||
}
|
||||
|
||||
res->Cost = 250;
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
GameActions::Result::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->Expenditure = ExpenditureType::Landscaping;
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
if (surfaceElement == nullptr)
|
||||
{
|
||||
log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
|
||||
}
|
||||
|
||||
if (_height > surfaceElement->base_height)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue