diff --git a/src/main_gui.cpp b/src/main_gui.cpp --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -166,9 +166,8 @@ bool DoZoomInOutWindow(int how, Window * vp->virtual_left = w->viewport->scrollpos_x; vp->virtual_top = w->viewport->scrollpos_y; } - w->SetDirty(); /* Update the windows that have zoom-buttons to perhaps disable their buttons */ - InvalidateThisWindowData(w); + w->InvalidateData(); return true; } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -344,7 +344,7 @@ public: this->sel = NULL; this->sel_pos = -1; } - InvalidateThisWindowData(this, 1); + this->InvalidateData(1); break; } @@ -379,7 +379,7 @@ public: case ANGRFW_RESCAN: // Rescan list ScanNewGRFFiles(); - InvalidateThisWindowData(this, 0); + this->InvalidateData(); break; } } @@ -437,8 +437,7 @@ public: this->sel = this->grfs[this->sel_pos]; this->ScrollToSelected(); - - InvalidateThisWindowData(this, 1); + this->InvalidateData(1); } return ES_HANDLED; @@ -448,7 +447,7 @@ public: { this->grfs.SetFilterState(!StrEmpty(this->edit_str_buf)); this->grfs.ForceRebuild(); - InvalidateThisWindowData(this, 1); + this->InvalidateData(1); } }; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -663,7 +663,7 @@ static inline void ChangeVehicleWindow(W if (w != NULL) { w->window_number = to_index; if (w->viewport != NULL) w->viewport->follow_vehicle = to_index; - if (to_index != INVALID_VEHICLE) InvalidateThisWindowData(w, 0); + if (to_index != INVALID_VEHICLE) w->InvalidateData(); } } diff --git a/src/window.cpp b/src/window.cpp --- a/src/window.cpp +++ b/src/window.cpp @@ -2477,17 +2477,6 @@ void SetWindowClassesDirty(WindowClass c } /** - * Mark window data as invalid (in need of re-computing) - * @param w Window with invalid data - * @param data The data to invalidate with - */ -void InvalidateThisWindowData(Window *w, int data) -{ - w->OnInvalidateData(data); - w->SetDirty(); -} - -/** * Mark window data of the window of a given class and specific window number as invalid (in need of re-computing) * @param cls Window class * @param number Window number within the class @@ -2497,7 +2486,7 @@ void InvalidateWindowData(WindowClass cl { Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { - if (w->window_class == cls && w->window_number == number) InvalidateThisWindowData(w, data); + if (w->window_class == cls && w->window_number == number) w->InvalidateData(data); } } @@ -2511,7 +2500,7 @@ void InvalidateWindowClassesData(WindowC Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { - if (w->window_class == cls) InvalidateThisWindowData(w, data); + if (w->window_class == cls) w->InvalidateData(data); } } diff --git a/src/window_func.h b/src/window_func.h --- a/src/window_func.h +++ b/src/window_func.h @@ -27,7 +27,6 @@ void ResetWindowSystem(); void SetupColoursAndInitialWindow(); void InputLoop(); -void InvalidateThisWindowData(Window *w, int data = 0); void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0); void InvalidateWindowClassesData(WindowClass cls, int data = 0); diff --git a/src/window_gui.h b/src/window_gui.h --- a/src/window_gui.h +++ b/src/window_gui.h @@ -634,6 +634,16 @@ public: void SetDirty() const; void ReInit(); + /** + * Mark this window's data as invalid (in need of re-computing) + * @param data The data to invalidate with + */ + void InvalidateData(int data = 0) + { + this->SetDirty(); + this->OnInvalidateData(data); + } + /*** Event handling ***/ /**