diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -306,7 +306,7 @@ static bool RailToolbar_CtrlChanged(Wind if (w->IsWidgetDisabled(WID_RAT_REMOVE)) return false; /* allow ctrl to switch remove mode only for these widgets */ - for (uint i = WID_RAT_BUILD_NS; i <= WID_RAT_BUILD_STATION; i++) { + for (WidgetID i = WID_RAT_BUILD_NS; i <= WID_RAT_BUILD_STATION; i++) { if ((i <= WID_RAT_AUTORAIL || i >= WID_RAT_BUILD_WAYPOINT) && w->IsWidgetLowered(i)) { ToggleRailButton_Remove(w); return true; @@ -458,7 +458,7 @@ struct BuildRailToolbarWindow : Window { this->ReInit(); } - void UpdateRemoveWidgetStatus(int clicked_widget) + void UpdateRemoveWidgetStatus(WidgetID clicked_widget) { switch (clicked_widget) { case WID_RAT_REMOVE: @@ -488,7 +488,7 @@ struct BuildRailToolbarWindow : Window { } } - void SetStringParameters(int widget) const override + void SetStringParameters(WidgetID widget) const override { if (widget == WID_RAT_CAPTION) { const RailTypeInfo *rti = GetRailTypeInfo(this->railtype); @@ -502,7 +502,7 @@ struct BuildRailToolbarWindow : Window { } } - void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override + void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override { if (widget < WID_RAT_BUILD_NS) return; @@ -1123,7 +1123,7 @@ public: return ES_HANDLED; } - void OnEditboxChanged(int widget) override + void OnEditboxChanged(WidgetID widget) override { if (widget == WID_BRAS_FILTER_EDITBOX) { string_filter.SetFilterTerm(this->filter_editbox.text.buf); @@ -1181,7 +1181,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override + void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BRAS_NEWST_LIST: { @@ -1236,7 +1236,7 @@ public: } } - void DrawWidget(const Rect &r, int widget) const override + void DrawWidget(const Rect &r, WidgetID widget) const override { DrawPixelInfo tmp_dpi; @@ -1315,7 +1315,7 @@ public: } } - void SetStringParameters(int widget) const override + void SetStringParameters(WidgetID widget) const override { if (widget == WID_BRAS_SHOW_NEWST_TYPE) { const StationSpec *statspec = StationClass::Get(_railstation.station_class)->GetSpec(_railstation.station_type); @@ -1323,7 +1323,7 @@ public: } } - void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override + void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override { switch (GB(widget, 0, 16)) { case WID_BRAS_PLATFORM_DIR_X: @@ -1644,7 +1644,7 @@ private: * @param widget_index index of this widget in the window * @param image the sprite to draw */ - void DrawSignalSprite(const Rect &r, int widget_index, SpriteID image) const + void DrawSignalSprite(const Rect &r, WidgetID widget_index, SpriteID image) const { Point offset; Dimension sprite_size = GetSpriteSize(image, &offset); @@ -1708,7 +1708,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override + void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_BS_DRAG_SIGNALS_DENSITY_LABEL) { /* Two digits for signals density. */ @@ -1721,7 +1721,7 @@ public: } } - void SetStringParameters(int widget) const override + void SetStringParameters(WidgetID widget) const override { switch (widget) { case WID_BS_DRAG_SIGNALS_DENSITY_LABEL: @@ -1730,7 +1730,7 @@ public: } } - void DrawWidget(const Rect &r, int widget) const override + void DrawWidget(const Rect &r, WidgetID widget) const override { if (IsInsideMM(widget, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_PBS_OWAY + 1)) { /* Extract signal from widget number. */ @@ -1742,7 +1742,7 @@ public: } } - void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override + void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BS_SEMAPHORE_NORM: @@ -1897,7 +1897,7 @@ struct BuildRailDepotWindow : public Pic this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); } - void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override + void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return; @@ -1905,7 +1905,7 @@ struct BuildRailDepotWindow : public Pic size->height = ScaleGUITrad(48) + WidgetDimensions::scaled.fullbevel.Vertical(); } - void DrawWidget(const Rect &r, int widget) const override + void DrawWidget(const Rect &r, WidgetID widget) const override { if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return; @@ -1919,7 +1919,7 @@ struct BuildRailDepotWindow : public Pic } } - void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override + void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BRAD_DEPOT_NE: @@ -2052,7 +2052,7 @@ struct BuildRailWaypointWindow : PickerW } } - void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override + void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BRW_WAYPOINT_MATRIX: @@ -2071,7 +2071,7 @@ struct BuildRailWaypointWindow : PickerW } } - void SetStringParameters(int widget) const override + void SetStringParameters(WidgetID widget) const override { if (widget == WID_BRW_NAME) { if (!this->list.empty() && IsInsideBS(_cur_waypoint_type, 0, this->waypoints->GetSpecCount())) { @@ -2093,7 +2093,7 @@ struct BuildRailWaypointWindow : PickerW this->DrawWidgets(); } - void DrawWidget(const Rect &r, int widget) const override + void DrawWidget(const Rect &r, WidgetID widget) const override { switch (GB(widget, 0, 16)) { case WID_BRW_WAYPOINT: { @@ -2116,7 +2116,7 @@ struct BuildRailWaypointWindow : PickerW } } - void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override + void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override { switch (GB(widget, 0, 16)) { case WID_BRW_WAYPOINT: { @@ -2143,7 +2143,7 @@ struct BuildRailWaypointWindow : PickerW this->list.ForceRebuild(); } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(WidgetID wid) override { if (wid == WID_BRW_FILTER) { this->string_filter.SetFilterTerm(this->editbox.text.buf);