Mercurial > hg > openttd
changeset 12072:3b2c0d71a279 draft
(svn r16479) -Fix (r5146): Call callbacks after initialisation of vehicle variables.
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 31 May 2009 11:31:10 +0000 |
parents | a50b1fcac71b |
children | 02d3a628e6db |
files | src/aircraft_cmd.cpp |
diffstat | 1 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -333,24 +333,6 @@ u->subtype = AIR_SHADOW; u->UpdateDeltaXY(INVALID_DIR); - if (v->cargo_type != CT_PASSENGERS) { - uint16 callback = CALLBACK_FAILED; - - if (HasBit(EngInfo(p1)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) { - callback = GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, v->engine_type, v); - } - - if (callback == CALLBACK_FAILED) { - /* Callback failed, or not executed; use the default cargo capacity */ - v->cargo_cap = AircraftDefaultCargoCapacity(v->cargo_type, avi); - } else { - v->cargo_cap = callback; - } - - /* Set the 'second compartent' capacity to none */ - u->cargo_cap = 0; - } - v->reliability = e->reliability; v->reliability_spd_dec = e->reliability_spd_dec; v->max_age = e->lifelength * DAYS_IN_LEAP_YEAR; @@ -391,6 +373,24 @@ v->vehicle_flags = 0; if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); + if (v->cargo_type != CT_PASSENGERS) { + uint16 callback = CALLBACK_FAILED; + + if (HasBit(EngInfo(p1)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) { + callback = GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, v->engine_type, v); + } + + if (callback == CALLBACK_FAILED) { + /* Callback failed, or not executed; use the default cargo capacity */ + v->cargo_cap = AircraftDefaultCargoCapacity(v->cargo_type, avi); + } else { + v->cargo_cap = callback; + } + + /* Set the 'second compartent' capacity to none */ + u->cargo_cap = 0; + } + UpdateAircraftCache(v); VehicleMove(v, false);