diff options
-rw-r--r-- | functions.h | 1 | ||||
-rw-r--r-- | main_gui.c | 9 | ||||
-rw-r--r-- | window.c | 12 |
3 files changed, 19 insertions, 3 deletions
diff --git a/functions.h b/functions.h index 6ddcf05ba..b3e99906f 100644 --- a/functions.h +++ b/functions.h @@ -201,6 +201,7 @@ void InvalidateWindow(byte cls, WindowNumber number); void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index); void InvalidateWindowClasses(byte cls); void DeleteWindowById(WindowClass cls, WindowNumber number); +void DeleteWindowByClass(WindowClass cls); void SetObjectToPlaceWnd(int icon, byte mode, Window *w); void SetObjectToPlace(int icon, byte mode, WindowClass window_class, WindowNumber window_num); diff --git a/main_gui.c b/main_gui.c index 63937fe6a..023a645a3 100644 --- a/main_gui.c +++ b/main_gui.c @@ -1097,10 +1097,13 @@ static void AskResetLandscapeWndProc(Window *w, WindowEvent *e) break; case 4: DeleteWindow(w); - if(mode) { // reset landscape + DeleteWindowByClass(WC_INDUSTRY_VIEW); + DeleteWindowByClass(WC_TOWN_VIEW); + DeleteWindowByClass(WC_LAND_INFO); + + if (mode) { // reset landscape ResetLandscape(); - } - else { // make random landscape + } else { // make random landscape SndPlayFx(SND_15_BEEP); _switch_mode = SM_GENRANDLAND; } @@ -262,6 +262,18 @@ void DeleteWindowById(WindowClass cls, WindowNumber number) DeleteWindow(FindWindowById(cls, number)); } +void DeleteWindowByClass(WindowClass cls) +{ + Window *w; + for (w = _windows; w != _last_window;) { + if (w->window_class == cls) { + DeleteWindow(w); + w = _windows; + } else + w++; + } +} + Window *BringWindowToFrontById(WindowClass cls, WindowNumber number) { Window *w = FindWindowById(cls, number); |