(svn r6157) -Codechange: DeleteVehicle removes a vehicle from the pool
-Codechange: DestroyVehicle is called by DeleteVehicle to remove all things where a vehicle depends on. Last 2 changes to prepare for new pool system. Not pretty now, will be soon.
This commit is contained in:
@@ -255,7 +255,6 @@ Vehicle *GetLastVehicleInChain(Vehicle *v);
|
||||
Vehicle *GetPrevVehicleInChain(const Vehicle *v);
|
||||
Vehicle *GetFirstVehicleInChain(const Vehicle *v);
|
||||
uint CountVehiclesInChain(const Vehicle* v);
|
||||
void DeleteVehicle(Vehicle *v);
|
||||
void DeleteVehicleChain(Vehicle *v);
|
||||
void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
|
||||
void CallVehicleTicks(void);
|
||||
@@ -377,6 +376,14 @@ static inline bool IsValidVehicle(const Vehicle *v)
|
||||
return v->type != 0;
|
||||
}
|
||||
|
||||
void DestroyVehicle(Vehicle *v);
|
||||
|
||||
static inline void DeleteVehicle(Vehicle *v)
|
||||
{
|
||||
DestroyVehicle(v);
|
||||
v->type = 0;
|
||||
}
|
||||
|
||||
#define FOR_ALL_VEHICLES_FROM(v, start) for (v = GetVehicle(start); v != NULL; v = (v->index + 1 < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) if (IsValidVehicle(v))
|
||||
#define FOR_ALL_VEHICLES(v) FOR_ALL_VEHICLES_FROM(v, 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user