Fix #12388: Vehicle::CopyVehicleConfigAndStatistics not releasing unit number (#12389)

This commit is contained in:
Jonathan G Rennison
2024-03-27 20:20:27 +00:00
committed by GitHub
parent b8b01818ca
commit 433484cda3
3 changed files with 13 additions and 2 deletions

View File

@@ -2401,6 +2401,15 @@ void Vehicle::ResetRefitCaps()
for (Vehicle *v = this; v != nullptr; v = v->Next()) v->refit_cap = v->cargo_cap;
}
/**
* Release the vehicle's unit number.
*/
void Vehicle::ReleaseUnitNumber()
{
Company::Get(this->owner)->freeunits[this->type].ReleaseID(this->unitnumber);
this->unitnumber = 0;
}
/**
* Handle the loading of the vehicle; when not it skips through dummy
* orders and does nothing in all other cases.