1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Fix ghost scenery removing objects with "Disable Clearance check" enabled.

Fix footpath_remove ignoring the ghost flag removing the wrong path.
Replaced some constants with the known flags.
This commit is contained in:
ZehM4tt
2017-06-24 00:52:26 +02:00
committed by Michael Steenbeek
parent 27f5773e4d
commit 0a633647e4
4 changed files with 41 additions and 16 deletions

View File

@@ -55,7 +55,7 @@ extern "C" {
// This define specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "21"
#define NETWORK_STREAM_VERSION "22"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
#ifdef __cplusplus

View File

@@ -1397,7 +1397,7 @@ static money32 track_place(sint32 rideIndex, sint32 type, sint32 originX, sint32
mapElement = surfaceElement;
}
if (!gCheatsDisableClearanceChecks || !(flags & (1 << 6))) {
if (!gCheatsDisableClearanceChecks || !(flags & GAME_COMMAND_FLAG_GHOST)) {
footpath_connect_edges(x, y, mapElement, flags);
}
map_invalidate_tile_full(x, y);

View File

@@ -635,6 +635,11 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
}
}
sint32 z;
const uint32 flags = GAME_COMMAND_FLAG_APPLY |
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED |
GAME_COMMAND_FLAG_5 |
GAME_COMMAND_FLAG_GHOST;
switch (entry_type) {
case OBJECT_TYPE_SMALL_SCENERY:
//bl
@@ -654,11 +659,10 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
{
bh &= 0x3F;
}
z = (scenery->z * 8 + originZ) / 8;
game_do_command(
mapCoord.x,
0x69 | bh << 8,
flags | bh << 8,
mapCoord.y,
(entry_index << 8) | z,
GAME_COMMAND_REMOVE_SCENERY,
@@ -669,7 +673,7 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
z = (scenery->z * 8 + originZ) / 8;
game_do_command(
mapCoord.x,
0x69 | (((rotation + scenery->flags) & 0x3) << 8),
flags | (((rotation + scenery->flags) & 0x3) << 8),
mapCoord.y,
z,
GAME_COMMAND_REMOVE_LARGE_SCENERY,
@@ -680,7 +684,7 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
z = (scenery->z * 8 + originZ) / 8;
game_do_command(
mapCoord.x,
0x69,
flags,
mapCoord.y,
(z << 8) | ((rotation + scenery->flags) & 0x3),
GAME_COMMAND_REMOVE_WALL,
@@ -689,7 +693,11 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
break;
case OBJECT_TYPE_PATHS:
z = (scenery->z * 8 + originZ) / 8;
footpath_remove(mapCoord.x, mapCoord.y, z, 0x69);
footpath_remove(
mapCoord.x,
mapCoord.y,
z,
flags);
break;
}
}

View File

@@ -412,6 +412,7 @@ static void remove_banners_at_element(sint32 x, sint32 y, rct_map_element* mapEl
money32 footpath_remove_real(sint32 x, sint32 y, sint32 z, sint32 flags)
{
rct_map_element *mapElement;
rct_map_element *footpathElement = NULL;
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
gCommandPosition.x = x + 16;
@@ -423,7 +424,7 @@ money32 footpath_remove_real(sint32 x, sint32 y, sint32 z, sint32 flags)
return MONEY32_UNDEFINED;
}
if (flags & GAME_COMMAND_FLAG_APPLY) {
if ((flags & GAME_COMMAND_FLAG_APPLY) && !(flags & GAME_COMMAND_FLAG_GHOST)) {
footpath_interrupt_peeps(x, y, z * 8);
footpath_remove_litter(x, y, z * 8);
}
@@ -441,19 +442,35 @@ money32 footpath_remove_real(sint32 x, sint32 y, sint32 z, sint32 flags)
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
}
footpath_queue_chain_reset();
remove_banners_at_element(x, y, mapElement);
footpath_remove_edges_at(x, y, mapElement);
map_invalidate_tile_full(x, y);
map_element_remove(mapElement);
footpath_update_queue_chains();
// If the ghost flag is present we have to make sure to only delete ghost footpaths as they may be
// at the same origin.
if ((flags & GAME_COMMAND_FLAG_GHOST) && map_element_is_ghost(mapElement) == false) {
while (!map_element_is_last_for_tile(mapElement++)) {
if (mapElement->type != MAP_ELEMENT_TYPE_PATH && !map_element_is_ghost(mapElement)) {
continue;
}
footpathElement = mapElement;
break;
}
} else {
footpathElement = mapElement;
}
if (footpathElement != NULL) {
footpath_queue_chain_reset();
remove_banners_at_element(x, y, footpathElement);
footpath_remove_edges_at(x, y, footpathElement);
map_invalidate_tile_full(x, y);
map_element_remove(footpathElement);
footpath_update_queue_chains();
}
}
money32 cost = -MONEY(10,00);
bool isNotOwnedByPark = (flags & (1 << 5));
bool isNotOwnedByPark = (flags & GAME_COMMAND_FLAG_5);
bool moneyDisabled = (gParkFlags & PARK_FLAGS_NO_MONEY);
bool isGhost = (mapElement == NULL) || (map_element_is_ghost(mapElement));
bool isGhost = (footpathElement == NULL) || (map_element_is_ghost(footpathElement));
if (isNotOwnedByPark || moneyDisabled || isGhost) {
cost = 0;