Mercurial > hg > openttd
changeset 5775:ec662f1a1e3c draft
(svn r8327) -Codechange: though overloading, IsPlayerBuildableVehicleType() now works with the type given as a byte as well as a vehicle pointer
author | bjarni <bjarni@openttd.org> |
---|---|
date | Sun, 21 Jan 2007 20:08:00 +0000 |
parents | c87bd9bcfe8f |
children | b820f9df1f2d |
files | src/vehicle.h |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vehicle.h +++ b/src/vehicle.h @@ -407,9 +407,9 @@ 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 @@ 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)