Skip to main content

Module grid

Module grid 

Source
Expand description

Grid geometry: positions, the four directions, a rectangular grid and sets of its tiles, and the terrain a tile is.

Structs§

Grid
A width × height rectangle of cells, stored row-major. The cell count always equals width * height; deserialising checks it.
GridSizeError
A saved grid whose cell count is not width * height.
Pos
A tile position. Signed so neighbour maths can go negative before bounds checks; (0, 0) is the top-left tile, x grows right, y grows down.
TerrainId
A terrain: its index in the game’s table of terrains. The engine knows no terrain of its own; a game’s map is a Grid of these, and its skins look each one up in the game’s table.
TileSet
A set of tiles of a width × height map, stored as a bitset. Iterates in row-major order. Positions outside the map are never members.

Enums§

Dir
One of the four grid directions.