QcPlaceSearch Namespace
Helpers for searching places region by region (decision E-911). More...
| Header: | #include <worldgen/generators/QcLocatedPlace.h> |
Functions
| double | distance(QcBlockPos a, QcBlockPos b) |
| QcLocateResult | nearestInRegions(QcBlockPos from, int reach, int regionSize, qsizetype maxRegions, const PlaceOf &placeOf) |
| double | regionDistance(QcBlockPos from, int regionX, int regionZ, int regionSize) |
Detailed Description
Function Documentation
double QcPlaceSearch::distance(QcBlockPos a, QcBlockPos b)
Returns the horizontal distance (x and z) between a and b.
template <typename PlaceOf> QcLocateResult QcPlaceSearch::nearestInRegions(QcBlockPos from, int reach, int regionSize, qsizetype maxRegions, const PlaceOf &placeOf)
Returns the place nearest to from within reach blocks of the places regions of regionSize blocks hold, at most one each and inside it (placeOf gives it as placeOf(regionX, regionZ), std::optional<QcLocatedPlace>): regions are asked nearest first, and the search ends at the first region farther away than the best place so far, so planning a region (which may be costly, a mine shaft's) happens for a few regions only. At most maxRegions regions are asked: a miss would otherwise plan every region within reach on the caller's thread (the tick for /locate).
double QcPlaceSearch::regionDistance(QcBlockPos from, int regionX, int regionZ, int regionSize)
Returns the horizontal distance from from to the nearest column of region (regionX, regionZ), with regions of regionSize blocks.