|
@@ -591,29 +591,26 @@ Vehicle::~Vehicle()
|
|
|
this->next_new_hash = NULL;
|
|
|
|
|
|
DeleteVehicleNews(this->index, INVALID_STRING_ID);
|
|
|
|
|
|
this->type = VEH_INVALID;
|
|
|
}
|
|
|
|
|
|
/** Adds a vehicle to the list of vehicles, that visited a depot this tick
|
|
|
* @param *v vehicle to add
|
|
|
*/
|
|
|
void VehicleEnteredDepotThisTick(Vehicle *v)
|
|
|
{
|
|
|
/* Vehicle should stop in the depot if it was in 'stopping' state or
|
|
|
* when the vehicle is ordered to halt in the depot. */
|
|
|
_vehicles_to_autoreplace[v] = !(v->vehstatus & VS_STOPPED) &&
|
|
|
(!v->current_order.IsType(OT_GOTO_DEPOT) ||
|
|
|
!(v->current_order.GetDepotActionType() & ODATFB_HALT));
|
|
|
/* Vehicle should stop in the depot if it was in 'stopping' state */
|
|
|
_vehicles_to_autoreplace[v] = !(v->vehstatus & VS_STOPPED);
|
|
|
|
|
|
/* We ALWAYS set the stopped state. Even when the vehicle does not plan on
|
|
|
* stopping in the depot, so we stop it to ensure that it will not reserve
|
|
|
* the path out of the depot before we might autoreplace it to a different
|
|
|
* engine. The new engine would not own the reserved path we store that we
|
|
|
* stopped the vehicle, so autoreplace can start it again */
|
|
|
v->vehstatus |= VS_STOPPED;
|
|
|
}
|
|
|
|
|
|
void CallVehicleTicks()
|
|
|
{
|
|
|
_vehicles_to_autoreplace.Clear();
|
|
@@ -1064,26 +1061,26 @@ void VehicleEnterDepot(Vehicle *v)
|
|
|
}
|
|
|
} else if (v->owner == _local_company && cost.GetCost() != 0) {
|
|
|
ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost.GetCost());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
|
|
|
/* Part of orders */
|
|
|
UpdateVehicleTimetable(v, true);
|
|
|
v->cur_order_index++;
|
|
|
}
|
|
|
if (t.GetDepotActionType() & ODATFB_HALT) {
|
|
|
/* Force depot visit */
|
|
|
v->vehstatus |= VS_STOPPED;
|
|
|
/* Vehicles are always stopped on entering depots. Do not restart this one. */
|
|
|
_vehicles_to_autoreplace[v] = false;
|
|
|
if (v->owner == _local_company) {
|
|
|
StringID string;
|
|
|
|
|
|
switch (v->type) {
|
|
|
case VEH_TRAIN: string = STR_VEHICLE_STATUS_WAITING_IN_DEPOT; break;
|
|
|
case VEH_ROAD: string = STR_NEWS_ROAD_VEHICLE_IS_WAITING; break;
|
|
|
case VEH_SHIP: string = STR_NEWS_SHIP_IS_WAITING; break;
|
|
|
case VEH_AIRCRAFT: string = STR_NEWS_AIRCRAFT_IS_WAITING; break;
|
|
|
default: NOT_REACHED(); string = STR_EMPTY; // Set the string to something to avoid a compiler warning
|
|
|
}
|
|
|
|
|
|
SetDParam(0, v->index);
|