diff --git a/src/openrct2/world/entrance.cpp b/src/openrct2/world/entrance.cpp index 4360fb2c7a..99fb6390a2 100644 --- a/src/openrct2/world/entrance.cpp +++ b/src/openrct2/world/entrance.cpp @@ -148,11 +148,7 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, uint8 z, uint footpath_connect_edges(x, y, newElement, 1); } - update_park_fences(x, y); - update_park_fences(x - 32, y); - update_park_fences(x + 32, y); - update_park_fences(x, y - 32); - update_park_fences(x, y + 32); + update_park_fences_around_tile(x, y); map_invalidate_tile(x, y, newElement->base_height * 8, newElement->clearance_height * 8); diff --git a/src/openrct2/world/park.c b/src/openrct2/world/park.c index a0bf6c646b..7cbfd8c0e5 100644 --- a/src/openrct2/world/park.c +++ b/src/openrct2/world/park.c @@ -774,6 +774,15 @@ void update_park_fences(sint32 x, sint32 y) } } +void update_park_fences_around_tile(sint32 x, sint32 y) +{ + update_park_fences(x, y); + update_park_fences(x + 32, y); + update_park_fences(x - 32, y); + update_park_fences(x, y + 32); + update_park_fences(x, y - 32); +} + void park_set_name(const char *name) { gGameCommandErrorTitle = STR_CANT_RENAME_PARK; @@ -860,21 +869,13 @@ static money32 map_buy_land_rights_for_tile(sint32 x, sint32 y, sint32 setting, } if (flags & GAME_COMMAND_FLAG_APPLY) { surfaceElement->properties.surface.ownership |= OWNERSHIP_OWNED; - update_park_fences(x, y); - update_park_fences(x - 32, y); - update_park_fences(x + 32, y); - update_park_fences(x, y + 32); - update_park_fences(x, y - 32); + update_park_fences_around_tile(x, y); } return gLandPrice; case 1: if (flags & GAME_COMMAND_FLAG_APPLY) { surfaceElement->properties.surface.ownership &= ~(OWNERSHIP_OWNED | OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED); - update_park_fences(x, y); - update_park_fences(x - 32, y); - update_park_fences(x + 32, y); - update_park_fences(x, y + 32); - update_park_fences(x, y - 32); + update_park_fences_around_tile(x, y); } return 0; case 2: @@ -958,11 +959,7 @@ static money32 map_buy_land_rights_for_tile(sint32 x, sint32 y, sint32 setting, } surfaceElement->properties.surface.ownership &= 0x0F; surfaceElement->properties.surface.ownership |= newOwnership; - update_park_fences(x, y); - update_park_fences(x - 32, y); - update_park_fences(x + 32, y); - update_park_fences(x, y + 32); - update_park_fences(x, y - 32); + update_park_fences_around_tile(x, y); gUnk9E2E28 |= 1; return 0; } diff --git a/src/openrct2/world/park.h b/src/openrct2/world/park.h index 5c44a89847..273ea4ccbc 100644 --- a/src/openrct2/world/park.h +++ b/src/openrct2/world/park.h @@ -83,6 +83,7 @@ rct_peep * park_generate_new_guest(); void park_update(); void park_update_histories(); void update_park_fences(sint32 x, sint32 y); +void update_park_fences_around_tile(sint32 x, sint32 y); uint8 calculate_guest_initial_happiness(uint8 percentage);