Add generation of public roads linking towns

This commit is contained in:
Andreas Schmitt
2021-06-12 09:56:59 +02:00
committed by Jonathan G Rennison
parent d718ba62ef
commit 150e502cf9
9 changed files with 690 additions and 4 deletions

View File

@@ -399,6 +399,13 @@ static inline TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
return TILE_ADD(tile, TileOffsByDiagDir(dir));
}
/** Checks if two tiles are adjacent */
static inline bool AreTilesAdjacent(TileIndex a, TileIndex b)
{
return (std::abs((int)TileX(a) - (int)TileX(b)) <= 1) &&
(std::abs((int)TileY(a) - (int)TileY(b)) <= 1);
}
/**
* Determines the DiagDirection to get from one tile to another.
* The tiles do not necessarily have to be adjacent.