MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MakeIndustryTileBigger

Function MakeIndustryTileBigger

src/industry_cmd.cpp:751–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751static void MakeIndustryTileBigger(TileIndex tile)
752{
753 uint8_t cnt = GetIndustryConstructionCounter(tile) + 1;
754 if (cnt != 4) {
755 SetIndustryConstructionCounter(tile, cnt);
756 return;
757 }
758
759 uint8_t stage = GetIndustryConstructionStage(tile) + 1;
760 SetIndustryConstructionCounter(tile, 0);
761 SetIndustryConstructionStage(tile, stage);
762 TriggerIndustryTileAnimation_ConstructionStageChanged(tile, false);
763 if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile);
764
765 MarkTileDirtyByTile(tile);
766
767 if (!IsIndustryCompleted(tile)) return;
768
769 IndustryGfx gfx = GetIndustryGfx(tile);
770 if (gfx >= NEW_INDUSTRYTILEOFFSET) {
771 /* New industries are already animated on construction. */
772 return;
773 }
774
775 switch (gfx) {
776 case GFX_POWERPLANT_CHIMNEY:
777 CreateChimneySmoke(tile);
778 break;
779
780 case GFX_OILRIG_1: {
781 /* Do not require an industry tile to be after the first two GFX_OILRIG_1
782 * tiles (like the default oil rig). Do a proper check to ensure the
783 * tiles belong to the same industry and based on that build the oil rig's
784 * station. */
785 TileIndex other = tile + TileDiffXY(0, 1);
786
787 if (IsTileType(other, MP_INDUSTRY) &&
788 GetIndustryGfx(other) == GFX_OILRIG_1 &&
789 GetIndustryIndex(tile) == GetIndustryIndex(other)) {
790 BuildOilRig(tile);
791 }
792 break;
793 }
794
795 case GFX_TOY_FACTORY:
796 case GFX_BUBBLE_CATCHER:
797 case GFX_TOFFEE_QUARRY:
798 SetAnimationFrame(tile, 0);
799 SetIndustryAnimationLoop(tile, 0);
800 break;
801
802 case GFX_PLASTIC_FOUNTAIN_ANIMATED_1: case GFX_PLASTIC_FOUNTAIN_ANIMATED_2:
803 case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4:
804 case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
805 case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
806 AddAnimatedTile(tile, false);
807 break;
808 }

Callers 1

TileLoop_IndustryFunction · 0.85

Calls 15

SetIndustryCompletedFunction · 0.85
IsIndustryCompletedFunction · 0.85
GetIndustryGfxFunction · 0.85
CreateChimneySmokeFunction · 0.85
TileDiffXYFunction · 0.85
IsTileTypeFunction · 0.85
GetIndustryIndexFunction · 0.85

Tested by

no test coverage detected