10 #ifndef STATION_KDTREE_H 11 #define STATION_KDTREE_H 20 extern StationKdtree _station_kdtree;
28 template <
typename Func>
31 uint16 x1, y1, x2, y2;
32 x1 = (uint16)max<int>(0,
TileX(center) - radius);
33 x2 = (uint16)min<int>(
TileX(center) + radius + 1,
MapSizeX());
34 y1 = (uint16)max<int>(0,
TileY(center) - radius);
35 y2 = (uint16)min<int>(
TileY(center) + radius + 1,
MapSizeY());
37 _station_kdtree.
FindContained(x1, y1, x2, y2, [&](StationID
id) {
static uint MapSizeX()
Get the size of the map along the X.
static uint MapSizeY()
Get the size of the map along the Y.
static Titem * Get(size_t index)
Returns Titem with given index.
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.
void ForAllStationsRadius(TileIndex center, uint radius, Func func)
Call a function on all stations whose sign is within a radius of a center tile.
Functions related to maps.
K-d tree template specialised for 2-dimensional Manhattan geometry.
uint32 TileIndex
The index/ID of a Tile.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
K-dimensional tree, specialised for 2-dimensional space.
Base classes/functions for stations.
static Station * Get(size_t index)
Gets station with given index.
Base class for all station-ish types.