summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-06 01:31:36 +0000
committerhackykid <hackykid@openttd.org>2005-06-06 01:31:36 +0000
commitf847736b5dd0ce8352f79c5a5df4a9374477c0d5 (patch)
tree88fc075d2f739ad04b138651f1f43d8bd6bdb2aa
parent26e87892e2177a3aa63b159744d824d1fbee5474 (diff)
downloadopenttd-f847736b5dd0ce8352f79c5a5df4a9374477c0d5.tar.xz
(svn r2415) - Fix: [newgrf] Powered Wagons - Don't assume an undefined callback will fail.
-rw-r--r--engine.h1
-rw-r--r--train_cmd.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/engine.h b/engine.h
index 19ea10492..8a78bec28 100644
--- a/engine.h
+++ b/engine.h
@@ -144,6 +144,7 @@ enum CallbackID {
// bit positions for rvi->callbackmask, indicates which callbacks are used by an engine
// (some callbacks are always used, and dont appear here)
enum CallbackMask {
+ CBM_WAGON_POWER = 0,
CBM_REFIT_CAP = 3,
};
diff --git a/train_cmd.c b/train_cmd.c
index d75f58584..0096e43b4 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -79,9 +79,10 @@ void TrainConsistChanged(Vehicle *v) {
// check if its a powered wagon
CLRBIT(u->u.rail.flags, VRF_POWEREDWAGON);
if ((rvi_v->pow_wag_power != 0) && (rvi_u->flags & RVI_WAGON) && UsesWagonOverride(u)) {
- uint16 callback;
+ uint16 callback = CALLBACK_FAILED;
- callback = GetCallBackResult(CBID_WAGON_POWER, u->engine_type, u);
+ if (HASBIT(rvi_u->callbackmask, CBM_WAGON_POWER))
+ callback = GetCallBackResult(CBID_WAGON_POWER, u->engine_type, u);
if (callback == CALLBACK_FAILED)
callback = rvi_u->visual_effect;