summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-11-15 21:06:13 +0000
committersmatz <smatz@openttd.org>2009-11-15 21:06:13 +0000
commit47660b984b3c2eb80ac41e265b4cc9399300f0c2 (patch)
treec1e81a6e2e338a84bf92264e3fd2bf9a8cdcb2ca /src/industry_cmd.cpp
parente41c2e128bb8177613d664eddee9f7396d6ae842 (diff)
downloadopenttd-47660b984b3c2eb80ac41e265b4cc9399300f0c2.tar.xz
(svn r18110) -Codechange [FS#3316]: search for stations nearby only once per producer (instead of once pre produced cargo type) (fonsinchen)
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 7080ac4a8..5e0ad84db 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -507,6 +507,8 @@ static void TransportIndustryGoods(TileIndex tile)
const IndustrySpec *indspec = GetIndustrySpec(i->type);
bool moved_cargo = false;
+ StationFinder stations(i->xy, i->width, i->height);
+
for (uint j = 0; j < lengthof(i->produced_cargo_waiting); j++) {
uint cw = min(i->produced_cargo_waiting[j], 255);
if (cw > indspec->minimal_cargo && i->produced_cargo[j] != CT_INVALID) {
@@ -517,7 +519,7 @@ static void TransportIndustryGoods(TileIndex tile)
i->this_month_production[j] += cw;
- uint am = MoveGoodsToStation(i->xy, i->width, i->height, i->produced_cargo[j], cw, ST_INDUSTRY, i->index);
+ uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, stations.GetStations());
i->this_month_transported[j] += am;
moved_cargo |= (am != 0);