summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2017-11-25 16:50:28 +0000
committerfrosch <frosch@openttd.org>2017-11-25 16:50:28 +0000
commit6347e5f11e6e8a05380b465571b1a339f1bec50e (patch)
tree02f3659cf3e8f2eb119b26460a5a33888ef206d0
parent2202544474b02913efeb685026d02c4c5adc827b (diff)
downloadopenttd-6347e5f11e6e8a05380b465571b1a339f1bec50e.tar.xz
(svn r27932) -Fix (r0) [FS#6639]: Forest, candyfloss forest and battery farm skipped the first animation frame.
-rw-r--r--src/industry_cmd.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 8fea6953a..9c98b120c 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -491,7 +491,12 @@ static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlag flags)
return CommandCost(EXPENSES_CONSTRUCTION, indspec->GetRemovalCost());
}
-static void TransportIndustryGoods(TileIndex tile)
+/**
+ * Move produced cargo from industry to nearby stations.
+ * @param tile Industry tile
+ * @return true if any cargo was moved.
+ */
+static bool TransportIndustryGoods(TileIndex tile)
{
Industry *i = Industry::GetByTile(tile);
const IndustrySpec *indspec = GetIndustrySpec(i->type);
@@ -516,16 +521,7 @@ static void TransportIndustryGoods(TileIndex tile)
}
}
- if (moved_cargo && !StartStopIndustryTileAnimation(i, IAT_INDUSTRY_DISTRIBUTES_CARGO)) {
- uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
-
- if (newgfx != INDUSTRYTILE_NOANIM) {
- ResetIndustryConstructionStage(tile);
- SetIndustryCompleted(tile);
- SetIndustryGfx(tile, newgfx);
- MarkTileDirtyByTile(tile);
- }
- }
+ return moved_cargo;
}
@@ -810,7 +806,17 @@ static void TileLoop_Industry(TileIndex tile)
if (_game_mode == GM_EDITOR) return;
- TransportIndustryGoods(tile);
+ if (TransportIndustryGoods(tile) && !StartStopIndustryTileAnimation(Industry::GetByTile(tile), IAT_INDUSTRY_DISTRIBUTES_CARGO)) {
+ uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
+
+ if (newgfx != INDUSTRYTILE_NOANIM) {
+ ResetIndustryConstructionStage(tile);
+ SetIndustryCompleted(tile);
+ SetIndustryGfx(tile, newgfx);
+ MarkTileDirtyByTile(tile);
+ return;
+ }
+ }
if (StartStopIndustryTileAnimation(tile, IAT_TILELOOP)) return;