Merge branch 'wait_in_depot-sx' into jgrpp
Conflicts: src/saveload/extended_ver_sl.cpp src/saveload/extended_ver_sl.h
This commit is contained in:
@@ -1663,12 +1663,21 @@ void VehicleEnterDepot(Vehicle *v)
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle the ODTFB_PART_OF_ORDERS case. If there is a timetabled wait time, hold the train, otherwise skip to the next order.
|
||||
Note that if there is a only a travel_time, but no wait_time defined for the order, and the train arrives to the depot sooner as scheduled,
|
||||
he doesn't wait in it, as it would in stations. Thus, the original behaviour is maintained if there's no defined wait_time.*/
|
||||
if (v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
|
||||
/* Part of orders */
|
||||
v->DeleteUnreachedImplicitOrders();
|
||||
UpdateVehicleTimetable(v, true);
|
||||
v->IncrementImplicitOrderIndex();
|
||||
if (v->current_order.IsWaitTimetabled()) {
|
||||
v->current_order.MakeWaiting();
|
||||
v->current_order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
|
||||
return;
|
||||
} else {
|
||||
v->IncrementImplicitOrderIndex();
|
||||
}
|
||||
}
|
||||
|
||||
if (v->current_order.GetDepotActionType() & ODATFB_HALT) {
|
||||
/* Vehicles are always stopped on entering depots. Do not restart this one. */
|
||||
_vehicles_to_autoreplace[v] = false;
|
||||
@@ -2389,6 +2398,34 @@ void Vehicle::HandleLoading(bool mode)
|
||||
this->IncrementImplicitOrderIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the waiting time everywhere else as in stations (basically in depot but, eventually, also elsewhere ?)
|
||||
* Function is called when order's wait_time is defined.
|
||||
* @param stop_waiting should we stop waiting (or definitely avoid) even if there is still time left to wait ?
|
||||
*/
|
||||
void Vehicle::HandleWaiting(bool stop_waiting)
|
||||
{
|
||||
switch (this->current_order.GetType()) {
|
||||
case OT_WAITING: {
|
||||
uint wait_time = max(this->current_order.GetTimetabledWait() - this->lateness_counter, 0);
|
||||
/* Vehicles holds on until waiting Timetabled time expires. */
|
||||
if (!stop_waiting && this->current_order_time < wait_time) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* When wait_time is expired, we move on. */
|
||||
UpdateVehicleTimetable(this, false);
|
||||
this->IncrementImplicitOrderIndex();
|
||||
this->current_order.MakeDummy();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a map of cargoes and free capacities in the consist.
|
||||
* @param capacities Map to be filled with cargoes and capacities.
|
||||
|
Reference in New Issue
Block a user