summaryrefslogtreecommitdiff
path: root/newgrf_engine.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-23 19:36:50 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-23 19:36:50 +0000
commitae8f4f8d9abcda1f97ddc24287e17fb3d0625cb1 (patch)
tree0a6763c15d5e8720e420227ac8f6cde7eb2c90da /newgrf_engine.c
parentf6c5b3e78aee5bad9f61002b2fe8aeb42ba2cd5a (diff)
downloadopenttd-ae8f4f8d9abcda1f97ddc24287e17fb3d0625cb1.tar.xz
(svn r4960) - NewGRF: explicitly handle unsupported variables, instead of returning -1.
Diffstat (limited to 'newgrf_engine.c')
-rw-r--r--newgrf_engine.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/newgrf_engine.c b/newgrf_engine.c
index e4c3074c2..79abce13c 100644
--- a/newgrf_engine.c
+++ b/newgrf_engine.c
@@ -476,7 +476,7 @@ static void VehicleSetTriggers(const ResolverObject *object, int triggers)
}
-static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, byte parameter)
+static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
{
const Vehicle *v = GRV(object);
@@ -487,8 +487,10 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
case 0x46: return 0; /* Motion counter */
case 0xC4: return _cur_year; /* Build year */
case 0xDA: return INVALID_VEHICLE; /* Next vehicle */
- default: return -1;
}
+
+ *available = false;
+ return -1;
}
/* Calculated vehicle parameters */
@@ -719,6 +721,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
DEBUG(grf, 1)("Unhandled vehicle property 0x%X, type 0x%X", variable, v->type);
+ *available = false;
return -1;
}