Merge pull request #21244 from pfroud/add-error-strings

Add error strings to reduce how many `GameActions::Result`s have `STR_NONE, STR_NONE`
This commit is contained in:
Matt 2024-01-29 18:02:37 +02:00 committed by GitHub
commit fc1b580074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 196 additions and 94 deletions

View File

@ -3699,6 +3699,22 @@ STR_6593 :Remove park fences
STR_6594 :Tile Inspector: Toggle wall slope STR_6594 :Tile Inspector: Toggle wall slope
STR_6595 :{WINDOW_COLOUR_2}Author: {BLACK}{STRING} STR_6595 :{WINDOW_COLOUR_2}Author: {BLACK}{STRING}
STR_6596 :{WINDOW_COLOUR_2}Authors: {BLACK}{STRING} STR_6596 :{WINDOW_COLOUR_2}Authors: {BLACK}{STRING}
STR_6597 :Invalid parameter
STR_6598 :Value out of range
STR_6599 :Ghost element not found
STR_6600 :Balloon not found
STR_6601 :Staff not found
STR_6602 :Ride not found
STR_6603 :Ride object entry not found
STR_6604 :Player not found
STR_6605 :Entrance element not found
STR_6606 :Surface element not found
STR_6607 :Tile element not found
STR_6608 :Track element not found
STR_6609 :Track block not found
STR_6610 :Path element not found
STR_6611 :Wall element not found
STR_6612 :Banner element not found
############# #############
# Scenarios # # Scenarios #

View File

@ -40,7 +40,8 @@ GameActions::Result BalloonPressAction::Query() const
if (balloon == nullptr) if (balloon == nullptr)
{ {
LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); 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(); return GameActions::Result();
} }
@ -51,7 +52,8 @@ GameActions::Result BalloonPressAction::Execute() const
if (balloon == nullptr) if (balloon == nullptr)
{ {
LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); 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(); balloon->Press();

View File

@ -72,18 +72,21 @@ GameActions::Result CheatSetAction::Query() const
{ {
if (static_cast<uint32_t>(_cheatType) >= static_cast<uint32_t>(CheatType::Count)) if (static_cast<uint32_t>(_cheatType) >= static_cast<uint32_t>(CheatType::Count))
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
ParametersRange validRange = GetParameterRange(static_cast<CheatType>(_cheatType.id)); ParametersRange validRange = GetParameterRange(static_cast<CheatType>(_cheatType.id));
if (_param1 < validRange.first.first || _param1 > validRange.first.second) if (_param1 < validRange.first.first || _param1 > validRange.first.second)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
if (_param2 < validRange.second.first || _param2 > validRange.second.second) if (_param2 < validRange.second.first || _param2 > validRange.second.second)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();
@ -257,9 +260,9 @@ GameActions::Result CheatSetAction::Execute() const
default: default:
{ {
LOG_ERROR("Unabled cheat: %d", _cheatType.id); LOG_ERROR("Unabled cheat: %d", _cheatType.id);
GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
break;
} }
if (NetworkGetMode() == NETWORK_MODE_NONE) if (NetworkGetMode() == NETWORK_MODE_NONE)

View File

@ -40,7 +40,8 @@ GameActions::Result GameSetSpeedAction::Query() const
if (!IsValidSpeed(_speed)) if (!IsValidSpeed(_speed))
{ {
LOG_WARNING("Invalid game command for speed %u", _speed); LOG_WARNING("Invalid game command for speed %u", _speed);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return res; return res;
@ -53,7 +54,8 @@ GameActions::Result GameSetSpeedAction::Execute() const
if (!IsValidSpeed(_speed)) if (!IsValidSpeed(_speed))
{ {
LOG_WARNING("Invalid game command for speed %u", _speed); LOG_WARNING("Invalid game command for speed %u", _speed);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
gGameSpeed = _speed; gGameSpeed = _speed;

View File

@ -104,7 +104,8 @@ GameActions::Result LandSetHeightAction::Query() const
auto* surfaceElement = MapGetSurfaceElementAt(_coords); auto* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr) 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. // 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. // For that, we need the old height, so we can't use the _height variable.
@ -165,7 +166,8 @@ GameActions::Result LandSetHeightAction::Execute() const
auto* surfaceElement = MapGetSurfaceElementAt(_coords); auto* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr) 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); cost += GetSurfaceHeightChangeCost(surfaceElement);
SetSurfaceHeight(reinterpret_cast<TileElement*>(surfaceElement)); SetSurfaceHeight(reinterpret_cast<TileElement*>(surfaceElement));

View File

@ -116,7 +116,8 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY&
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
LOG_ERROR("Could not find surface. x = %d, y = %d", loc.x, loc.y); 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(); auto res = GameActions::Result();
@ -203,6 +204,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY&
} }
default: default:
LOG_WARNING("Tried calling set land rights with an incorrect setting. setting = %u", _setting); LOG_WARNING("Tried calling set land rights with an incorrect setting. setting = %u", _setting);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
} }

View File

@ -47,7 +47,8 @@ GameActions::Result ParkSetDateAction::Query() const
{ {
if (_year < 0 || _year >= MAX_YEAR || _month < 0 || _month >= MONTH_COUNT || _day < 0 || _day >= 31) if (_year < 0 || _year >= MAX_YEAR || _month < 0 || _month >= MONTH_COUNT || _day < 0 || _day >= 31)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();

View File

@ -50,7 +50,8 @@ GameActions::Result ParkSetEntranceFeeAction::Query() const
} }
if (_fee < 0.00_GBP || _fee > MAX_ENTRANCE_FEE) if (_fee < 0.00_GBP || _fee > MAX_ENTRANCE_FEE)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();
} }

View File

@ -44,7 +44,8 @@ GameActions::Result ParkSetParameterAction::Query() const
{ {
if (_parameter >= ParkParameter::Count) if (_parameter >= ParkParameter::Count)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
auto res = GameActions::Result(); auto res = GameActions::Result();
@ -76,7 +77,8 @@ GameActions::Result ParkSetParameterAction::Execute() const
WindowInvalidateByClass(WindowClass::Ride); WindowInvalidateByClass(WindowClass::Ride);
break; break;
default: default:
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
auto res = GameActions::Result(); auto res = GameActions::Result();

View File

@ -44,7 +44,8 @@ GameActions::Result ParkSetResearchFundingAction::Query() const
{ {
if (_fundingAmount >= RESEARCH_FUNDING_COUNT) if (_fundingAmount >= RESEARCH_FUNDING_COUNT)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();
} }

View File

@ -70,7 +70,7 @@ GameActions::Result RideEntranceExitRemoveAction::Query() const
if (ride == nullptr) if (ride == nullptr)
{ {
LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); 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) if (ride->status != RideStatus::Closed && ride->status != RideStatus::Simulating)
@ -94,14 +94,16 @@ 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 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())) 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_INVALID_PARAMETER, STR_ERR_GHOST_ELEMENT_NOT_FOUND);
} }
else if (entranceElement == nullptr) else if (entranceElement == nullptr)
{ {
LOG_WARNING( LOG_WARNING(
"Track Element not found. x = %d, y = %d, ride = %u, station = %u", _loc.x, _loc.y, _rideIndex.ToUnderlying(), "Entrance element not found. x = %d, y = %d, ride = %u, station = %u", _loc.x, _loc.y, _rideIndex.ToUnderlying(),
_stationNum.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(); return GameActions::Result();
@ -113,7 +115,7 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const
if (ride == nullptr) if (ride == nullptr)
{ {
LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); 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; const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
@ -130,14 +132,16 @@ 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 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())) if (entranceElement != nullptr && isGhost && !(entranceElement->IsGhost()))
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_GHOST_ELEMENT_NOT_FOUND);
} }
else if (entranceElement == nullptr) else if (entranceElement == nullptr)
{ {
LOG_WARNING( LOG_WARNING(
"Track Element not found. x = %d, y = %d, ride = %u, station = %d", _loc.x, _loc.y, _rideIndex.ToUnderlying(), "Entrance element not found. x = %d, y = %d, ride = %u, station = %d", _loc.x, _loc.y, _rideIndex.ToUnderlying(),
_stationNum); _stationNum);
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);
} }
auto res = GameActions::Result(); auto res = GameActions::Result();

View File

@ -35,13 +35,14 @@ GameActions::Result RideFreezeRatingAction::Query() const
if (ride == nullptr) if (ride == nullptr)
{ {
LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); 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) if (_value <= 0)
{ {
LOG_WARNING("Rating value must be positive", _rideIndex.ToUnderlying()); LOG_WARNING("Rating value must be positive", _rideIndex.ToUnderlying());
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();

View File

@ -54,7 +54,7 @@ GameActions::Result RideSetAppearanceAction::Query() const
if (ride == nullptr) if (ride == nullptr)
{ {
LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); 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) switch (_type)
@ -65,7 +65,8 @@ GameActions::Result RideSetAppearanceAction::Query() const
if (_index >= std::size(ride->track_colour)) if (_index >= std::size(ride->track_colour))
{ {
LOG_WARNING("Invalid game command, index %d out of bounds", _index); LOG_WARNING("Invalid game command, index %d out of bounds", _index);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
break; break;
case RideSetAppearanceType::VehicleColourBody: case RideSetAppearanceType::VehicleColourBody:
@ -74,7 +75,8 @@ GameActions::Result RideSetAppearanceAction::Query() const
if (_index >= std::size(ride->vehicle_colours)) if (_index >= std::size(ride->vehicle_colours))
{ {
LOG_WARNING("Invalid game command, index %d out of bounds", _index); LOG_WARNING("Invalid game command, index %d out of bounds", _index);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
break; break;
case RideSetAppearanceType::VehicleColourScheme: case RideSetAppearanceType::VehicleColourScheme:
@ -83,7 +85,8 @@ GameActions::Result RideSetAppearanceAction::Query() const
break; break;
default: default:
LOG_WARNING("Invalid game command, type %d not recognised", _type); LOG_WARNING("Invalid game command, type %d not recognised", _type);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();
@ -95,7 +98,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const
if (ride == nullptr) if (ride == nullptr)
{ {
LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); 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) switch (_type)

View File

@ -55,14 +55,15 @@ GameActions::Result RideSetPriceAction::Query() const
if (ride == nullptr) if (ride == nullptr)
{ {
LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); 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); const auto* rideEntry = GetRideEntryByIndex(ride->subtype);
if (rideEntry == nullptr) if (rideEntry == nullptr)
{ {
LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); 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; return res;
@ -77,14 +78,15 @@ GameActions::Result RideSetPriceAction::Execute() const
if (ride == nullptr) if (ride == nullptr)
{ {
LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); 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); const auto* rideEntry = GetRideEntryByIndex(ride->subtype);
if (rideEntry == nullptr) if (rideEntry == nullptr)
{ {
LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); 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()) if (!ride->overall_view.IsNull())

View File

@ -40,7 +40,8 @@ GameActions::Result ScenarioSetSettingAction::Query() const
if (_setting >= ScenarioSetSetting::Count) if (_setting >= ScenarioSetSetting::Count)
{ {
LOG_ERROR("Invalid setting: %u", _setting); LOG_ERROR("Invalid setting: %u", _setting);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();
@ -264,7 +265,8 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
} }
default: default:
LOG_ERROR("Invalid setting: %u", _setting); LOG_ERROR("Invalid setting: %u", _setting);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
WindowInvalidateByClass(WindowClass::EditorScenarioOptions); WindowInvalidateByClass(WindowClass::EditorScenarioOptions);
return GameActions::Result(); return GameActions::Result();

View File

@ -39,14 +39,15 @@ GameActions::Result StaffFireAction::Query() const
if (_spriteId.ToUnderlying() >= MAX_ENTITIES || _spriteId.IsNull()) if (_spriteId.ToUnderlying() >= MAX_ENTITIES || _spriteId.IsNull())
{ {
LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); 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_VALUE_OUT_OF_RANGE);
} }
auto staff = TryGetEntity<Staff>(_spriteId); auto staff = TryGetEntity<Staff>(_spriteId);
if (staff == nullptr) if (staff == nullptr)
{ {
LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); 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) if (staff->State == PeepState::Fixing)
@ -67,7 +68,7 @@ GameActions::Result StaffFireAction::Execute() const
if (staff == nullptr) if (staff == nullptr)
{ {
LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); 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); WindowCloseByClass(WindowClass::FirePrompt);
PeepEntityRemove(staff); PeepEntityRemove(staff);

View File

@ -64,21 +64,23 @@ GameActions::Result StaffSetCostumeAction::Query() const
{ {
if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) 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_VALUE_OUT_OF_RANGE);
} }
auto* staff = TryGetEntity<Staff>(_spriteIndex); auto* staff = TryGetEntity<Staff>(_spriteIndex);
if (staff == nullptr) if (staff == nullptr)
{ {
LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); 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); auto spriteType = EntertainerCostumeToSprite(_costume);
if (EnumValue(spriteType) > std::size(peep_slow_walking_types)) if (EnumValue(spriteType) > std::size(peep_slow_walking_types))
{ {
LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); 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_VALUE_OUT_OF_RANGE);
} }
return GameActions::Result(); return GameActions::Result();
} }
@ -89,7 +91,7 @@ GameActions::Result StaffSetCostumeAction::Execute() const
if (staff == nullptr) if (staff == nullptr)
{ {
LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); 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); auto spriteType = EntertainerCostumeToSprite(_costume);

View File

@ -45,7 +45,8 @@ GameActions::Result StaffSetOrdersAction::Query() const
{ {
if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull()) 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_VALUE_OUT_OF_RANGE);
} }
auto* staff = TryGetEntity<Staff>(_spriteIndex); auto* staff = TryGetEntity<Staff>(_spriteIndex);
@ -65,7 +66,7 @@ GameActions::Result StaffSetOrdersAction::Execute() const
if (staff == nullptr) if (staff == nullptr)
{ {
LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); 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; staff->StaffOrders = _ordersId;

View File

@ -61,7 +61,7 @@ GameActions::Result StaffSetPatrolAreaAction::QueryExecute(bool executing) const
if (staff == nullptr) if (staff == nullptr)
{ {
LOG_ERROR("Invalid entity ID: %u", _spriteId.ToUnderlying()); 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); auto validRange = ClampRangeWithinMap(_range);

View File

@ -231,7 +231,8 @@ GameActions::Result TileModifyAction::QueryExecute(bool isExecuting) const
} }
default: default:
LOG_ERROR("invalid instruction"); LOG_ERROR("invalid instruction");
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
res.Position.x = _loc.x; res.Position.x = _loc.x;

View File

@ -64,7 +64,8 @@ GameActions::Result TrackSetBrakeSpeedAction::QueryExecute(bool isExecuting) con
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
LOG_WARNING("Invalid game command for setting brakes speed. x = %d, y = %d", _loc.x, _loc.y); LOG_WARNING("Invalid game command for setting brakes speed. 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_TILE_ELEMENT_NOT_FOUND);
} }
if (isExecuting) if (isExecuting)

View File

@ -77,7 +77,8 @@ GameActions::Result WaterSetHeightAction::Query() const
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); 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(); int32_t zHigh = surfaceElement->GetBaseZ();
@ -122,7 +123,8 @@ GameActions::Result WaterSetHeightAction::Execute() const
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); 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) if (_height > surfaceElement->BaseHeight)

View File

@ -4007,6 +4007,23 @@ enum : uint16_t
STR_SCENERY_AUTHOR = 6595, STR_SCENERY_AUTHOR = 6595,
STR_SCENERY_AUTHOR_PLURAL = 6596, STR_SCENERY_AUTHOR_PLURAL = 6596,
STR_ERR_INVALID_PARAMETER = 6597,
STR_ERR_VALUE_OUT_OF_RANGE = 6598,
STR_ERR_GHOST_ELEMENT_NOT_FOUND = 6599,
STR_ERR_BALLOON_NOT_FOUND = 6600,
STR_ERR_STAFF_NOT_FOUND = 6601,
STR_ERR_RIDE_NOT_FOUND = 6602,
STR_ERR_RIDE_OBJECT_ENTRY_NOT_FOUND = 6603,
STR_ERR_PLAYER_NOT_FOUND = 6604,
STR_ERR_ENTRANCE_ELEMENT_NOT_FOUND = 6605,
STR_ERR_SURFACE_ELEMENT_NOT_FOUND = 6606,
STR_ERR_TILE_ELEMENT_NOT_FOUND = 6607,
STR_ERR_TRACK_ELEMENT_NOT_FOUND = 6608,
STR_ERR_TRACK_BLOCK_NOT_FOUND = 6609,
STR_ERR_PATH_ELEMENT_NOT_FOUND = 6610,
STR_ERR_WALL_ELEMENT_NOT_FOUND = 6611,
STR_ERR_BANNER_ELEMENT_NOT_FOUND = 6612,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
}; };

View File

@ -3705,7 +3705,8 @@ GameActions::Result NetworkModifyGroups(
break; break;
default: default:
LOG_ERROR("Invalid Modify Group Type: %u", static_cast<uint8_t>(type)); LOG_ERROR("Invalid Modify Group Type: %u", static_cast<uint8_t>(type));
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
} }
network.SaveGroups(); network.SaveGroups();
@ -3721,7 +3722,7 @@ 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 // Player might be already removed by the PLAYERLIST command, need to refactor non-game commands executing too
// early. // 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) if (player->Flags & NETWORK_PLAYER_FLAG_ISSERVER)

View File

@ -1371,7 +1371,8 @@ static std::optional<GameActions::Result> TrackDesignPlaceEntrances(
TileElement* tile_element = MapGetFirstElementAt(tile); TileElement* tile_element = MapGetFirstElementAt(tile);
if (tile_element == nullptr) 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 do
@ -1683,7 +1684,9 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
auto surfaceElement = MapGetSurfaceElementAt(tile); auto surfaceElement = MapGetSurfaceElementAt(tile);
if (surfaceElement == nullptr) 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(); int32_t surfaceZ = surfaceElement->GetBaseZ();

View File

@ -139,7 +139,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) 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) if (isExecuting)
{ {
@ -202,7 +203,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) 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) if (isExecuting)
{ {
@ -280,7 +282,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) 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) if (!isExecuting)
{ {
@ -365,7 +368,8 @@ namespace OpenRCT2::TileInspector
{ {
const TileElement* const firstElement = MapGetFirstElementAt(loc); const TileElement* const firstElement = MapGetFirstElementAt(loc);
if (firstElement == nullptr) 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 // Count elements on tile
int32_t numElement = 0; int32_t numElement = 0;
@ -440,7 +444,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) 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); auto heightValidationResult = ValidateTileHeight(tileElement, heightOffset);
if (heightValidationResult.Error != GameActions::Status::Ok) if (heightValidationResult.Error != GameActions::Status::Ok)
@ -485,7 +490,8 @@ namespace OpenRCT2::TileInspector
// No surface element on tile // No surface element on tile
if (surfaceelement == nullptr) 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) if (isExecuting)
{ {
@ -504,7 +510,8 @@ namespace OpenRCT2::TileInspector
// No surface element on tile // No surface element on tile
if (surfaceElement == nullptr) 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) if (isExecuting)
{ {
@ -550,7 +557,8 @@ namespace OpenRCT2::TileInspector
// No surface element on tile // No surface element on tile
if (surfaceElement == nullptr) 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) if (isExecuting)
{ {
@ -565,7 +573,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) 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) if (isExecuting)
{ {
@ -580,7 +589,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) 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) if (isExecuting)
{ {
@ -594,7 +604,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) 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) if (isExecuting)
{ {
@ -608,7 +619,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex); TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) 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) if (isExecuting)
{ {
@ -623,11 +635,13 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const entranceElement = MapGetNthElementAt(loc, elementIndex); TileElement* const entranceElement = MapGetNthElementAt(loc, elementIndex);
if (entranceElement == nullptr || entranceElement->GetType() != TileElementType::Entrance) 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()); auto ride = GetRide(entranceElement->AsEntrance()->GetRideIndex());
if (ride == nullptr) 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) if (isExecuting)
{ {
@ -652,7 +666,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex); TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex);
if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall) 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) if (isExecuting)
{ {
@ -668,7 +683,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex); TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex);
if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall) 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) if (isExecuting)
{ {
@ -688,7 +704,8 @@ namespace OpenRCT2::TileInspector
TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) 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) if (isExecuting)
{ {
@ -700,12 +717,14 @@ namespace OpenRCT2::TileInspector
auto rideIndex = trackElement->AsTrack()->GetRideIndex(); auto rideIndex = trackElement->AsTrack()->GetRideIndex();
auto ride = GetRide(rideIndex); auto ride = GetRide(rideIndex);
if (ride == nullptr) 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& ted = GetTrackElementDescriptor(type);
const auto* trackBlock = ted.GetBlockForSequence(trackElement->AsTrack()->GetSequenceIndex()); const auto* trackBlock = ted.GetBlockForSequence(trackElement->AsTrack()->GetSequenceIndex());
if (trackBlock == nullptr) 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(); uint8_t originDirection = trackElement->GetDirection();
CoordsXY offsets = { trackBlock->x, trackBlock->y }; CoordsXY offsets = { trackBlock->x, trackBlock->y };
@ -724,11 +743,12 @@ namespace OpenRCT2::TileInspector
offsets.y = trackBlock->y; offsets.y = trackBlock->y;
elem += offsets.Rotate(originDirection); elem += offsets.Rotate(originDirection);
TrackElement* tileElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); TrackElement* nextTrackElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index);
if (tileElement == nullptr) if (nextTrackElement == nullptr)
{ {
LOG_ERROR("Track map element part not found!"); 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 // 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? // Keep?
// invalidate_test_results(ride); // invalidate_test_results(ride);
tileElement->BaseHeight += offset; nextTrackElement->BaseHeight += offset;
tileElement->ClearanceHeight += offset; nextTrackElement->ClearanceHeight += offset;
} }
} }
@ -754,7 +774,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) 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) if (isExecuting)
{ {
@ -777,12 +798,14 @@ namespace OpenRCT2::TileInspector
auto rideIndex = trackElement->AsTrack()->GetRideIndex(); auto rideIndex = trackElement->AsTrack()->GetRideIndex();
auto ride = GetRide(rideIndex); auto ride = GetRide(rideIndex);
if (ride == nullptr) 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& ted = GetTrackElementDescriptor(type);
auto trackBlock = ted.GetBlockForSequence(trackElement->AsTrack()->GetSequenceIndex()); auto trackBlock = ted.GetBlockForSequence(trackElement->AsTrack()->GetSequenceIndex());
if (trackBlock == nullptr) 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(); uint8_t originDirection = trackElement->GetDirection();
CoordsXY offsets = { trackBlock->x, trackBlock->y }; CoordsXY offsets = { trackBlock->x, trackBlock->y };
@ -801,11 +824,12 @@ namespace OpenRCT2::TileInspector
offsets.y = trackBlock->y; offsets.y = trackBlock->y;
elem += offsets.Rotate(originDirection); elem += offsets.Rotate(originDirection);
TrackElement* tileElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); TrackElement* nextTrackElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index);
if (tileElement == nullptr) if (nextTrackElement == nullptr)
{ {
LOG_ERROR("Track map element part not found!"); 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 // 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? // Keep?
// invalidate_test_results(ride); // invalidate_test_results(ride);
if (tileElement->AsTrack()->HasChain() != setChain) if (nextTrackElement->AsTrack()->HasChain() != setChain)
{ {
tileElement->AsTrack()->SetHasChain(setChain); nextTrackElement->AsTrack()->SetHasChain(setChain);
} }
} }
} }
@ -829,7 +853,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) 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) if (isExecuting)
{ {
@ -844,7 +869,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) 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) if (isExecuting)
{ {
@ -859,7 +885,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery) 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) if (isExecuting)
{ {
@ -878,7 +905,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery) 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) if (isExecuting)
{ {
@ -894,7 +922,8 @@ namespace OpenRCT2::TileInspector
{ {
TileElement* const bannerElement = MapGetNthElementAt(loc, elementIndex); TileElement* const bannerElement = MapGetNthElementAt(loc, elementIndex);
if (bannerElement == nullptr || bannerElement->GetType() != TileElementType::Banner) 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) if (isExecuting)
{ {