Go to the documentation of this file.
10 #ifndef STATION_KDTREE_H
11 #define STATION_KDTREE_H
28 template <
typename Func>
31 uint16 x1, y1, x2, y2;
32 x1 = (uint16)std::max<int>(0,
TileX(center) - radius);
33 x2 = (uint16)std::min<int>(
TileX(center) + radius + 1,
MapSizeX());
34 y1 = (uint16)std::max<int>(0,
TileY(center) - radius);
35 y2 = (uint16)std::min<int>(
TileY(center) + radius + 1,
MapSizeY());
37 _station_kdtree.
FindContained(x1, y1, x2, y2, [&](StationID
id) {
uint32 TileIndex
The index/ID of a Tile.
static Titem * Get(size_t index)
Returns Titem with given index.
K-dimensional tree, specialised for 2-dimensional space.
static Station * Get(size_t index)
Gets station with given index.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
static uint TileX(TileIndex tile)
Get the X component of a tile.
void FindContained(CoordT x1, CoordT y1, CoordT x2, CoordT y2, Outputter outputter) const
Find all items contained within the given rectangle.
static uint MapSizeX()
Get the size of the map along the X.
static uint MapSizeY()
Get the size of the map along the Y.
void ForAllStationsRadius(TileIndex center, uint radius, Func func)
Call a function on all stations whose sign is within a radius of a center tile.
Base class for all station-ish types.