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:
@@ -517,6 +517,10 @@ void AfterLoadVehicles(bool part_of_load)
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (part_of_load && v->unitnumber != 0) {
|
||||
Company::Get(v->owner)->freeunits[v->type].UseID(v->unitnumber);
|
||||
}
|
||||
|
||||
v->UpdateDeltaXY();
|
||||
v->coord.left = INVALID_COORD;
|
||||
v->sprite_cache.old_coord.left = INVALID_COORD;
|
||||
|
Reference in New Issue
Block a user