diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index f9bc2fdf9b..579123afd2 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2444,6 +2444,19 @@ bool HandleTrainEnterDepot(Train *v) return true; } +bool CheckReverseTrain(const Train *v) +{ + if (_settings_game.difficulty.line_reverse_mode != 0 || + v->track == TRACK_BIT_DEPOT || v->track == TRACK_BIT_WORMHOLE || + !(v->direction & 1)) { + return false; + } + + assert(v->track != TRACK_BIT_NONE); + + return YapfTrainCheckReverse(v); +} + /** * Will the train stay in the depot the next tick? * @param v %Train to check. @@ -2463,6 +2476,8 @@ static bool CheckTrainStayInDepot(Train *v) v->UpdatePosition(); v->UpdateViewport(true, true); v->UpdateAcceleration(); + ProcessOrders(v); + if (CheckReverseTrain(v)) ReverseTrainDirection(v); InvalidateWindowData(WC_VEHICLE_DEPOT, depot_id); return false; } else { @@ -3112,19 +3127,6 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay) } -static bool CheckReverseTrain(const Train *v) -{ - if (_settings_game.difficulty.line_reverse_mode != 0 || - v->track == TRACK_BIT_DEPOT || v->track == TRACK_BIT_WORMHOLE || - !(v->direction & 1)) { - return false; - } - - assert(v->track != TRACK_BIT_NONE); - - return YapfTrainCheckReverse(v); -} - /** * Get the location of the next station to visit. * @param station Next station to visit.