summaryrefslogtreecommitdiff
path: root/vehicle.h
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-26 20:09:25 +0000
committertruelight <truelight@openttd.org>2006-08-26 20:09:25 +0000
commit7f84bcc91733848aa829920c2cc77b4dfcacbb6d (patch)
treebe9bb22b74218db0aeaab95cdbe99ced12524a63 /vehicle.h
parenta241ec82c9203d3208701e359b253abb50483c60 (diff)
downloadopenttd-7f84bcc91733848aa829920c2cc77b4dfcacbb6d.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.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/vehicle.h b/vehicle.h
index 694caba50..73bca86b2 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -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)