mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
This commit is contained in:
parent
b8b01818ca
commit
433484cda3
@ -1336,8 +1336,7 @@ CommandCost CmdMoveRailVehicle(DoCommandFlag flags, VehicleID src_veh, VehicleID
|
||||
}
|
||||
/* Remove stuff not valid anymore for non-front engines. */
|
||||
DeleteVehicleOrders(src);
|
||||
Company::Get(src->owner)->freeunits[src->type].ReleaseID(src->unitnumber);
|
||||
src->unitnumber = 0;
|
||||
src->ReleaseUnitNumber();
|
||||
src->name.clear();
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -750,6 +750,8 @@ public:
|
||||
|
||||
void ResetRefitCaps();
|
||||
|
||||
void ReleaseUnitNumber();
|
||||
|
||||
/**
|
||||
* Copy certain configurations and statistics of a vehicle after successful autoreplace/renew
|
||||
* The function shall copy everything that cannot be copied by a command (like orders / group etc),
|
||||
@ -760,6 +762,7 @@ public:
|
||||
{
|
||||
this->CopyConsistPropertiesFrom(src);
|
||||
|
||||
this->ReleaseUnitNumber();
|
||||
this->unitnumber = src->unitnumber;
|
||||
|
||||
this->current_order = src->current_order;
|
||||
|
Loading…
Reference in New Issue
Block a user