summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-26 20:38:32 +0000
committerfrosch <frosch@openttd.org>2013-06-26 20:38:32 +0000
commit7c9f0545b45836c5fe2dbd3162f59ad6f461fa66 (patch)
tree72c9f968ef81b9d393bcfb46ba12fdc934e57ddb /src/economy.cpp
parent653a005d1996f735ba0f25e910530793cb7a6729 (diff)
downloadopenttd-7c9f0545b45836c5fe2dbd3162f59ad6f461fa66.tar.xz
(svn r25479) -Fix (r23861): [NewGRF] When cargo NewGRF define a mulitplier to modify vehicle capacities, use the same multiplier to modify loading speed.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index d22d35e6f..77017461f 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1255,13 +1255,14 @@ void PrepareUnload(Vehicle *front_v)
* @param v Vehicle to be queried.
* @return Amount of cargo the vehicle can load at once.
*/
-static byte GetLoadAmount(Vehicle *v)
+static uint GetLoadAmount(Vehicle *v)
{
const Engine *e = v->GetEngine();
byte load_amount = e->info.load_amount;
/* The default loadamount for mail is 1/4 of the load amount for passengers */
- if (v->type == VEH_AIRCRAFT && !Aircraft::From(v)->IsNormalAircraft()) load_amount = CeilDiv(load_amount, 4);
+ bool air_mail = v->type == VEH_AIRCRAFT && !Aircraft::From(v)->IsNormalAircraft();
+ if (air_mail) load_amount = CeilDiv(load_amount, 4);
if (_settings_game.order.gradual_loading) {
uint16 cb_load_amount = CALLBACK_FAILED;
@@ -1281,6 +1282,10 @@ static byte GetLoadAmount(Vehicle *v)
}
}
}
+
+ /* Scale load amount the same as capacity */
+ if (HasBit(e->info.misc_flags, EF_NO_DEFAULT_CARGO_MULTIPLIER) && !air_mail) load_amount = CeilDiv(load_amount * CargoSpec::Get(v->cargo_type)->multiplier, 0x100);
+
return load_amount;
}
@@ -1401,7 +1406,7 @@ static void LoadUnloadVehicle(Vehicle *front)
if (v->cargo_cap == 0) continue;
artic_part++;
- byte load_amount = GetLoadAmount(v);
+ uint load_amount = GetLoadAmount(v);
GoodsEntry *ge = &st->goods[v->cargo_type];