mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r8327) -Codechange: though overloading, IsPlayerBuildableVehicleType() now works with the type given as a byte as well as a vehicle pointer
This commit is contained in:
parent
61eef2ded9
commit
b7af27911e
@ -407,9 +407,9 @@ static inline void DeleteVehicle(Vehicle *v)
|
|||||||
v->type = 0;
|
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_Train:
|
||||||
case VEH_Road:
|
case VEH_Road:
|
||||||
case VEH_Ship:
|
case VEH_Ship:
|
||||||
@ -419,6 +419,11 @@ static inline bool IsPlayerBuildableVehicleType(const Vehicle *v)
|
|||||||
return false;
|
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_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)
|
#define FOR_ALL_VEHICLES(v) FOR_ALL_VEHICLES_FROM(v, 0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user