mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-09-01 19:09:09 +00:00
Codechange: Make SetDisplayedPlane return whether the plane changed or not.
This commit is contained in:
@@ -1492,10 +1492,13 @@ NWidgetCore *NWidgetStacked::GetWidgetFromPos(int x, int y)
|
|||||||
/**
|
/**
|
||||||
* Select which plane to show (for #NWID_SELECTION only).
|
* Select which plane to show (for #NWID_SELECTION only).
|
||||||
* @param plane Plane number to display.
|
* @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;
|
this->shown_plane = plane;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NWidgetPIPContainer::NWidgetPIPContainer(WidgetType tp, NWidContainerFlags flags) : NWidgetContainer(tp)
|
NWidgetPIPContainer::NWidgetPIPContainer(WidgetType tp, NWidContainerFlags flags) : NWidgetContainer(tp)
|
||||||
|
@@ -461,7 +461,7 @@ public:
|
|||||||
void Draw(const Window *w) override;
|
void Draw(const Window *w) override;
|
||||||
NWidgetCore *GetWidgetFromPos(int x, int y) 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 shown_plane; ///< Plane being displayed (for #NWID_SELECTION only).
|
||||||
int index; ///< If non-negative, index in the #Window::nested_array.
|
int index; ///< If non-negative, index in the #Window::nested_array.
|
||||||
|
Reference in New Issue
Block a user