summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-31 18:00:08 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-31 18:00:08 +0000
commit76b29862c05f0c0cb118b72c80e6e8c8ceb084cf (patch)
tree82914d37ab472f9a830930fcc1dc96af3616159c
parent82bb84d6cc45039cad147672f139931d4e453d23 (diff)
downloadopenttd-76b29862c05f0c0cb118b72c80e6e8c8ceb084cf.tar.xz
(svn r5061) - NewGRF: always use visual effect callback if it is defined, not just for powered wagons.
-rw-r--r--train_cmd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 270b3c233..13f87f874 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -167,14 +167,15 @@ void TrainConsistChanged(Vehicle* v)
if (!IsArticulatedPart(u)) {
// 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)) {
- if (HASBIT(rvi_u->callbackmask, CBM_WAGON_POWER)) {
- uint16 callback = GetVehicleCallback(CBID_TRAIN_WAGON_POWER, 0, 0, u->engine_type, u);
- if (callback != CALLBACK_FAILED)
- u->u.rail.cached_vis_effect = callback;
- }
+ /* Check powered wagon / visual effect callback */
+ if (HASBIT(rvi_u->callbackmask, CBM_WAGON_POWER)) {
+ uint16 callback = GetVehicleCallback(CBID_TRAIN_WAGON_POWER, 0, 0, u->engine_type, u);
+ if (callback != CALLBACK_FAILED) u->u.rail.cached_vis_effect = callback;
+ }
+
+ if ((rvi_v->pow_wag_power != 0) && (rvi_u->flags & RVI_WAGON) && UsesWagonOverride(u)) {
if (u->u.rail.cached_vis_effect < 0x40) {
/* wagon is powered */
SETBIT(u->u.rail.flags, VRF_POWEREDWAGON); // cache 'powered' status