diff --git a/src/widget.cpp b/src/widget.cpp index 5c5f3929db..148bd8ddec 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1492,10 +1492,13 @@ NWidgetCore *NWidgetStacked::GetWidgetFromPos(int x, int y) /** * Select which plane to show (for #NWID_SELECTION only). * @param plane Plane number to display. + * @return true iff the shown plane changed. */ -void NWidgetStacked::SetDisplayedPlane(int plane) +bool NWidgetStacked::SetDisplayedPlane(int plane) { + if (this->shown_plane == plane) return false; this->shown_plane = plane; + return true; } NWidgetPIPContainer::NWidgetPIPContainer(WidgetType tp, NWidContainerFlags flags) : NWidgetContainer(tp) diff --git a/src/widget_type.h b/src/widget_type.h index b1f8cde029..8ec91855c6 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -461,7 +461,7 @@ public: void Draw(const Window *w) override; NWidgetCore *GetWidgetFromPos(int x, int y) override; - void SetDisplayedPlane(int plane); + bool SetDisplayedPlane(int plane); int shown_plane; ///< Plane being displayed (for #NWID_SELECTION only). int index; ///< If non-negative, index in the #Window::nested_array.