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

Function DistanceManhattan

src/map.cpp:169–174  ·  view source on GitHub ↗

* Gets the Manhattan distance between the two given tiles. * The Manhattan distance is the sum of the delta of both the * X and Y component. * Also known as L1-Norm * @param t0 the start tile * @param t1 the end tile * @return the distance */

Source from the content-addressed store, hash-verified

167 * @return the distance
168 */
169uint DistanceManhattan(TileIndex t0, TileIndex t1)
170{
171 const uint dx = Delta(TileX(t0), TileX(t1));
172 const uint dy = Delta(TileY(t0), TileY(t1));
173 return dx + dy;
174}
175
176
177/**

Callers 15

GetOrderDistanceFunction · 0.85
ShipControllerFunction · 0.85
TryMakeRiverTerminusFunction · 0.85
RiverFlowsDownFunction · 0.85
FlowRiverFunction · 0.85
GetVariableMethod · 0.85
CheckSubsidyDistanceFunction · 0.85
GetDistanceMethod · 0.85
GetClosestDeletedStationFunction · 0.85

Calls 3

DeltaFunction · 0.85
TileXFunction · 0.85
TileYFunction · 0.85

Tested by

no test coverage detected