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

Function DistanceMax

src/map.cpp:201–206  ·  view source on GitHub ↗

* Gets the biggest distance component (x or y) between the two given tiles. * Also known as L-Infinity-Norm. * @param t0 the start tile * @param t1 the end tile * @return the distance */

Source from the content-addressed store, hash-verified

199 * @return the distance
200 */
201uint DistanceMax(TileIndex t0, TileIndex t1)
202{
203 const uint dx = Delta(TileX(t0), TileX(t1));
204 const uint dy = Delta(TileY(t0), TileY(t1));
205 return std::max(dx, dy);
206}
207
208
209/**

Callers 6

CheckIfIndustryIsAllowedFunction · 0.85
GenerateStationNameFunction · 0.85
FindStationsNearbyFunction · 0.85
AddIndustryToDeliverMethod · 0.85
DistanceMaxMethod · 0.85

Calls 3

DeltaFunction · 0.85
TileXFunction · 0.85
TileYFunction · 0.85

Tested by

no test coverage detected