Update to 14.0-beta1
This commit is contained in:
@@ -21,13 +21,13 @@
|
||||
#include "window_func.h"
|
||||
#include "waypoint_base.h"
|
||||
#include "waypoint_cmd.h"
|
||||
#include "zoom_func.h"
|
||||
|
||||
#include "widgets/waypoint_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
#include "zoom_func.h"
|
||||
|
||||
/** GUI for accessing waypoints and buoys. */
|
||||
struct WaypointWindow : Window {
|
||||
@@ -76,18 +76,28 @@ public:
|
||||
this->OnInvalidateData(0);
|
||||
}
|
||||
|
||||
void Close() override
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void SetStringParameters(int widget) const override
|
||||
void SetStringParameters(WidgetID widget) const override
|
||||
{
|
||||
if (widget == WID_W_CAPTION) SetDParam(0, this->wp->index);
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
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([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_W_CENTER_VIEW: // scroll to location
|
||||
@@ -106,6 +116,10 @@ public:
|
||||
case WID_W_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
|
||||
ShowVehicleListWindow(this->wp->owner, this->vt, this->wp->index);
|
||||
break;
|
||||
|
||||
case WID_W_CATCHMENT:
|
||||
SetViewportCatchmentWaypoint(Waypoint::Get(this->window_number), !this->IsWidgetLowered(WID_W_CATCHMENT));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +128,7 @@ public:
|
||||
* @param data Information about the changed data.
|
||||
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
||||
*/
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
/* You can only change your own waypoints */
|
||||
@@ -146,7 +160,7 @@ public:
|
||||
};
|
||||
|
||||
/** The widgets of the waypoint view. */
|
||||
static const NWidgetPart _nested_waypoint_view_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_waypoint_view_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_W_RENAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_BUOY_VIEW_CHANGE_BUOY_NAME),
|
||||
@@ -162,18 +176,18 @@ static const NWidgetPart _nested_waypoint_view_widgets[] = {
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
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_RESIZEBOX, COLOUR_GREY),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
/** The description of the waypoint view. */
|
||||
static WindowDesc _waypoint_view_desc(
|
||||
static WindowDesc _waypoint_view_desc(__FILE__, __LINE__,
|
||||
WDP_AUTO, "view_waypoint", 260, 118,
|
||||
WC_WAYPOINT_VIEW, WC_NONE,
|
||||
0,
|
||||
_nested_waypoint_view_widgets, lengthof(_nested_waypoint_view_widgets)
|
||||
std::begin(_nested_waypoint_view_widgets), std::end(_nested_waypoint_view_widgets)
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user