mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 16:54:42 +00:00
Feature: Add coverage button to waypoint window
This commit is contained in:
parent
d7bf6b2c07
commit
ec7f9f63f6
@ -79,6 +79,7 @@ public:
|
|||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
CloseWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false);
|
CloseWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false);
|
||||||
|
SetViewportCatchmentWaypoint(Waypoint::Get(this->window_number), false);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +88,15 @@ public:
|
|||||||
if (widget == WID_W_CAPTION) SetDParam(0, this->wp->index);
|
if (widget == WID_W_CAPTION) SetDParam(0, this->wp->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnPaint() override
|
||||||
|
{
|
||||||
|
extern const Waypoint *_viewport_highlight_waypoint;
|
||||||
|
this->SetWidgetDisabledState(WID_W_CATCHMENT, !this->wp->IsInUse());
|
||||||
|
this->SetWidgetLoweredState(WID_W_CATCHMENT, _viewport_highlight_waypoint == this->wp);
|
||||||
|
|
||||||
|
this->DrawWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
void OnClick(Point pt, int widget, int click_count) override
|
void OnClick(Point pt, int widget, int click_count) override
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
@ -106,6 +116,10 @@ public:
|
|||||||
case WID_W_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
|
case WID_W_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
|
||||||
ShowVehicleListWindow(this->wp->owner, this->vt, this->wp->index);
|
ShowVehicleListWindow(this->wp->owner, this->vt, this->wp->index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WID_W_CATCHMENT:
|
||||||
|
SetViewportCatchmentWaypoint(Waypoint::Get(this->window_number), !this->IsWidgetLowered(WID_W_CATCHMENT));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +176,7 @@ static const NWidgetPart _nested_waypoint_view_widgets[] = {
|
|||||||
EndContainer(),
|
EndContainer(),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 0), EndContainer(),
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_W_CATCHMENT), SetMinimalSize(50, 12), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_BUTTON_CATCHMENT, STR_TOOLTIP_CATCHMENT),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_W_SHOW_VEHICLES), SetMinimalSize(15, 12), SetDataTip(STR_SHIP, STR_STATION_VIEW_SCHEDULED_SHIPS_TOOLTIP),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_W_SHOW_VEHICLES), SetMinimalSize(15, 12), SetDataTip(STR_SHIP, STR_STATION_VIEW_SCHEDULED_SHIPS_TOOLTIP),
|
||||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
|
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
|
@ -17,6 +17,7 @@ enum WaypointWidgets {
|
|||||||
WID_W_CENTER_VIEW, ///< Center the main view on this waypoint.
|
WID_W_CENTER_VIEW, ///< Center the main view on this waypoint.
|
||||||
WID_W_RENAME, ///< Rename this waypoint.
|
WID_W_RENAME, ///< Rename this waypoint.
|
||||||
WID_W_SHOW_VEHICLES, ///< Show the vehicles visiting this waypoint.
|
WID_W_SHOW_VEHICLES, ///< Show the vehicles visiting this waypoint.
|
||||||
|
WID_W_CATCHMENT, ///< Coverage button.
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* WIDGETS_WAYPOINT_WIDGET_H */
|
#endif /* WIDGETS_WAYPOINT_WIDGET_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user