mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-21 22:53:19 +00:00
(svn r2415) - Fix: [newgrf] Powered Wagons - Don't assume an undefined callback will fail.
This commit is contained in:
parent
1018d3b786
commit
2fbb96bfa5
1
engine.h
1
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,
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user