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

Function AdvanceSingleHouseConstruction

src/town_cmd.cpp:493–510  ·  view source on GitHub ↗

* Helper function for house construction stage progression. * @param tile TileIndex of the house (or parts of it) to construct. */

Source from the content-addressed store, hash-verified

491 * @param tile TileIndex of the house (or parts of it) to construct.
492 */
493static void AdvanceSingleHouseConstruction(TileIndex tile)
494{
495 assert(IsTileType(tile, MP_HOUSE));
496
497 /* Progress in construction stages */
498 IncHouseConstructionTick(tile);
499 if (GetHouseConstructionTick(tile) != 0) return;
500
501 TriggerHouseAnimation_ConstructionStageChanged(tile, false);
502
503 if (IsHouseCompleted(tile)) {
504 /* Now that construction is complete, we can add the population of the
505 * building to the town. */
506 ChangePopulation(Town::GetByTile(tile), HouseSpec::Get(GetHouseType(tile))->population);
507 ResetHouseAge(tile);
508 }
509 MarkTileDirtyByTile(tile);
510}
511
512/**
513 * Increase the construction stage of a house.

Callers 1

AdvanceHouseConstructionFunction · 0.85

Calls 9

IsTileTypeFunction · 0.85
IncHouseConstructionTickFunction · 0.85
GetHouseConstructionTickFunction · 0.85
IsHouseCompletedFunction · 0.85
ChangePopulationFunction · 0.85
GetHouseTypeFunction · 0.85
ResetHouseAgeFunction · 0.85
MarkTileDirtyByTileFunction · 0.70

Tested by

no test coverage detected