From 26f6659ec0d8f7c752d12d45cfbfd25a9da05af4 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 2 May 2006 20:17:17 +0000 Subject: (svn r4696) - NewGRF: add support for vehicle variable 0x60, count vehicle type occurance. --- newgrf_engine.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/newgrf_engine.c b/newgrf_engine.c index 16a2f1289..519977c94 100644 --- a/newgrf_engine.c +++ b/newgrf_engine.c @@ -500,6 +500,18 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by case 0x46: /* Motion counter */ 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 */ -- cgit v1.2.3-70-g09d2