Recalculating the fences when resizing the map

This commit is contained in:
Hielke Morsink 2016-04-04 09:08:55 +02:00 committed by Gymnasiast
parent ed9334f944
commit 15727b68a9
2 changed files with 7 additions and 4 deletions

View File

@ -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();
}

View File

@ -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;
}
}
}