mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use better location for the "invalid" action sentinel value
It used to be a random sentinel for end-of-(widget-)list that was used to tell that no action has taken place yet. Since the last action is practically the widget that was pressed, add the sentinel to that enumeration.pull/10807/merge
parent
09a7902d36
commit
3a2509198f
|
@ -87,7 +87,7 @@ struct BuildAirToolbarWindow : Window {
|
|||
this->InitNested(window_number);
|
||||
this->OnInvalidateData();
|
||||
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
||||
this->last_user_action = WIDGET_LIST_END;
|
||||
this->last_user_action = INVALID_WID_AT;
|
||||
}
|
||||
|
||||
void Close() override
|
||||
|
|
|
@ -414,7 +414,7 @@ struct BuildRailToolbarWindow : Window {
|
|||
this->InitNested(TRANSPORT_RAIL);
|
||||
this->SetupRailToolbar(railtype);
|
||||
this->DisableWidget(WID_RAT_REMOVE);
|
||||
this->last_user_action = WIDGET_LIST_END;
|
||||
this->last_user_action = INVALID_WID_RAT;
|
||||
|
||||
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ struct BuildRoadToolbarWindow : Window {
|
|||
}
|
||||
|
||||
this->OnInvalidateData();
|
||||
this->last_started_action = WIDGET_LIST_END;
|
||||
this->last_started_action = INVALID_WID_ROT;
|
||||
|
||||
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ struct TerraformToolbarWindow : Window {
|
|||
/* This is needed as we like to have the tree available on OnInit. */
|
||||
this->CreateNestedTree();
|
||||
this->FinishInitNested(window_number);
|
||||
this->last_user_action = WIDGET_LIST_END;
|
||||
this->last_user_action = INVALID_WID_TT;
|
||||
}
|
||||
|
||||
~TerraformToolbarWindow()
|
||||
|
@ -542,7 +542,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
|||
NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PLACE_DESERT);
|
||||
show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE);
|
||||
this->FinishInitNested(window_number);
|
||||
this->last_user_action = WIDGET_LIST_END;
|
||||
this->last_user_action = INVALID_WID_ETT;
|
||||
}
|
||||
|
||||
void OnPaint() override
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include "gfx_type.h"
|
||||
#include "window_type.h"
|
||||
|
||||
static const int WIDGET_LIST_END = -1; ///< indicate the end of widgets' list for vararg functions
|
||||
|
||||
/** Bits of the #WWT_MATRIX widget data. */
|
||||
enum MatrixWidgetValues {
|
||||
/* Number of column bits of the WWT_MATRIX widget data. */
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
enum AirportToolbarWidgets {
|
||||
WID_AT_AIRPORT, ///< Build airport button.
|
||||
WID_AT_DEMOLISH, ///< Demolish button.
|
||||
|
||||
INVALID_WID_AT = -1,
|
||||
};
|
||||
|
||||
/** Widgets of the #BuildAirportWindow class. */
|
||||
|
|
|
@ -28,6 +28,8 @@ enum RailToolbarWidgets {
|
|||
WID_RAT_BUILD_TUNNEL, ///< Build a tunnel.
|
||||
WID_RAT_REMOVE, ///< Bulldozer to remove rail.
|
||||
WID_RAT_CONVERT_RAIL, ///< Convert other rail to this type.
|
||||
|
||||
INVALID_WID_RAT = -1,
|
||||
};
|
||||
|
||||
/** Widgets of the #BuildRailStationWindow class. */
|
||||
|
|
|
@ -26,6 +26,8 @@ enum RoadToolbarWidgets {
|
|||
WID_ROT_BUILD_TUNNEL, ///< Build tunnel.
|
||||
WID_ROT_REMOVE, ///< Remove road.
|
||||
WID_ROT_CONVERT_ROAD, ///< Convert road.
|
||||
|
||||
INVALID_WID_ROT = -1,
|
||||
};
|
||||
|
||||
/** Widgets of the #BuildRoadDepotWindow class. */
|
||||
|
|
|
@ -22,6 +22,8 @@ enum TerraformToolbarWidgets {
|
|||
WID_TT_PLANT_TREES, ///< Plant trees button (note: opens separate window, no place-push-button).
|
||||
WID_TT_PLACE_SIGN, ///< Place sign button.
|
||||
WID_TT_PLACE_OBJECT, ///< Place object button.
|
||||
|
||||
INVALID_WID_TT = -1,
|
||||
};
|
||||
|
||||
/** Widgets of the #ScenarioEditorLandscapeGenerationWindow class. */
|
||||
|
@ -42,6 +44,8 @@ enum EditorTerraformToolbarWidgets {
|
|||
WID_ETT_DECREASE_SIZE, ///< Downwards arrow button to decrease terraforming size.
|
||||
WID_ETT_NEW_SCENARIO, ///< Button for generating a new scenario.
|
||||
WID_ETT_RESET_LANDSCAPE, ///< Button for removing all company-owned property.
|
||||
|
||||
INVALID_WID_ETT = -1,
|
||||
};
|
||||
|
||||
#endif /* WIDGETS_TERRAFORM_WIDGET_H */
|
||||
|
|
Loading…
Reference in New Issue