MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DistanceMaxPlusManhattan

Function DistanceMaxPlusManhattan

src/map.cpp:217–222  ·  view source on GitHub ↗

* Gets the biggest distance component (x or y) between the two given tiles * plus the Manhattan distance, i.e. two times the biggest distance component * and once the smallest component. * @param t0 the start tile * @param t1 the end tile * @return the distance */

Source from the content-addressed store, hash-verified

215 * @return the distance
216 */
217uint DistanceMaxPlusManhattan(TileIndex t0, TileIndex t1)
218{
219 const uint dx = Delta(TileX(t0), TileX(t1));
220 const uint dy = Delta(TileY(t0), TileY(t1));
221 return dx > dy ? 2 * dx + dy : 2 * dy + dx;
222}
223
224/**
225 * Param the minimum distance to an edge

Callers 3

DijkstraMethod · 0.85
CalcDemandMethod · 0.85
DemandCalculatorMethod · 0.85

Calls 3

DeltaFunction · 0.85
TileXFunction · 0.85
TileYFunction · 0.85

Tested by

no test coverage detected