diff options
author | hackykid <hackykid@openttd.org> | 2005-06-03 10:39:30 +0000 |
---|---|---|
committer | hackykid <hackykid@openttd.org> | 2005-06-03 10:39:30 +0000 |
commit | ad2eef0a30832e41dad0e50c96aa364de3732511 (patch) | |
tree | d3f3e4b5c205c4a1d8156cbf146d05b01db0adf6 /train_cmd.c | |
parent | 3f3cbea5c49ccf0293d22066ed810b6daf8b9a54 (diff) | |
download | openttd-ad2eef0a30832e41dad0e50c96aa364de3732511.tar.xz |
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
Diffstat (limited to 'train_cmd.c')
-rw-r--r-- | train_cmd.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/train_cmd.c b/train_cmd.c index 185464b6f..a718fd3dd 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -1326,15 +1326,17 @@ int32 CmdRefitRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (v->cargo_cap != 0) { RailVehicleInfo *rvi = RailVehInfo(v->engine_type); - uint16 amount; - CargoID temp_cid = v->cargo_type; - - /* Check the 'refit capacity' callback */ - v->cargo_type = new_cid; - amount = GetCallBackResult(CB_REFIT_CAP, v->engine_type, v); - v->cargo_type = temp_cid; + uint16 amount = CALLBACK_FAILED; + + if (HASBIT(rvi->callbackmask, CBM_REFIT_CAP)) { + /* Check the 'refit capacity' callback */ + CargoID temp_cid = v->cargo_type; + v->cargo_type = new_cid; + amount = GetCallBackResult(CBID_REFIT_CAP, v->engine_type, v); + v->cargo_type = temp_cid; + } - if (amount == CALLBACK_FAILED) { // callback failed, use default + if (amount == CALLBACK_FAILED) { // callback failed or not used, use default CargoID old_cid = rvi->cargo_type; /* normally, the capacity depends on the cargo type, a rail vehicle * can carry twice as much mail/goods as normal cargo, |