diff options
author | truelight <truelight@openttd.org> | 2006-08-26 20:09:25 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-26 20:09:25 +0000 |
commit | 96e9fd333bd912c660b129afd6105dd6b1f664fd (patch) | |
tree | be9bb22b74218db0aeaab95cdbe99ced12524a63 /vehicle.h | |
parent | b7fcce091eba6ab8603f7ae10d8952c26015baf7 (diff) | |
download | openttd-96e9fd333bd912c660b129afd6105dd6b1f664fd.tar.xz |
(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.
Diffstat (limited to 'vehicle.h')
-rw-r--r-- | vehicle.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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) |