|
@@ -561,12 +561,14 @@ bool IsEngineCountable(const Vehicle *v)
|
|
|
default: return false; // Only count player buildable vehicles
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void Vehicle::PreDestructor()
|
|
|
{
|
|
|
if (CleaningPool()) return;
|
|
|
|
|
|
if (IsValidStationID(this->last_station_visited)) {
|
|
|
GetStation(this->last_station_visited)->loading_vehicles.remove(this);
|
|
|
|
|
|
HideFillingPercent(this->fill_percent_te_id);
|
|
|
this->fill_percent_te_id = INVALID_TE_ID;
|
|
|
}
|
|
@@ -576,13 +578,12 @@ void Vehicle::PreDestructor()
|
|
|
if (this->owner == _local_player) InvalidateAutoreplaceWindow(this->engine_type, this->group_id);
|
|
|
|
|
|
if (IsValidGroupID(this->group_id)) GetGroup(this->group_id)->num_engines[this->engine_type]--;
|
|
|
if (this->IsPrimaryVehicle()) DecreaseGroupNumVehicle(this->group_id);
|
|
|
}
|
|
|
|
|
|
this->QuickFree();
|
|
|
if (this->type == VEH_ROAD) ClearSlot(this);
|
|
|
|
|
|
if (this->type != VEH_TRAIN || (this->type == VEH_TRAIN && (IsFrontEngine(this) || IsFreeWagon(this)))) {
|
|
|
InvalidateWindowData(WC_VEHICLE_DEPOT, this->tile);
|
|
|
}
|
|
|
|
|
@@ -596,26 +597,25 @@ void Vehicle::PreDestructor()
|
|
|
delete this->next;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Vehicle::~Vehicle()
|
|
|
{
|
|
|
DeleteName(this->string_id);
|
|
|
|
|
|
if (CleaningPool()) return;
|
|
|
|
|
|
UpdateVehiclePosHash(this, INVALID_COORD, 0);
|
|
|
this->next_hash = NULL;
|
|
|
this->next_new_hash = NULL;
|
|
|
|
|
|
DeleteVehicleNews(this->index, INVALID_STRING_ID);
|
|
|
|
|
|
new (this) InvalidVehicle();
|
|
|
}
|
|
|
|
|
|
void Vehicle::QuickFree()
|
|
|
{
|
|
|
DeleteName(this->string_id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Deletes all vehicles in a chain.
|
|
|
* @param v The first vehicle in the chain.
|
|
|
*
|
|
|
* @warning This function is not valid for any vehicle containing articulated
|
|
|
* parts.
|