From 40cc3324fadce60522e97791604ae3a6643f4c2e Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 23 Feb 2011 20:45:52 +0000 Subject: [PATCH] (svn r22134) -Codechange: Move ReInit() of the landinfo window from DeleteNewGRFInspectWindow() into a InvalidateData call. --- src/misc_gui.cpp | 10 ++++++++++ src/newgrf_debug_gui.cpp | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index a24b9cf759..9e770cb41c 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -330,6 +330,16 @@ public: { ::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile); } + + virtual void OnInvalidateData(int data) + { + switch (data) { + case 1: + /* ReInit, "debug" sprite might have changed */ + this->ReInit(); + break; + } + } }; /** diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index f4c3b985a6..99512515fe 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -519,8 +519,7 @@ void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index) DeleteWindowById(WC_NEWGRF_INSPECT, wno); /* Reinitialise the land information window to remove the "debug" sprite if needed. */ - Window *w = FindWindowById(WC_LAND_INFO, 0); - if (w != NULL) w->ReInit(); + InvalidateWindowData(WC_LAND_INFO, 0, 1); } /**