From 87c87649b86c8b19ae5ef2cea406215a445f41ad Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 28 Jan 2021 22:28:20 +0000 Subject: [PATCH] Fix lookahead init inside a signalled tunnel/bridge only filling interior --- src/train_cmd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 675e2adbcd..7b7535cbdd 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -4119,7 +4119,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay) if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC) { /* Initialise a lookahead if there isn't one already */ - if (v->lookahead == nullptr) TryCreateLookAheadForTrainInTunnelBridge(v); + if (v->lookahead == nullptr) FillTrainReservationLookAhead(v); if (v->lookahead != nullptr && !LookaheadWithinCurrentTunnelBridge(v)) { /* Try to extend the reservation beyond the tunnel/bridge exit */ TryLongReserveChooseTrainTrackFromReservationEnd(v, true); @@ -4639,7 +4639,7 @@ static bool IsTooCloseBehindTrain(Train *t, TileIndex tile, uint16 distance, boo if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC) { if (unlikely(t->lookahead == nullptr)) { - TryCreateLookAheadForTrainInTunnelBridge(t); + FillTrainReservationLookAhead(t); } if (likely(t->lookahead != nullptr)) { if (LookaheadWithinCurrentTunnelBridge(t)) { @@ -4726,7 +4726,7 @@ static bool CheckTrainStayInWormHolePathReserve(Train *t, TileIndex tile) if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC) { if (unlikely(t->lookahead == nullptr)) { - TryCreateLookAheadForTrainInTunnelBridge(t); + FillTrainReservationLookAhead(t); } if (likely(t->lookahead != nullptr)) { if (!HasAcrossTunnelBridgeReservation(tile)) return false;