Mercurial > hg > openttd
changeset 12944:75ae91d09b03 draft
(svn r17437) -Change: don't accept cargo produced in the same industry (generalise and improve the check used only for valuables)
author | smatz <smatz@openttd.org> |
---|---|
date | Sun, 06 Sep 2009 22:05:53 +0000 |
parents | 049765007dc0 |
children | ed3f74f03e25 |
files | src/economy.cpp |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/economy.cpp +++ b/src/economy.cpp @@ -823,10 +823,6 @@ } } - /* zero the distance (thus income) if it's the bank and very short transport. */ - if (_settings_game.game_creation.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10) return 0; - - static const int MIN_TIME_FACTOR = 31; static const int MAX_TIME_FACTOR = 255; @@ -861,7 +857,7 @@ * @param nun_pieces Amount of cargo delivered * @return actually accepted pieces of cargo */ -static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint num_pieces) +static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint num_pieces, IndustryID source) { /* Find the nearest industrytile to the station sign inside the catchment area, whose industry accepts the cargo. * This fails in three cases: @@ -874,6 +870,8 @@ for (uint i = 0; i < st->industries_near.Length() && num_pieces != 0; i++) { Industry *ind = st->industries_near[i]; + if (ind->index == source) continue; + const IndustrySpec *indspec = GetIndustrySpec(ind->type); uint cargo_index; @@ -929,7 +927,7 @@ 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); + uint accepted = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == ST_INDUSTRY ? src : INVALID_INDUSTRY); /* Determine profit */ Money profit = GetTransportedGoodsIncome(accepted, DistanceManhattan(source_tile, st->xy), days_in_transit, cargo_type);