* Get a tile from the virtual XY-coordinate. * Coordinates outside of the map are clamped to the map edge. * @param x The virtual x coordinate of the tile. * @param y The virtual y coordinate of the tile. * @return The TileIndex calculated by the coordinate, clamped to the map bounds. */
| 82 | * @return The TileIndex calculated by the coordinate, clamped to the map bounds. |
| 83 | */ |
| 84 | TileIndex TileVirtXYClampedToMap(int x, int y) |
| 85 | { |
| 86 | return TileIndex{(static_cast<uint>(Clamp<int>(y / static_cast<int>(TILE_SIZE), 0, Map::MaxY())) << Map::LogX()) + static_cast<uint>(Clamp<int>(x / static_cast<int>(TILE_SIZE), 0, Map::MaxX()))}; |
| 87 | } |
| 88 | |
| 89 | #ifdef _DEBUG |
| 90 | TileIndex TileAdd(TileIndex tile, TileIndexDiff offset) |
no outgoing calls
no test coverage detected