summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2017-03-13 07:37:05 +0000
committerpeter1138 <peter1138@openttd.org>2017-03-13 07:37:05 +0000
commitd31f9a83e731f9c450d2849cf048263b054bfe35 (patch)
treee3f7ed5575277fa1b3585d7bce1e95b8a6c30dab
parent86eae807be8d93680e0adcb92fea2cc4d80972d6 (diff)
downloadopenttd-d31f9a83e731f9c450d2849cf048263b054bfe35.tar.xz
(svn r27788) -Fix [FS#6536]: Get vehicle load amount after executing new cargo trigger.
-rw-r--r--src/economy.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index cdfa059e8..7461d34b7 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1643,13 +1643,11 @@ static void LoadUnloadVehicle(Vehicle *front)
if (v->cargo_cap == 0) continue;
artic_part++;
- uint load_amount = GetLoadAmount(v);
-
GoodsEntry *ge = &st->goods[v->cargo_type];
if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (front->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) {
uint cargo_count = v->cargo.UnloadCount();
- uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
+ uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, GetLoadAmount(v)) : cargo_count;
bool remaining = false; // Are there cargo entities in this vehicle that can still be unloaded here?
assert(payment != NULL);
@@ -1754,8 +1752,8 @@ static void LoadUnloadVehicle(Vehicle *front)
* has capacity for it, load it on the vehicle. */
uint cap_left = v->cargo_cap - v->cargo.StoredCount();
if (cap_left > 0 && (v->cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0 || ge->cargo.AvailableCount() > 0)) {
- if (_settings_game.order.gradual_loading) cap_left = min(cap_left, load_amount);
if (v->cargo.StoredCount() == 0) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
+ if (_settings_game.order.gradual_loading) cap_left = min(cap_left, GetLoadAmount(v));
uint loaded = ge->cargo.Load(cap_left, &v->cargo, st->xy, next_station);
if (v->cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) {