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

Function MakeTownHouse

src/town_cmd.cpp:2565–2578  ·  view source on GitHub ↗

* Write house information into the map. For multi-tile houses, all tiles are marked. * @param town The town related to this house * @param t The tile to build on. If a multi-tile house, this is the northern-most tile. * @param counter The counter of the construction stage. * @param stage The current construction stage. * @param The type of house. * @param random_bits Random bits for newgrf h

Source from the content-addressed store, hash-verified

2563 * @pre The house can be built here.
2564 */
2565static void MakeTownHouse(TileIndex tile, Town *t, uint8_t counter, uint8_t stage, HouseID type, uint8_t random_bits, bool is_protected)
2566{
2567 BuildingFlags size = HouseSpec::Get(type)->building_flags;
2568
2569 ClearMakeHouseTile(tile, t, counter, stage, type, random_bits, is_protected);
2570 if (size.Any(BUILDING_2_TILES_Y)) ClearMakeHouseTile(tile + TileDiffXY(0, 1), t, counter, stage, ++type, random_bits, is_protected);
2571 if (size.Any(BUILDING_2_TILES_X)) ClearMakeHouseTile(tile + TileDiffXY(1, 0), t, counter, stage, ++type, random_bits, is_protected);
2572 if (size.Any(BUILDING_HAS_4_TILES)) ClearMakeHouseTile(tile + TileDiffXY(1, 1), t, counter, stage, ++type, random_bits, is_protected);
2573
2574 ForAllStationsAroundTiles(TileArea(tile, size.Any(BUILDING_2_TILES_X) ? 2 : 1, size.Any(BUILDING_2_TILES_Y) ? 2 : 1), [t](Station *st, TileIndex) {
2575 t->stations_near.insert(st);
2576 return true;
2577 });
2578}
2579
2580
2581/**

Callers 1

BuildTownHouseFunction · 0.85

Calls 5

ClearMakeHouseTileFunction · 0.85
TileDiffXYFunction · 0.85
AnyMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected