1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-15 08:22:34 +01:00

Change: [NewGRF] Animation-trigger 'construction stage changed' of houses and industries now also triggers at construction start. (#14089)

This commit is contained in:
frosch
2025-04-26 14:42:49 +02:00
committed by GitHub
parent 365eed533d
commit 0d9074769d
6 changed files with 29 additions and 5 deletions

View File

@@ -763,7 +763,7 @@ static void MakeIndustryTileBigger(TileIndex tile)
uint8_t stage = GetIndustryConstructionStage(tile) + 1;
SetIndustryConstructionCounter(tile, 0);
SetIndustryConstructionStage(tile, stage);
TriggerIndustryTileAnimation(tile, IndustryAnimationTrigger::ConstructionStageChanged);
TriggerIndustryTileAnimation_ConstructionStageChanged(tile, false);
if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile);
MarkTileDirtyByTile(tile);
@@ -1946,6 +1946,15 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
}
}
/* Call callbacks after all tiles have been created. */
for (TileIndex cur_tile : i->location) {
if (i->TileBelongsToIndustry(cur_tile)) {
/* There are no shared random bits, consistent with "MakeIndustryTileBigger" in tile loop.
* So, trigger tiles individually */
TriggerIndustryTileAnimation_ConstructionStageChanged(cur_tile, true);
}
}
if (GetIndustrySpec(i->type)->behaviour.Test(IndustryBehaviour::PlantOnBuild)) {
for (uint j = 0; j != 50; j++) PlantRandomFarmField(i);
}