OpenTTD Source 20241224-master-gf74b0cf984
station_kdtree.h File Reference

Declarations for accessing the k-d tree of stations. More...

#include "core/kdtree.hpp"
#include "core/math_func.hpp"
#include "station_base.h"
#include "map_func.h"

Go to the source code of this file.

Data Structures

struct  Kdtree_StationXYFunc
 

Typedefs

using StationKdtree = Kdtree< StationID, Kdtree_StationXYFunc, uint16_t, int >
 

Functions

template<typename Func >
void ForAllStationsRadius (TileIndex center, uint radius, Func func)
 Call a function on all stations whose sign is within a radius of a center tile.
 

Variables

StationKdtree _station_kdtree
 

Detailed Description

Declarations for accessing the k-d tree of stations.

Definition in file station_kdtree.h.

Typedef Documentation

◆ StationKdtree

using StationKdtree = Kdtree<StationID, Kdtree_StationXYFunc, uint16_t, int>

Definition at line 25 of file station_kdtree.h.

Function Documentation

◆ ForAllStationsRadius()

template<typename Func >
void ForAllStationsRadius ( TileIndex  center,
uint  radius,
Func  func 
)

Call a function on all stations whose sign is within a radius of a center tile.

Parameters
centerCentral tile to search around.
radiusDistance in both X and Y to search within.
funcThe function to call, must take a single parameter which is Station*.

Definition at line 35 of file station_kdtree.h.

References Kdtree< T, TxyFunc, CoordT, DistT >::FindContained(), SpecializedStation< Station, false >::Get(), Map::SizeX(), Map::SizeY(), TileX(), and TileY().

Referenced by GetClosestDeletedStation().

Variable Documentation

◆ _station_kdtree

StationKdtree _station_kdtree
extern

Definition at line 39 of file station.cpp.