summaryrefslogtreecommitdiff
path: root/src/vehicle.h
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-01-21 20:08:00 +0000
committerbjarni <bjarni@openttd.org>2007-01-21 20:08:00 +0000
commitbdc29f3d0d0093798e437e835dd89958e11b4119 (patch)
tree522eec9c63175be27452b3b3dfeeeeeb0d7df4bc /src/vehicle.h
parentdfd951c34cb97adbab99b08fb82ddb74a8e8827a (diff)
downloadopenttd-bdc29f3d0d0093798e437e835dd89958e11b4119.tar.xz
(svn r8327) -Codechange: though overloading, IsPlayerBuildableVehicleType() now works with the type given as a byte as well as a vehicle pointer
Diffstat (limited to 'src/vehicle.h')
-rw-r--r--src/vehicle.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/vehicle.h b/src/vehicle.h
index 5db0885df..1e23fe78c 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -407,9 +407,9 @@ static inline void DeleteVehicle(Vehicle *v)
v->type = 0;
}
-static inline bool IsPlayerBuildableVehicleType(const Vehicle *v)
+static inline bool IsPlayerBuildableVehicleType(byte type)
{
- switch (v->type) {
+ switch (type) {
case VEH_Train:
case VEH_Road:
case VEH_Ship:
@@ -419,6 +419,11 @@ static inline bool IsPlayerBuildableVehicleType(const Vehicle *v)
return false;
}
+static inline bool IsPlayerBuildableVehicleType(const Vehicle *v)
+{
+ return IsPlayerBuildableVehicleType(v->type);
+}
+
#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)