summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-12-19 15:51:55 +0000
committerfrosch <frosch@openttd.org>2009-12-19 15:51:55 +0000
commit9a11aed4bd3dd12988355bd88365a5b7a4b1e540 (patch)
tree8fff66dceaaa806c9cc11a3a57dae586af7d790a /src
parent5c2b6a894376571df03cab5ae659f1888e011e33 (diff)
downloadopenttd-9a11aed4bd3dd12988355bd88365a5b7a4b1e540.tar.xz
(svn r18537) -Fix (r17436): Also do not account cargo in statistics, if it was not accepted.
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 0e574f5d1..c9e9fa572 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -929,23 +929,23 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti
{
assert(num_pieces > 0);
- /* Update company statistics */
- company->cur_economy.delivered_cargo += num_pieces;
- SetBit(company->cargo_types, cargo_type);
-
const Station *st = Station::Get(dest);
- /* Increase town's counter for some special goods types */
- const CargoSpec *cs = CargoSpec::Get(cargo_type);
- if (cs->town_effect == TE_FOOD) st->town->new_act_food += num_pieces;
- if (cs->town_effect == TE_WATER) st->town->new_act_water += num_pieces;
-
/* Give the goods to the industry. */
uint accepted = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == ST_INDUSTRY ? src : INVALID_INDUSTRY);
/* If this cargo type is always accepted, accept all */
if (HasBit(st->always_accepted, cargo_type)) accepted = num_pieces;
+ /* Update company statistics */
+ company->cur_economy.delivered_cargo += accepted;
+ if (accepted > 0) SetBit(company->cargo_types, cargo_type);
+
+ /* Increase town's counter for some special goods types */
+ const CargoSpec *cs = CargoSpec::Get(cargo_type);
+ if (cs->town_effect == TE_FOOD) st->town->new_act_food += accepted;
+ if (cs->town_effect == TE_WATER) st->town->new_act_water += accepted;
+
/* Determine profit */
Money profit = GetTransportedGoodsIncome(accepted, DistanceManhattan(source_tile, st->xy), days_in_transit, cargo_type);