Add NewGRF debug window inspection for waypoints

This commit is contained in:
Jonathan G Rennison
2021-01-15 17:15:16 +00:00
parent 6a6d9f3773
commit fc012d4874
2 changed files with 13 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
#include "waypoint_base.h"
#include "viewport_kdtree.h"
#include "tracerestrict.h"
#include "newgrf_debug.h"
#include "safeguards.h"
@@ -53,6 +54,7 @@ Waypoint::~Waypoint()
{
if (CleaningPool()) return;
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
DeleteNewGRFInspectWindow(GSF_FAKE_STATION_STRUCT, this->index);
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
if (_viewport_sign_kdtree_valid && this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index));
TraceRestrictRemoveDestinationID(TROCAF_WAYPOINT, this->index);

View File

@@ -21,6 +21,7 @@
#include "window_func.h"
#include "waypoint_base.h"
#include "departures_gui.h"
#include "newgrf_debug.h"
#include "widgets/waypoint_widget.h"
@@ -145,6 +146,15 @@ public:
DoCommandP(0, this->window_number, 0, CMD_RENAME_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_WAYPOINT_NAME), nullptr, str);
}
bool IsNewGRFInspectable() const override
{
return ::IsNewGRFInspectable(GSF_FAKE_STATION_STRUCT, this->window_number);
}
void ShowNewGRFInspectWindow() const override
{
::ShowNewGRFInspectWindow(GSF_FAKE_STATION_STRUCT, this->window_number);
}
};
/** The widgets of the waypoint view. */
@@ -152,6 +162,7 @@ static const NWidgetPart _nested_waypoint_view_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_W_CAPTION), SetDataTip(STR_WAYPOINT_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_DEBUGBOX, COLOUR_GREY),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),