From b1b5fa9c5a71c401f8ace470d17ac3682999adfc Mon Sep 17 00:00:00 2001 From: "Jacob W. Breen" Date: Thu, 9 Feb 2017 13:54:03 -0500 Subject: [PATCH] Fix #4972: Map window not updated properly when shrinking map... --- contributors.md | 1 + src/openrct2/interface/window.h | 1 + src/openrct2/windows/map.c | 14 ++++++++++++++ src/openrct2/world/map.c | 2 ++ 4 files changed, 18 insertions(+) diff --git a/contributors.md b/contributors.md index ae46cdaed2..e452d68b66 100644 --- a/contributors.md +++ b/contributors.md @@ -72,6 +72,7 @@ Includes all git commit authors. Aliases are GitHub user names. * Sven Slootweg (joepie91) * Daniel Trujillo Viedma (gDanix) * Jonathan Haas (HaasJona) +* Jake Breen (Haekb) ## Toolchain * (Balletie) - macOS diff --git a/src/openrct2/interface/window.h b/src/openrct2/interface/window.h index 178cd72a12..116b98bdaa 100644 --- a/src/openrct2/interface/window.h +++ b/src/openrct2/interface/window.h @@ -740,6 +740,7 @@ void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id ); void window_new_ride_init_vars(); void window_new_ride_focus(ride_list_item rideItem); +void window_map_reset(); void window_map_tooltip_update_visibility(); void window_staff_list_init_vars(); diff --git a/src/openrct2/windows/map.c b/src/openrct2/windows/map.c index 82cb9de23e..68b6853559 100644 --- a/src/openrct2/windows/map.c +++ b/src/openrct2/windows/map.c @@ -252,6 +252,20 @@ void window_map_open() gLandToolSize = 1; } +void window_map_reset() +{ + rct_window *w; + + // Check if window is even opened + w = window_bring_to_front_by_class(WC_MAP); + if (w == NULL) { + return; + } + + window_map_init_map(); + window_map_center_on_view_point(); +} + /** * * rct2: 0x0068D0F1 diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index fa16198f8d..30dd4dfefb 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -398,6 +398,8 @@ void map_init(sint32 size) gMapBaseZ = 7; map_update_tile_pointers(); map_remove_out_of_range_elements(); + + window_map_reset(); } /**