summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-12-09 16:12:38 +0000
committeryexo <yexo@openttd.org>2011-12-09 16:12:38 +0000
commit2b1a3809024d5ad6cd947c268f644e45e57b09ce (patch)
tree065e2692e4a9b96654ad2aa16f6645e73e3aee9f
parent6aae285b72bfe5612ccfc59f75fe51ee557086cd (diff)
downloadopenttd-2b1a3809024d5ad6cd947c268f644e45e57b09ce.tar.xz
(svn r23458) -Fix: don't assume all industries that cut trees have tile 0,0
-Fix: wait until all tiles of an industry are completed before starting to cut trees
-rw-r--r--src/industry_cmd.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 55a991968..c74a4d7f5 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1076,10 +1076,14 @@ static bool SearchLumberMillTrees(TileIndex tile, void *user_data)
*/
static void ChopLumberMillTrees(Industry *i)
{
- TileIndex tile = i->location.tile;
-
- if (!IsIndustryCompleted(tile)) return; // Can't proceed if not completed.
+ /* We only want to cut trees if all tiles are completed. */
+ TILE_AREA_LOOP(tile_cur, i->location) {
+ if (i->TileBelongsToIndustry(tile_cur)) {
+ if (!IsIndustryCompleted(tile_cur)) return;
+ }
+ }
+ TileIndex tile = i->location.tile;
if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, NULL)) { // 40x40 tiles to search.
i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + 45); // Found a tree, add according value to waiting cargo.
}