diff options
author | frosch <frosch@openttd.org> | 2008-12-13 18:25:42 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-12-13 18:25:42 +0000 |
commit | fab1a52963859f96b46528ee67d187a15dcbd3e2 (patch) | |
tree | 0890693cd16487b25fae0ddc78f9d2f07a83bc94 /src | |
parent | d2a050bb29c19d22d8f511e0ae71e894608693ff (diff) | |
download | openttd-fab1a52963859f96b46528ee67d187a15dcbd3e2.tar.xz |
(svn r14672) -Fix [FS#2444]: Property 7 and callback 12 were broken for aircraft.
Now callback 12 is properly called also for 'mail'.
If the callback is not used, 'mail' uses 1/4 of property 7 (rounded up).
Diffstat (limited to 'src')
-rw-r--r-- | src/aircraft_cmd.cpp | 2 | ||||
-rw-r--r-- | src/economy.cpp | 4 | ||||
-rw-r--r-- | src/openttd.cpp | 10 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index ae7939195..85d96b42c 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -342,6 +342,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) v->max_speed = avi->max_speed; v->acceleration = avi->acceleration; v->engine_type = p1; + u->engine_type = p1; v->subtype = (avi->subtype & AIR_CTOL ? AIR_AIRCRAFT : AIR_HELICOPTER); v->UpdateDeltaXY(INVALID_DIR); @@ -427,6 +428,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) Vehicle *w = vl[2]; w = new (w) Aircraft(); + w->engine_type = p1; w->direction = DIR_N; w->owner = _current_company; w->x_pos = v->x_pos; diff --git a/src/economy.cpp b/src/economy.cpp index cf36d0945..9985c791c 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1603,6 +1603,10 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) if (v->cargo_cap == 0) continue; byte load_amount = EngInfo(v->engine_type)->load_amount; + + /* The default loadamount for mail is 1/4 of the load amount for passengers */ + if (v->type == VEH_AIRCRAFT && !IsNormalAircraft(v)) load_amount = (load_amount + 3) / 4; + if (_settings_game.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) { uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v); if (cb_load_amount != CALLBACK_FAILED && GB(cb_load_amount, 0, 8) != 0) load_amount = GB(cb_load_amount, 0, 8); diff --git a/src/openttd.cpp b/src/openttd.cpp index ea56b0c58..33ad8e555 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2593,6 +2593,16 @@ bool AfterLoadGame() } } + if (CheckSavegameVersion(103)) { + Vehicle *v; + FOR_ALL_VEHICLES(v) { + /* Set engine_type of shadow and rotor */ + if (v->type == VEH_AIRCRAFT && !IsNormalAircraft(v)) { + v->engine_type = v->First()->engine_type; + } + } + } + GamelogPrintDebug(1); return InitializeWindowsAndCaches(); |