| 831 | } |
| 832 | |
| 833 | static void TileLoop_Industry(TileIndex tile) |
| 834 | { |
| 835 | if (IsTileOnWater(tile)) TileLoop_Water(tile); |
| 836 | |
| 837 | /* Normally this doesn't happen, but if an industry NewGRF is removed |
| 838 | * an industry that was previously build on water can now be flooded. |
| 839 | * If this happens the tile is no longer an industry tile after |
| 840 | * returning from TileLoop_Water. */ |
| 841 | if (!IsTileType(tile, MP_INDUSTRY)) return; |
| 842 | |
| 843 | TriggerIndustryTileRandomisation(tile, IndustryRandomTrigger::TileLoop); |
| 844 | |
| 845 | if (!IsIndustryCompleted(tile)) { |
| 846 | MakeIndustryTileBigger(tile); |
| 847 | return; |
| 848 | } |
| 849 | |
| 850 | if (_game_mode == GM_EDITOR) return; |
| 851 | |
| 852 | if (TransportIndustryGoods(tile) && !TriggerIndustryAnimation(Industry::GetByTile(tile), IndustryAnimationTrigger::CargoDistributed)) { |
| 853 | uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production; |
| 854 | |
| 855 | if (newgfx != INDUSTRYTILE_NOANIM) { |
| 856 | ResetIndustryConstructionStage(tile); |
| 857 | SetIndustryCompleted(tile); |
| 858 | SetIndustryGfx(tile, newgfx); |
| 859 | MarkTileDirtyByTile(tile); |
| 860 | return; |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | if (TriggerIndustryTileAnimation(tile, IndustryAnimationTrigger::TileLoop)) return; |
| 865 | |
| 866 | IndustryGfx newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next; |
| 867 | if (newgfx != INDUSTRYTILE_NOANIM) { |
| 868 | ResetIndustryConstructionStage(tile); |
| 869 | SetIndustryGfx(tile, newgfx); |
| 870 | MarkTileDirtyByTile(tile); |
| 871 | return; |
| 872 | } |
| 873 | |
| 874 | IndustryGfx gfx = GetIndustryGfx(tile); |
| 875 | switch (gfx) { |
| 876 | case GFX_COAL_MINE_TOWER_NOT_ANIMATED: |
| 877 | case GFX_COPPER_MINE_TOWER_NOT_ANIMATED: |
| 878 | case GFX_GOLD_MINE_TOWER_NOT_ANIMATED: |
| 879 | if (!(TimerGameTick::counter & 0x400) && Chance16(1, 2)) { |
| 880 | switch (gfx) { |
| 881 | case GFX_COAL_MINE_TOWER_NOT_ANIMATED: gfx = GFX_COAL_MINE_TOWER_ANIMATED; break; |
| 882 | case GFX_COPPER_MINE_TOWER_NOT_ANIMATED: gfx = GFX_COPPER_MINE_TOWER_ANIMATED; break; |
| 883 | case GFX_GOLD_MINE_TOWER_NOT_ANIMATED: gfx = GFX_GOLD_MINE_TOWER_ANIMATED; break; |
| 884 | } |
| 885 | SetIndustryGfx(tile, gfx); |
| 886 | SetAnimationFrame(tile, 0x80); |
| 887 | AddAnimatedTile(tile); |
| 888 | } |
| 889 | break; |
| 890 |
nothing calls this directly
no test coverage detected