mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 07:14:31 +01:00
Fix supports error appearing when building outside of owned land
This was caused by ride_construction_toolupdate_construct() pointlessly trying to fix the "building outside owned land" error by increasing the Z.
This commit is contained in:
@@ -3985,6 +3985,43 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
|
||||
|
||||
money32 cost = 0;
|
||||
const rct_preview_track *trackBlock = get_track_def_from_ride(ride, type);
|
||||
|
||||
// First check if any of the track pieces are outside the park
|
||||
for (; trackBlock->index != 0xFF; trackBlock++) {
|
||||
int x, y, z, offsetX, offsetY;
|
||||
|
||||
switch (direction) {
|
||||
case 0:
|
||||
offsetX = trackBlock->x;
|
||||
offsetY = trackBlock->y;
|
||||
break;
|
||||
case 1:
|
||||
offsetX = trackBlock->y;
|
||||
offsetY = -trackBlock->x;
|
||||
break;
|
||||
case 2:
|
||||
offsetX = -trackBlock->x;
|
||||
offsetY = -trackBlock->y;
|
||||
break;
|
||||
case 3:
|
||||
offsetX = -trackBlock->y;
|
||||
offsetY = trackBlock->x;
|
||||
break;
|
||||
}
|
||||
|
||||
x = originX + offsetX;
|
||||
y = originY + offsetY;
|
||||
z = originZ + trackBlock->z;
|
||||
|
||||
if (!map_is_location_owned(x, y, z) && !gCheatsSandboxMode) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_LAND_NOT_OWNED_BY_PARK;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
// If that is not the case, then perform the remaining checks
|
||||
trackBlock = get_track_def_from_ride(ride, type);
|
||||
|
||||
for (; trackBlock->index != 0xFF; trackBlock++, RCT2_GLOBAL(0x00F44054, uint8*)++) {
|
||||
int x, y, z, offsetX, offsetY;
|
||||
int bl = trackBlock->var_08;
|
||||
@@ -4093,10 +4130,6 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
|
||||
}
|
||||
}
|
||||
|
||||
if (!map_is_location_owned(x, y, z) && !gCheatsSandboxMode) {
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
bh = RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & 3;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_ABOVE_GROUND_FLAGS, uint8) != 0 && (RCT2_GLOBAL(RCT2_ADDRESS_ABOVE_GROUND_FLAGS, uint8) & bh) == 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND;
|
||||
|
||||
Reference in New Issue
Block a user