summaryrefslogtreecommitdiff
path: root/src/unmovable_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/unmovable_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/unmovable_cmd.cpp')
-rw-r--r--src/unmovable_cmd.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 93ac08998..931d2d7c9 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -344,12 +344,14 @@ static void TileLoop_Unmovable(TileIndex tile)
uint level = GetCompanyHQSize(tile) + 1;
assert(level < 6);
+ StationFinder stations(tile, 2, 2);
+
uint r = Random();
/* Top town buildings generate 250, so the top HQ type makes 256. */
if (GB(r, 0, 8) < (256 / 4 / (6 - level))) {
uint amt = GB(r, 0, 8) / 8 / 4 + 1;
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
- MoveGoodsToStation(tile, 2, 2, CT_PASSENGERS, amt, ST_HEADQUARTERS, GetTileOwner(tile));
+ MoveGoodsToStation(CT_PASSENGERS, amt, ST_HEADQUARTERS, GetTileOwner(tile), stations.GetStations());
}
/* Top town building generates 90, HQ can make up to 196. The
@@ -358,7 +360,7 @@ static void TileLoop_Unmovable(TileIndex tile)
if (GB(r, 8, 8) < (196 / 4 / (6 - level))) {
uint amt = GB(r, 8, 8) / 8 / 4 + 1;
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
- MoveGoodsToStation(tile, 2, 2, CT_MAIL, amt, ST_HEADQUARTERS, GetTileOwner(tile));
+ MoveGoodsToStation(CT_MAIL, amt, ST_HEADQUARTERS, GetTileOwner(tile), stations.GetStations());
}
}