From 15727b68a9b9ff1a68e1f5ebc504e299c58e76b4 Mon Sep 17 00:00:00 2001 From: Hielke Morsink <123mannetje@gmail.com> Date: Mon, 4 Apr 2016 09:08:55 +0200 Subject: [PATCH] Recalculating the fences when resizing the map --- src/windows/map.c | 6 ++++++ src/world/map.c | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/windows/map.c b/src/windows/map.c index 2f81c74f05..e8fb28dc31 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -1349,6 +1349,12 @@ static void map_window_increase_map_size() map_extend_boundary_surface(); window_map_init_map(); window_map_center_on_view_point(); + // Recalculate fences + for (int y = 0; y < RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16); y += 32) { + for (int x = 0; x < RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16); x += 32) { + update_park_fences(x, y); + } + } gfx_invalidate_screen(); } diff --git a/src/world/map.c b/src/world/map.c index 8265541ae4..5013ee1f55 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -4384,11 +4384,8 @@ void map_remove_out_of_range_elements() for (int y = 0; y < (256 * 32); y += 32) { for (int x = 0; x < (256 * 32); x += 32) { if (x == 0 || y == 0 || x >= mapMaxXY || y >= mapMaxXY) { + map_buy_land_rights(x, y, x, y, 1, GAME_COMMAND_FLAG_APPLY); clear_elements_at(x, y); - } else if (x >= mapMaxXY - 32 || y >= mapMaxXY - 32) { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) += 32; - map_buy_land_rights(x, y, x, y, 6, GAME_COMMAND_FLAG_APPLY); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) -= 32; } } }