diff --git a/src/openrct2/actions/BalloonPressAction.cpp b/src/openrct2/actions/BalloonPressAction.cpp index 2887d852e9..91517fed4d 100644 --- a/src/openrct2/actions/BalloonPressAction.cpp +++ b/src/openrct2/actions/BalloonPressAction.cpp @@ -40,7 +40,8 @@ GameActions::Result BalloonPressAction::Query() const if (balloon == nullptr) { LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND); } return GameActions::Result(); } @@ -51,7 +52,8 @@ GameActions::Result BalloonPressAction::Execute() const if (balloon == nullptr) { LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_BALLOON_NOT_FOUND); } balloon->Press(); diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index ba21e618b4..848fba6068 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -102,7 +102,8 @@ GameActions::Result LandSetHeightAction::Query() const auto* surfaceElement = MapGetSurfaceElementAt(_coords); if (surfaceElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); // 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. @@ -163,7 +164,8 @@ GameActions::Result LandSetHeightAction::Execute() const auto* surfaceElement = MapGetSurfaceElementAt(_coords); if (surfaceElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); cost += GetSurfaceHeightChangeCost(surfaceElement); SetSurfaceHeight(reinterpret_cast(surfaceElement)); diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index 8379ca5e55..167876f4cc 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -116,7 +116,8 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& if (surfaceElement == nullptr) { LOG_ERROR("Could not find surface. x = %d, y = %d", loc.x, loc.y); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } auto res = GameActions::Result(); diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp index 4720b94cfc..3522c5a3df 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp @@ -70,7 +70,8 @@ GameActions::Result RideEntranceExitRemoveAction::Query() const if (ride == nullptr) { LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } if (ride->status != RideStatus::Closed && ride->status != RideStatus::Simulating) @@ -94,14 +95,15 @@ GameActions::Result RideEntranceExitRemoveAction::Query() const // If we are trying to remove a ghost and the element we found is real, return an error, but don't log a warning if (entranceElement != nullptr && (GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(entranceElement->IsGhost())) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_GHOST_NOT_FOUND, STR_NONE); } else if (entranceElement == nullptr) { LOG_WARNING( - "Track Element not found. x = %d, y = %d, ride = %u, station = %u", _loc.x, _loc.y, _rideIndex.ToUnderlying(), + "Entrance not found. x = %d, y = %d, ride = %u, station = %u", _loc.x, _loc.y, _rideIndex.ToUnderlying(), _stationNum.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_ENTRANCE_ELEMENT_NOT_FOUND); } return GameActions::Result(); @@ -113,7 +115,8 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const if (ride == nullptr) { LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST; @@ -130,14 +133,15 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const // If we are trying to remove a ghost and the element we found is real, return an error, but don't log a warning if (entranceElement != nullptr && isGhost && !(entranceElement->IsGhost())) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_GHOST_NOT_FOUND, STR_NONE); } else if (entranceElement == nullptr) { LOG_WARNING( - "Track Element not found. x = %d, y = %d, ride = %u, station = %d", _loc.x, _loc.y, _rideIndex.ToUnderlying(), - _stationNum); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + "Entrance not found. x = %d, y = %d, ride = %u, station = %d", + _loc.x, _loc.y, _rideIndex.ToUnderlying(), _stationNum); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_ENTRANCE_ELEMENT_NOT_FOUND); } auto res = GameActions::Result(); diff --git a/src/openrct2/actions/RideFreezeRatingAction.cpp b/src/openrct2/actions/RideFreezeRatingAction.cpp index 22e741b7c0..c0d9fbc790 100644 --- a/src/openrct2/actions/RideFreezeRatingAction.cpp +++ b/src/openrct2/actions/RideFreezeRatingAction.cpp @@ -35,7 +35,8 @@ GameActions::Result RideFreezeRatingAction::Query() const if (ride == nullptr) { LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } if (_value <= 0) diff --git a/src/openrct2/actions/RideSetAppearanceAction.cpp b/src/openrct2/actions/RideSetAppearanceAction.cpp index 4409158e11..667e8d629e 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.cpp +++ b/src/openrct2/actions/RideSetAppearanceAction.cpp @@ -54,7 +54,8 @@ GameActions::Result RideSetAppearanceAction::Query() const if (ride == nullptr) { LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } switch (_type) @@ -95,7 +96,8 @@ GameActions::Result RideSetAppearanceAction::Execute() const if (ride == nullptr) { LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } switch (_type) diff --git a/src/openrct2/actions/RideSetPriceAction.cpp b/src/openrct2/actions/RideSetPriceAction.cpp index a7bc361ff4..6e6eb6e774 100644 --- a/src/openrct2/actions/RideSetPriceAction.cpp +++ b/src/openrct2/actions/RideSetPriceAction.cpp @@ -55,14 +55,16 @@ GameActions::Result RideSetPriceAction::Query() const if (ride == nullptr) { LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } const auto* rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_OBJECT_ENTRY_NOT_FOUND); } return res; @@ -77,14 +79,16 @@ GameActions::Result RideSetPriceAction::Execute() const if (ride == nullptr) { LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); } const auto* rideEntry = GetRideEntryByIndex(ride->subtype); if (rideEntry == nullptr) { LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_OBJECT_ENTRY_NOT_FOUND); } if (!ride->overall_view.IsNull()) diff --git a/src/openrct2/actions/StaffFireAction.cpp b/src/openrct2/actions/StaffFireAction.cpp index 591cb658d0..7524c9c6e3 100644 --- a/src/openrct2/actions/StaffFireAction.cpp +++ b/src/openrct2/actions/StaffFireAction.cpp @@ -39,14 +39,16 @@ GameActions::Result StaffFireAction::Query() const if (_spriteId.ToUnderlying() >= MAX_ENTITIES || _spriteId.IsNull()) { LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } auto staff = TryGetEntity(_spriteId); if (staff == nullptr) { LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } if (staff->State == PeepState::Fixing) @@ -67,7 +69,8 @@ GameActions::Result StaffFireAction::Execute() const if (staff == nullptr) { LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } WindowCloseByClass(WindowClass::FirePrompt); PeepEntityRemove(staff); diff --git a/src/openrct2/actions/StaffSetCostumeAction.cpp b/src/openrct2/actions/StaffSetCostumeAction.cpp index 2fb0ca3509..b49b118a2b 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.cpp +++ b/src/openrct2/actions/StaffSetCostumeAction.cpp @@ -64,14 +64,16 @@ GameActions::Result StaffSetCostumeAction::Query() const { if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } auto* staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } auto spriteType = EntertainerCostumeToSprite(_costume); @@ -89,7 +91,8 @@ GameActions::Result StaffSetCostumeAction::Execute() const if (staff == nullptr) { LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } auto spriteType = EntertainerCostumeToSprite(_costume); diff --git a/src/openrct2/actions/StaffSetOrdersAction.cpp b/src/openrct2/actions/StaffSetOrdersAction.cpp index 9ff23b3bc5..f2c3f1fcf0 100644 --- a/src/openrct2/actions/StaffSetOrdersAction.cpp +++ b/src/openrct2/actions/StaffSetOrdersAction.cpp @@ -45,7 +45,8 @@ GameActions::Result StaffSetOrdersAction::Query() const { if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } auto* staff = TryGetEntity(_spriteIndex); @@ -65,7 +66,8 @@ GameActions::Result StaffSetOrdersAction::Execute() const if (staff == nullptr) { LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } staff->StaffOrders = _ordersId; diff --git a/src/openrct2/actions/StaffSetPatrolAreaAction.cpp b/src/openrct2/actions/StaffSetPatrolAreaAction.cpp index c2f75926f0..740d0a2ccd 100644 --- a/src/openrct2/actions/StaffSetPatrolAreaAction.cpp +++ b/src/openrct2/actions/StaffSetPatrolAreaAction.cpp @@ -61,7 +61,8 @@ GameActions::Result StaffSetPatrolAreaAction::QueryExecute(bool executing) const if (staff == nullptr) { LOG_ERROR("Invalid entity ID: %u", _spriteId.ToUnderlying()); - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } auto validRange = ClampRangeWithinMap(_range); diff --git a/src/openrct2/actions/WaterSetHeightAction.cpp b/src/openrct2/actions/WaterSetHeightAction.cpp index 804bc12e66..8e27d18b6b 100644 --- a/src/openrct2/actions/WaterSetHeightAction.cpp +++ b/src/openrct2/actions/WaterSetHeightAction.cpp @@ -74,7 +74,8 @@ GameActions::Result WaterSetHeightAction::Query() const if (surfaceElement == nullptr) { LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int32_t zHigh = surfaceElement->GetBaseZ(); @@ -119,7 +120,8 @@ GameActions::Result WaterSetHeightAction::Execute() const if (surfaceElement == nullptr) { LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } if (_height > surfaceElement->BaseHeight) diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index cda2c836a1..20805cceb0 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -3721,7 +3721,8 @@ GameActions::Result NetworkKickPlayer(NetworkPlayerId_t playerId, bool isExecuti { // Player might be already removed by the PLAYERLIST command, need to refactor non-game commands executing too // early. - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_PLAYER_NOT_FOUND); } if (player->Flags & NETWORK_PLAYER_FLAG_ISSERVER) diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 17ce50c916..5239bf2bde 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1370,7 +1370,8 @@ static std::optional TrackDesignPlaceEntrances( TileElement* tile_element = MapGetFirstElementAt(tile); if (tile_element == nullptr) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); } do @@ -1682,7 +1683,8 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi auto surfaceElement = MapGetSurfaceElementAt(tile); if (surfaceElement == nullptr) { - return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); } int32_t surfaceZ = surfaceElement->GetBaseZ(); diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 70bcb2c2bf..cddd0fe14a 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -139,7 +139,8 @@ namespace OpenRCT2::TileInspector { TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); if (tileElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -202,7 +203,8 @@ namespace OpenRCT2::TileInspector { TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); if (tileElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -280,7 +282,8 @@ namespace OpenRCT2::TileInspector { TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); if (tileElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); if (!isExecuting) { @@ -365,7 +368,8 @@ namespace OpenRCT2::TileInspector { const TileElement* const firstElement = MapGetFirstElementAt(loc); if (firstElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); // Count elements on tile int32_t numElement = 0; @@ -440,7 +444,8 @@ namespace OpenRCT2::TileInspector { TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); if (tileElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); auto heightValidationResult = ValidateTileHeight(tileElement, heightOffset); if (heightValidationResult.Error != GameActions::Status::Ok) @@ -485,7 +490,8 @@ namespace OpenRCT2::TileInspector // No surface element on tile if (surfaceelement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -504,7 +510,8 @@ namespace OpenRCT2::TileInspector // No surface element on tile if (surfaceElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -550,7 +557,8 @@ namespace OpenRCT2::TileInspector // No surface element on tile if (surfaceElement == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_SURFACE_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -565,7 +573,8 @@ namespace OpenRCT2::TileInspector { TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_PATH_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -580,7 +589,8 @@ namespace OpenRCT2::TileInspector { TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_PATH_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -594,7 +604,8 @@ namespace OpenRCT2::TileInspector { TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_PATH_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -608,7 +619,8 @@ namespace OpenRCT2::TileInspector { TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_PATH_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -623,11 +635,13 @@ namespace OpenRCT2::TileInspector { TileElement* const entranceElement = MapGetNthElementAt(loc, elementIndex); if (entranceElement == nullptr || entranceElement->GetType() != TileElementType::Entrance) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_ENTRANCE_ELEMENT_NOT_FOUND); auto ride = GetRide(entranceElement->AsEntrance()->GetRideIndex()); if (ride == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); if (isExecuting) { @@ -652,7 +666,8 @@ namespace OpenRCT2::TileInspector { TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex); if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_WALL_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -668,7 +683,8 @@ namespace OpenRCT2::TileInspector { TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex); if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_WALL_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -688,7 +704,8 @@ namespace OpenRCT2::TileInspector TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -700,12 +717,14 @@ namespace OpenRCT2::TileInspector auto rideIndex = trackElement->AsTrack()->GetRideIndex(); auto ride = GetRide(rideIndex); if (ride == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); const auto& ted = GetTrackElementDescriptor(type); const auto* trackBlock = ted.GetBlockForSequence(trackElement->AsTrack()->GetSequenceIndex()); if (trackBlock == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_BLOCK_NOT_FOUND); uint8_t originDirection = trackElement->GetDirection(); CoordsXY offsets = { trackBlock->x, trackBlock->y }; @@ -724,11 +743,12 @@ namespace OpenRCT2::TileInspector offsets.y = trackBlock->y; elem += offsets.Rotate(originDirection); - TrackElement* tileElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); - if (tileElement == nullptr) + TrackElement* trackElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); + if (trackElement == nullptr) { LOG_ERROR("Track map element part not found!"); - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_ELEMENT_NOT_FOUND); } // track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is @@ -738,8 +758,8 @@ namespace OpenRCT2::TileInspector // Keep? // invalidate_test_results(ride); - tileElement->BaseHeight += offset; - tileElement->ClearanceHeight += offset; + trackElement->BaseHeight += offset; + trackElement->ClearanceHeight += offset; } } @@ -754,7 +774,8 @@ namespace OpenRCT2::TileInspector { TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -777,12 +798,14 @@ namespace OpenRCT2::TileInspector auto rideIndex = trackElement->AsTrack()->GetRideIndex(); auto ride = GetRide(rideIndex); if (ride == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_RIDE_NOT_FOUND); const auto& ted = GetTrackElementDescriptor(type); auto trackBlock = ted.GetBlockForSequence(trackElement->AsTrack()->GetSequenceIndex()); if (trackBlock == nullptr) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_BLOCK_NOT_FOUND); uint8_t originDirection = trackElement->GetDirection(); CoordsXY offsets = { trackBlock->x, trackBlock->y }; @@ -801,11 +824,12 @@ namespace OpenRCT2::TileInspector offsets.y = trackBlock->y; elem += offsets.Rotate(originDirection); - TrackElement* tileElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); - if (tileElement == nullptr) + TrackElement* trackElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); + if (trackElement == nullptr) { LOG_ERROR("Track map element part not found!"); - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_ELEMENT_NOT_FOUND); } // track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is @@ -815,9 +839,9 @@ namespace OpenRCT2::TileInspector // Keep? // invalidate_test_results(ride); - if (tileElement->AsTrack()->HasChain() != setChain) + if (trackElement->AsTrack()->HasChain() != setChain) { - tileElement->AsTrack()->SetHasChain(setChain); + trackElement->AsTrack()->SetHasChain(setChain); } } } @@ -829,7 +853,8 @@ namespace OpenRCT2::TileInspector { TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -844,7 +869,8 @@ namespace OpenRCT2::TileInspector { TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TRACK_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -859,7 +885,8 @@ namespace OpenRCT2::TileInspector { TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -878,7 +905,8 @@ namespace OpenRCT2::TileInspector { TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND); if (isExecuting) { @@ -894,7 +922,8 @@ namespace OpenRCT2::TileInspector { TileElement* const bannerElement = MapGetNthElementAt(loc, elementIndex); if (bannerElement == nullptr || bannerElement->GetType() != TileElementType::Banner) - return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); + return GameActions::Result(GameActions::Status::InvalidParameters, + STR_ERR_INVALID_PARAMETER, STR_ERR_BANNER_ELEMENT_NOT_FOUND); if (isExecuting) {