(svn r8294) -Fix: deleting a vehicle with shared orders, but no orders would fail to reset prev_shared and next_shared

-As a result, vehicles in the game could end up having prev/next pointers to vehicles, that was no longer in the game
This commit is contained in:
bjarni
2007-01-21 00:13:39 +00:00
parent c8c27b9740
commit 7871ce1879
2 changed files with 13 additions and 1 deletions

View File

@@ -407,6 +407,18 @@ static inline void DeleteVehicle(Vehicle *v)
v->type = 0;
}
static inline bool IsPlayerBuildableVehicleType(const Vehicle *v)
{
switch (v->type) {
case VEH_Train:
case VEH_Road:
case VEH_Ship:
case VEH_Aircraft:
return true;
}
return false;
}
#define FOR_ALL_VEHICLES_FROM(v, start) for (v = GetVehicle(start); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) if (IsValidVehicle(v))
#define FOR_ALL_VEHICLES(v) FOR_ALL_VEHICLES_FROM(v, 0)