Debug: Fix crash when inspecting train with realistic braking disabled

When realistic braking is otherwise enabled
This commit is contained in:
Jonathan G Rennison 2022-05-30 17:28:15 +01:00
parent 994dc683a2
commit 9a131a90ca

View File

@ -213,6 +213,7 @@ class NIHVehicle : public NIHelper {
TrainDecelerationStats stats(t); TrainDecelerationStats stats(t);
auto print_braking_speed = [&](int position, int end_speed, int end_z) { 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); extern void LimitSpeedFromLookAhead(int &max_speed, const TrainDecelerationStats &stats, int current_position, int position, int end_speed, int z_delta);
int speed = INT_MAX; int speed = INT_MAX;
LimitSpeedFromLookAhead(speed, stats, l.current_position, position, end_speed, end_z - stats.z_pos); LimitSpeedFromLookAhead(speed, stats, l.current_position, position, end_speed, end_z - stats.z_pos);