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

Function TileIndexToTileIndexDiffC

src/map_func.h:544–552  ·  view source on GitHub ↗

* Returns the diff between two tiles * * @param tile_a from tile * @param tile_b to tile * @return the difference between tila_a and tile_b */

Source from the content-addressed store, hash-verified

542 * @return the difference between tila_a and tile_b
543 */
544inline TileIndexDiffC TileIndexToTileIndexDiffC(TileIndex tile_a, TileIndex tile_b)
545{
546 TileIndexDiffC difference;
547
548 difference.x = TileX(tile_a) - TileX(tile_b);
549 difference.y = TileY(tile_a) - TileY(tile_b);
550
551 return difference;
552}
553
554/* Functions to calculate distances */
555uint DistanceManhattan(TileIndex, TileIndex); ///< also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)

Callers 5

TileLoop_TownFunction · 0.85
GetTownRoadGridElementFunction · 0.85

Calls 2

TileXFunction · 0.85
TileYFunction · 0.85

Tested by

no test coverage detected