* Param the minimum distance to an edge * @param tile the tile to get the distance from * @return the distance from the edge in tiles */
| 227 | * @return the distance from the edge in tiles |
| 228 | */ |
| 229 | uint DistanceFromEdge(TileIndex tile) |
| 230 | { |
| 231 | const uint xl = TileX(tile); |
| 232 | const uint yl = TileY(tile); |
| 233 | const uint xh = Map::SizeX() - 1 - xl; |
| 234 | const uint yh = Map::SizeY() - 1 - yl; |
| 235 | const uint minl = std::min(xl, yl); |
| 236 | const uint minh = std::min(xh, yh); |
| 237 | return std::min(minl, minh); |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Gets the distance to the edge of the map in given direction. |
no test coverage detected