OpenTTD Source
1.11.0-beta2
|
A simple matrix that stores one value per N*N square of the map. More...
#include <tilematrix_type.hpp>
Public Member Functions | |
const TileArea & | GetArea () const |
Get the total covered area. More... | |
void | Add (TileIndex tile) |
Extend the coverage area to include a tile. More... | |
T * | Get (TileIndex tile) |
Get the value associated to a tile index. More... | |
T & | operator[] (TileIndex tile) |
Array access operator, see Get. | |
Static Public Member Functions | |
static TileArea | GetAreaForTile (TileIndex tile, uint extend=0) |
Get the area of the matrix square that contains a specific tile. More... | |
Data Fields | |
TileArea | area |
Area covered by the matrix. | |
T * | data |
Pointer to data array. | |
Static Public Attributes | |
static const uint | GRID = N |
Private Member Functions | |
void | AllocateStorage (TileIndex tile) |
Allocates space for a new tile in the matrix. More... | |
A simple matrix that stores one value per N*N square of the map.
Storage is only allocated for the part of the map that has values assigned.
T | The type of the stored items. |
N | Grid size. |
Definition at line 27 of file tilematrix_type.hpp.
|
inline |
Extend the coverage area to include a tile.
tile | The tile to include. |
Definition at line 114 of file tilematrix_type.hpp.
References TileMatrix< T, N >::AllocateStorage(), and OrthogonalTileArea::Contains().
|
inlineprivate |
Allocates space for a new tile in the matrix.
tile | Tile to add. |
Definition at line 32 of file tilematrix_type.hpp.
References TileMatrix< T, N >::area, OrthogonalTileArea::tile, and TileX().
Referenced by TileMatrix< T, N >::Add().
|
inline |
Get the value associated to a tile index.
tile | The tile to get the value for. |
Definition at line 126 of file tilematrix_type.hpp.
|
inline |
Get the total covered area.
Definition at line 81 of file tilematrix_type.hpp.
References TileMatrix< T, N >::area.
|
inlinestatic |
Get the area of the matrix square that contains a specific tile.
tile | The tile to get the map area for. |
extend | Extend the area by this many squares on all sides. |
Definition at line 92 of file tilematrix_type.hpp.
References TileX().