From fb3cb9c3d230764c166e4148fcde87c78d79e7f3 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 15 Aug 2018 03:14:53 +0100 Subject: [PATCH] Enable NewGRF debug window for non-GRF vehicles --- src/newgrf_debug_gui.cpp | 3 +++ src/table/newgrf_debug_data.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 2293db24ad..11326ec21e 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -201,6 +201,7 @@ public: } virtual void ExtraInfo(uint index, std::function print) const {} + virtual bool ShowExtraInfoOnly(uint index) const { return false; }; protected: /** @@ -473,6 +474,8 @@ struct NewGRFInspectWindow : Window { ::DrawString(r.left + LEFT_OFFSET, r.right - RIGHT_OFFSET, r.top + TOP_OFFSET + (offset * this->resize.step_height), buf, TC_BLACK); }); + if (nih->ShowExtraInfoOnly(index)) return; + const_cast(this)->first_variable_line_index = i; if (nif->variables != NULL) { diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index cb7767cb3c..253f88c7a3 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -69,7 +69,8 @@ static const NIVariable _niv_vehicles[] = { }; class NIHVehicle : public NIHelper { - bool IsInspectable(uint index) const { return Vehicle::Get(index)->GetGRF() != NULL; } + bool IsInspectable(uint index) const { return true; } + bool ShowExtraInfoOnly(uint index) const { return Vehicle::Get(index)->GetGRF() == NULL; } uint GetParent(uint index) const { const Vehicle *first = Vehicle::Get(index)->First(); return GetInspectWindowNumber(GetGrfSpecFeature(first->type), first->index); } const void *GetInstance(uint index)const { return Vehicle::Get(index); } const void *GetSpec(uint index) const { return Vehicle::Get(index)->GetEngine(); }