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

Method InitializeLayout

src/town_cmd.cpp:189–197  ·  view source on GitHub ↗

* Assign the town layout. * @param layout The desired layout. If TL_RANDOM, we pick one based on TileHash. */

Source from the content-addressed store, hash-verified

187 * @param layout The desired layout. If TL_RANDOM, we pick one based on TileHash.
188 */
189void Town::InitializeLayout(TownLayout layout)
190{
191 if (layout != TL_RANDOM) {
192 this->layout = layout;
193 return;
194 }
195
196 this->layout = static_cast<TownLayout>(TileHash(TileX(this->xy), TileY(this->xy)) % (NUM_TLS - 1));
197}
198
199/**
200 * Return a random valid town.

Callers 1

DoCreateTownFunction · 0.80

Calls 3

TileHashFunction · 0.85
TileXFunction · 0.85
TileYFunction · 0.85

Tested by

no test coverage detected