(svn r10744) -Codechange: make the pool a little more OO, so it can be easier in other places.

This commit is contained in:
rubidium
2007-08-01 22:10:54 +00:00
parent 435d39f8fb
commit 4e96ce3dfe
5 changed files with 79 additions and 60 deletions

View File

@@ -355,7 +355,7 @@ static Vehicle *AllocateSingleVehicle(VehicleID *skip_vehicles)
/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
* @todo - This is just a temporary stage, this will be removed. */
if (*skip_vehicles < (_Vehicle_pool.total_items - offset)) { // make sure the offset in the array is not larger than the array itself
if (*skip_vehicles < (_Vehicle_pool.GetSize() - offset)) { // make sure the offset in the array is not larger than the array itself
for (v = GetVehicle(offset + *skip_vehicles); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) {
(*skip_vehicles)++;
if (!IsValidVehicle(v)) return InitializeVehicle(v);