From 9a131a90ca1d75b235a15e94680f05002cdca45c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 30 May 2022 17:28:15 +0100 Subject: [PATCH] Debug: Fix crash when inspecting train with realistic braking disabled When realistic braking is otherwise enabled --- src/table/newgrf_debug_data.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 85ed086b6e..ed6acd70c3 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -213,6 +213,7 @@ class NIHVehicle : public NIHelper { TrainDecelerationStats stats(t); auto print_braking_speed = [&](int position, int end_speed, int end_z) { + if (!t->UsingRealisticBraking()) return; extern void LimitSpeedFromLookAhead(int &max_speed, const TrainDecelerationStats &stats, int current_position, int position, int end_speed, int z_delta); int speed = INT_MAX; LimitSpeedFromLookAhead(speed, stats, l.current_position, position, end_speed, end_z - stats.z_pos);