Skip to main content

Module placement

Module placement 

Source
Expand description

Building placement (PlacementTool): the footprint under the cursor, whether it may be built and the map stamp of a footprint string. See docs/BUILD-TOOLS.md.

Original: FUN_140102ed0, FUN_1400a2a50, FUN_1400a4aa0, FUN_1400a30f0.

Structs§

PlacementRules
The CreatePlacedDescription and MapDescription values placement reads.
Rect
A cell rectangle, inclusive.

Constants§

HEIGHT_TOLERANCE
Height tolerance placement passes (effectively unlimited).
ROTATION_STEP
Degrees per rotation step.

Functions§

can_place
Whether a building can be placed: every cell of its footprint admits it. This is the test the placement tool makes.
cell_admits
Whether a cell admits a building: its type is in mask, the ground is flat enough and level enough, and its occupant (if any) may be replaced.
footprint
The footprint of a width × height building centred on cell (even sizes extend one more cell towards +x/+y), turned by rotation steps (1 and 3 swap the sides). None when it leaves the map (the left column must also be at least 1).
footprint_cell
One cell of a footprint, as the placement test and the overlay test it: whether it admits the building (with the cell’s mask), and whether its footprint character is . (the cell is not changed, and its zone count is not checked).
footprint_index
Index into a footprint string (rows separated by one character, last row first) of cell (i, j) of a w × h rectangle placed with degrees rotation (w, h are the rotated sides).
stamp
Stamp a footprint. # and an empty footprint set the building’s type, _ sets ground (2); every cell except . records the entity.
zone
Activate a zone: the entity becomes the occupant of every footprint cell that is not ., and each . cell counts one more zone. Not ported: the path grid’s blocked bit (citizens’ mode 0 does not honour it).