From 7ccbb6cf16827c48a23c71a5c969ee5ecaafda06 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 1 Jul 2020 19:10:14 +0100 Subject: [PATCH] Debug: Show engine date properties in vehicle debug window --- src/table/newgrf_debug_data.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 054542e497..15f94304c0 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -10,6 +10,7 @@ #include "../newgrf_house.h" #include "../newgrf_engine.h" #include "../newgrf_roadtype.h" +#include "../date_func.h" /* Helper for filling property tables */ #define NIP(prop, base, variable, type, name) { name, (ptrdiff_t)cpp_offsetof(base, variable), cpp_sizeof(base, variable), prop, type } @@ -129,6 +130,18 @@ class NIHVehicle : public NIHelper { gvc.cached_total_length, gvc.cached_veh_length); print(buffer); } + + seprintf(buffer, lastof(buffer), " Engine: %u", v->engine_type); + print(buffer); + const Engine *e = Engine::GetIfValid(v->engine_type); + if (e != nullptr) { + YearMonthDay ymd; + ConvertDateToYMD(e->intro_date, &ymd); + seprintf(buffer, lastof(buffer), " Intro: %4i-%02i-%02i, Age: %u, Base life: %u, Durations: %u %u %u (sum: %u)", + ymd.year, ymd.month + 1, ymd.day, e->age, e->info.base_life, e->duration_phase_1, e->duration_phase_2, e->duration_phase_3, + e->duration_phase_1 + e->duration_phase_2 + e->duration_phase_3); + print(buffer); + } } };