mirror of https://github.com/OpenRCT2/OpenRCT2.git
Return a full error message when the object cannot be found
This commit is contained in:
parent
0519dec33a
commit
2779e82ced
|
@ -99,7 +99,8 @@ GameActions::Result BannerPlaceAction::Query() const
|
||||||
if (bannerEntry == nullptr)
|
if (bannerEntry == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType);
|
LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType);
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
res.Cost = bannerEntry->price;
|
res.Cost = bannerEntry->price;
|
||||||
|
|
||||||
|
@ -126,7 +127,8 @@ GameActions::Result BannerPlaceAction::Execute() const
|
||||||
if (bannerEntry == nullptr)
|
if (bannerEntry == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType);
|
LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType);
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto banner = CreateBanner();
|
auto banner = CreateBanner();
|
||||||
|
|
|
@ -97,7 +97,8 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const
|
||||||
auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry<PathAdditionEntry>(_entryIndex);
|
auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry<PathAdditionEntry>(_entryIndex);
|
||||||
if (pathAdditionEntry == nullptr)
|
if (pathAdditionEntry == nullptr)
|
||||||
{
|
{
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
uint16_t sceneryFlags = pathAdditionEntry->flags;
|
uint16_t sceneryFlags = pathAdditionEntry->flags;
|
||||||
|
|
||||||
|
@ -164,7 +165,8 @@ GameActions::Result FootpathAdditionPlaceAction::Execute() const
|
||||||
auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry<PathAdditionEntry>(_entryIndex);
|
auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry<PathAdditionEntry>(_entryIndex);
|
||||||
if (pathAdditionEntry == nullptr)
|
if (pathAdditionEntry == nullptr)
|
||||||
{
|
{
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Cost = pathAdditionEntry->price;
|
res.Cost = pathAdditionEntry->price;
|
||||||
|
|
|
@ -85,7 +85,8 @@ GameActions::Result LargeSceneryPlaceAction::Query() const
|
||||||
if (sceneryEntry == nullptr)
|
if (sceneryEntry == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
|
LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t totalNumTiles = GetTotalNumTiles(sceneryEntry->tiles);
|
uint32_t totalNumTiles = GetTotalNumTiles(sceneryEntry->tiles);
|
||||||
|
@ -197,7 +198,8 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const
|
||||||
if (sceneryEntry == nullptr)
|
if (sceneryEntry == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
|
LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sceneryEntry->tiles == nullptr)
|
if (sceneryEntry->tiles == nullptr)
|
||||||
|
|
|
@ -72,7 +72,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const
|
||||||
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
|
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
|
||||||
// If we have a bugged scenery entry, do not touch the tile element.
|
// If we have a bugged scenery entry, do not touch the tile element.
|
||||||
if (sceneryEntry == nullptr)
|
if (sceneryEntry == nullptr)
|
||||||
return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS, STR_NONE);
|
return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
|
|
||||||
auto rotatedOffsets = CoordsXYZ{
|
auto rotatedOffsets = CoordsXYZ{
|
||||||
CoordsXY{ sceneryEntry->tiles[_tileIndex].x_offset, sceneryEntry->tiles[_tileIndex].y_offset }.Rotate(_loc.direction),
|
CoordsXY{ sceneryEntry->tiles[_tileIndex].x_offset, sceneryEntry->tiles[_tileIndex].y_offset }.Rotate(_loc.direction),
|
||||||
|
|
|
@ -100,7 +100,8 @@ GameActions::Result RideCreateAction::Query() const
|
||||||
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
|
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
|
||||||
if (rideEntry == nullptr)
|
if (rideEntry == nullptr)
|
||||||
{
|
{
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto* presetList = rideEntry->vehicle_preset_list;
|
const auto* presetList = rideEntry->vehicle_preset_list;
|
||||||
|
|
|
@ -116,7 +116,8 @@ GameActions::Result SmallSceneryPlaceAction::Query() const
|
||||||
auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry<SmallSceneryEntry>(_sceneryType);
|
auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry<SmallSceneryEntry>(_sceneryType);
|
||||||
if (sceneryEntry == nullptr)
|
if (sceneryEntry == nullptr)
|
||||||
{
|
{
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto quadrant = _quadrant;
|
auto quadrant = _quadrant;
|
||||||
|
@ -308,7 +309,8 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const
|
||||||
auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry<SmallSceneryEntry>(_sceneryType);
|
auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry<SmallSceneryEntry>(_sceneryType);
|
||||||
if (sceneryEntry == nullptr)
|
if (sceneryEntry == nullptr)
|
||||||
{
|
{
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto quadrant = _quadrant;
|
auto quadrant = _quadrant;
|
||||||
|
|
|
@ -56,7 +56,8 @@ GameActions::Result SurfaceSetStyleAction::Query() const
|
||||||
if (surfaceObj == nullptr)
|
if (surfaceObj == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid surface style.");
|
LOG_ERROR("Invalid surface style.");
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +68,8 @@ GameActions::Result SurfaceSetStyleAction::Query() const
|
||||||
if (edgeObj == nullptr)
|
if (edgeObj == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid edge style.");
|
LOG_ERROR("Invalid edge style.");
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
|
return GameActions::Result(
|
||||||
|
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ GameActions::Result TrackPlaceAction::Query() const
|
||||||
{
|
{
|
||||||
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());
|
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());
|
||||||
return GameActions::Result(
|
return GameActions::Result(
|
||||||
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
|
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DirectionValid(_origin.direction))
|
if (!DirectionValid(_origin.direction))
|
||||||
|
@ -422,7 +422,7 @@ GameActions::Result TrackPlaceAction::Execute() const
|
||||||
{
|
{
|
||||||
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());
|
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());
|
||||||
return GameActions::Result(
|
return GameActions::Result(
|
||||||
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
|
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto res = GameActions::Result();
|
auto res = GameActions::Result();
|
||||||
|
|
|
@ -222,7 +222,7 @@ GameActions::Result WallPlaceAction::Query() const
|
||||||
if (wallEntry == nullptr)
|
if (wallEntry == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Wall Type not found %d", _wallType);
|
LOG_ERROR("Wall Type not found %d", _wallType);
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE);
|
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wallEntry->scrolling_mode != SCROLLING_MODE_NONE)
|
if (wallEntry->scrolling_mode != SCROLLING_MODE_NONE)
|
||||||
|
@ -312,7 +312,7 @@ GameActions::Result WallPlaceAction::Execute() const
|
||||||
if (wallEntry == nullptr)
|
if (wallEntry == nullptr)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Wall Type not found %d", _wallType);
|
LOG_ERROR("Wall Type not found %d", _wallType);
|
||||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE);
|
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_UNKNOWN_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t clearanceHeight = targetHeight / COORDS_Z_STEP;
|
uint8_t clearanceHeight = targetHeight / COORDS_Z_STEP;
|
||||||
|
|
Loading…
Reference in New Issue