summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-02 20:17:17 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-02 20:17:17 +0000
commit26f6659ec0d8f7c752d12d45cfbfd25a9da05af4 (patch)
tree3c5c92c4a4efb78bfd647b4c0b39e0fd7356a907
parenta2ce9d7535a0055d0f08b4f354aa9a5f6cc42f82 (diff)
downloadopenttd-26f6659ec0d8f7c752d12d45cfbfd25a9da05af4.tar.xz
(svn r4696) - NewGRF: add support for vehicle variable 0x60, count vehicle type occurance.
-rw-r--r--newgrf_engine.c12
1 files changed, 12 insertions, 0 deletions
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 */