Changeset - r23289:ce4b5aef37cf
[Not reviewed]
master
0 1 0
Henry Wilson - 5 years ago 2019-02-08 22:37:41
m3henry@googlemail.com
Fix: trains cancelling their pending reversal when ordered to go to a depot behind them

Previously, if a train had been ordered to reverse, and while it was slowing down, was
ordered to travel to a depot that is behind it, the train would continue forwards.
Also when a train had been ordered to reverse, and while it was slowing down, was
ordered to travel to a depot that is in front of it, the train would not cancel the
reversal.
In both cases the train would travel away from the target depot.

Trains in this situation now behave correctly and will travel towards the depot.
1 file changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -2356,8 +2356,10 @@ CommandCost Vehicle::SendToDepot(DoComma
 
		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);
0 comments (0 inline, 0 general)