summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vehicle.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 53220474e..f655bbafc 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2356,8 +2356,10 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (!(command & DEPOT_SERVICE)) this->current_order.SetDepotActionType(ODATFB_HALT);
SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, WID_VV_START_STOP);
- /* If there is no depot in front, reverse automatically (trains only) */
- if (this->type == VEH_TRAIN && reverse) DoCommand(this->tile, this->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
+ /* If there is no depot in front and the train is not already reversing, reverse automatically (trains only) */
+ if (this->type == VEH_TRAIN && (reverse ^ HasBit(Train::From(this)->flags, VRF_REVERSING))) {
+ DoCommand(this->tile, this->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
+ }
if (this->type == VEH_AIRCRAFT) {
Aircraft *a = Aircraft::From(this);