Change: Use bitmap for free unit ID generation. (#12165)
This improves performance of finding the next free unit number for a vehicle. Based loosely on pool's used slot bitmap.
This commit is contained in:
@@ -194,6 +194,8 @@ std::tuple<CommandCost, VehicleID, uint, uint16_t, CargoArray> CmdBuildVehicle(D
|
||||
GroupStatistics::CountVehicle(v, 1);
|
||||
if (!(subflags & DC_AUTOREPLACE)) OrderBackup::Restore(v, client_id);
|
||||
}
|
||||
|
||||
Company::Get(v->owner)->freeunits[v->type].UseID(v->unitnumber);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user