Merge pull request #20303 from Gymnasiast/fix/20083

Fix #20083: Cannot use terrain surfaces with ID > 32
This commit is contained in:
Matthias Moninger 2023-05-31 17:16:07 +03:00 committed by GitHub
commit e6bee21682
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 29 additions and 29 deletions

View File

@ -6,6 +6,7 @@
- Change: [#20110] Fix a few RCT1 build height parity discrepancies.
- Fix: [#6152] Camera and UI are no longer locked at 40 Hz, providing a smoother experience.
- Fix: [#19823] Parkobj: disallow overriding objects of different object types.
- Fix: [#20083] Cannot use terrain surfaces with ID > 32 and terrain edges with ID > 16.
- Fix: [#20111] All coaster types can access the new diagonal slope pieces.
- Fix: [#20155] Fairground organ style 2 shows up as regular music, rather than for the merry-go-round.
- Fix: [#20260] Ride locks up when inspecting/fixing staff member is fired.

View File

@ -99,7 +99,8 @@ GameActions::Result BannerPlaceAction::Query() const
if (bannerEntry == nullptr)
{
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;
@ -126,7 +127,8 @@ GameActions::Result BannerPlaceAction::Execute() const
if (bannerEntry == nullptr)
{
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();

View File

@ -97,7 +97,8 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const
auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry<PathAdditionEntry>(_entryIndex);
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;
@ -164,7 +165,8 @@ GameActions::Result FootpathAdditionPlaceAction::Execute() const
auto* pathAdditionEntry = OpenRCT2::ObjectManager::GetObjectEntry<PathAdditionEntry>(_entryIndex);
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;

View File

@ -85,7 +85,8 @@ GameActions::Result LargeSceneryPlaceAction::Query() const
if (sceneryEntry == nullptr)
{
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);
@ -197,7 +198,8 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const
if (sceneryEntry == nullptr)
{
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)

View File

@ -72,7 +72,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
// If we have a bugged scenery entry, do not touch the tile element.
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{
CoordsXY{ sceneryEntry->tiles[_tileIndex].x_offset, sceneryEntry->tiles[_tileIndex].y_offset }.Rotate(_loc.direction),

View File

@ -100,7 +100,8 @@ GameActions::Result RideCreateAction::Query() const
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
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;

View File

@ -116,7 +116,8 @@ GameActions::Result SmallSceneryPlaceAction::Query() const
auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry<SmallSceneryEntry>(_sceneryType);
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;
@ -308,7 +309,8 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const
auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry<SmallSceneryEntry>(_sceneryType);
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;

View File

@ -50,36 +50,26 @@ GameActions::Result SurfaceSetStyleAction::Query() const
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
if (_surfaceStyle != OBJECT_ENTRY_INDEX_NULL)
{
if (_surfaceStyle > 0x1F)
{
LOG_ERROR("Invalid surface style.");
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
}
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
objManager.GetLoadedObject(ObjectType::TerrainSurface, _surfaceStyle));
if (surfaceObj == nullptr)
{
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);
}
}
if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL)
{
if (_edgeStyle > 0xF)
{
LOG_ERROR("Invalid edge style.");
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
}
const auto edgeObj = static_cast<TerrainEdgeObject*>(objManager.GetLoadedObject(ObjectType::TerrainEdge, _edgeStyle));
if (edgeObj == nullptr)
{
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);
}
}

View File

@ -79,7 +79,7 @@ GameActions::Result TrackPlaceAction::Query() const
{
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());
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))
@ -422,7 +422,7 @@ GameActions::Result TrackPlaceAction::Execute() const
{
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());
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();

View File

@ -222,7 +222,7 @@ GameActions::Result WallPlaceAction::Query() const
if (wallEntry == nullptr)
{
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)
@ -312,7 +312,7 @@ GameActions::Result WallPlaceAction::Execute() const
if (wallEntry == nullptr)
{
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;

View File

@ -43,7 +43,7 @@
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "5"
#define NETWORK_STREAM_VERSION "6"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION