mirror of https://github.com/OpenTTD/OpenTTD
(svn r4696) - NewGRF: add support for vehicle variable 0x60, count vehicle type occurance.
parent
a2ce9d7535
commit
26f6659ec0
|
@ -500,6 +500,18 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
||||||
|
|
||||||
case 0x46: /* Motion counter */
|
case 0x46: /* Motion counter */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Variables which use the parameter */
|
||||||
|
case 0x60: /* Count consist's engine ID occurance */
|
||||||
|
if (v->type != VEH_Train) return v->engine_type == parameter;
|
||||||
|
|
||||||
|
{
|
||||||
|
uint count = 0;
|
||||||
|
for (; v != NULL; v = v->next) {
|
||||||
|
if (v->engine_type == parameter) count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General vehicle properties */
|
/* General vehicle properties */
|
||||||
|
|
Loading…
Reference in New Issue