1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Check for park entrances before placing to prevent ghosts

This commit is contained in:
duncanspumpkin
2016-09-26 18:51:31 +01:00
parent d6e13a38e1
commit 1e244a60db

View File

@@ -5122,6 +5122,23 @@ static money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint
}
}
// Check that entrance element does not already exist at this location
rct_map_element* entranceElement = map_get_first_element_at(x / 32, y / 32);
do {
if (map_element_get_type(entranceElement) != MAP_ELEMENT_TYPE_ENTRANCE)
continue;
if (entranceElement->base_height != zLow)
continue;
if (entranceElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE)
continue;
if (entranceElement->flags & MAP_ELEMENT_FLAG_GHOST)
continue;
return MONEY32_UNDEFINED;
} while (!map_element_is_last_for_tile(entranceElement++));
if (flags & GAME_COMMAND_FLAG_APPLY) {
if (!(flags & GAME_COMMAND_FLAG_GHOST)) {
@@ -5166,6 +5183,23 @@ static money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint
return MONEY32_UNDEFINED;
}
}
// Check that entrance element does not already exist at this location
entranceElement = map_get_first_element_at(x / 32, y / 32);
do {
if (map_element_get_type(entranceElement) != MAP_ELEMENT_TYPE_ENTRANCE)
continue;
if (entranceElement->base_height != zLow)
continue;
if (entranceElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE)
continue;
if (entranceElement->flags & MAP_ELEMENT_FLAG_GHOST)
continue;
return MONEY32_UNDEFINED;
} while (!map_element_is_last_for_tile(entranceElement++));
if (flags & GAME_COMMAND_FLAG_APPLY) {
@@ -5204,6 +5238,23 @@ static money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint
return MONEY32_UNDEFINED;
}
}
// Check that entrance element does not already exist at this location
entranceElement = map_get_first_element_at(x / 32, y / 32);
do {
if (map_element_get_type(entranceElement) != MAP_ELEMENT_TYPE_ENTRANCE)
continue;
if (entranceElement->base_height != zLow)
continue;
if (entranceElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE)
continue;
if (entranceElement->flags & MAP_ELEMENT_FLAG_GHOST)
continue;
return MONEY32_UNDEFINED;
} while (!map_element_is_last_for_tile(entranceElement++));
if (flags & GAME_COMMAND_FLAG_APPLY) {