(svn r22328) -Add: a flag to GroundVehicles to disable insertion and removal of automatic orders until the next real order is reached.

This commit is contained in:
frosch
2011-04-16 16:45:35 +00:00
parent aedd38255b
commit 194a941a37
3 changed files with 25 additions and 5 deletions

View File

@@ -2287,19 +2287,21 @@ static bool TryReserveSafeTrack(const Train *v, TileIndex tile, Trackdir td, boo
class VehicleOrderSaver
{
private:
Vehicle *v;
Train *v;
Order old_order;
TileIndex old_dest_tile;
StationID old_last_station_visited;
VehicleOrderID index;
bool suppress_automatic_orders;
public:
VehicleOrderSaver(Vehicle *_v) :
VehicleOrderSaver(Train *_v) :
v(_v),
old_order(_v->current_order),
old_dest_tile(_v->dest_tile),
old_last_station_visited(_v->last_station_visited),
index(_v->cur_real_order_index)
index(_v->cur_real_order_index),
suppress_automatic_orders(HasBit(_v->gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS))
{
}
@@ -2308,6 +2310,7 @@ public:
this->v->current_order = this->old_order;
this->v->dest_tile = this->old_dest_tile;
this->v->last_station_visited = this->old_last_station_visited;
SB(this->v->gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS, 1, suppress_automatic_orders ? 1: 0);
}
/**
@@ -3767,6 +3770,7 @@ static void CheckIfTrainNeedsService(Train *v)
return;
}
SetBit(v->gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
v->dest_tile = tfdd.tile;
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);