mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 05:53:02 +01:00
Coords for map_get_tile* (#10440)
* Make Map::map_get_tile_side() use CoordsXY * Make Map::map_get_tile_quadrant() use CoordsXY
This commit is contained in:
committed by
Michael Steenbeek
parent
e827509786
commit
9ec25e85cb
@@ -1803,7 +1803,7 @@ std::optional<CoordsXY> screen_get_map_xy_quadrant(ScreenCoordsXY screenCoords,
|
||||
if (!mapCoords)
|
||||
return std::nullopt;
|
||||
|
||||
*quadrant = map_get_tile_quadrant(mapCoords->x, mapCoords->y);
|
||||
*quadrant = map_get_tile_quadrant(*mapCoords);
|
||||
return mapCoords->ToTileStart();
|
||||
}
|
||||
|
||||
@@ -1817,7 +1817,7 @@ std::optional<CoordsXY> screen_get_map_xy_quadrant_with_z(ScreenCoordsXY screenC
|
||||
if (!mapCoords)
|
||||
return std::nullopt;
|
||||
|
||||
*quadrant = map_get_tile_quadrant(mapCoords->x, mapCoords->y);
|
||||
*quadrant = map_get_tile_quadrant(*mapCoords);
|
||||
return mapCoords->ToTileStart();
|
||||
}
|
||||
|
||||
@@ -1831,7 +1831,7 @@ std::optional<CoordsXY> screen_get_map_xy_side(ScreenCoordsXY screenCoords, uint
|
||||
if (!mapCoords)
|
||||
return std::nullopt;
|
||||
|
||||
*side = map_get_tile_side(mapCoords->x, mapCoords->y);
|
||||
*side = map_get_tile_side(*mapCoords);
|
||||
return mapCoords->ToTileStart();
|
||||
}
|
||||
|
||||
@@ -1845,7 +1845,7 @@ std::optional<CoordsXY> screen_get_map_xy_side_with_z(ScreenCoordsXY screenCoord
|
||||
if (!mapCoords)
|
||||
return std::nullopt;
|
||||
|
||||
*side = map_get_tile_side(mapCoords->x, mapCoords->y);
|
||||
*side = map_get_tile_side(*mapCoords);
|
||||
return mapCoords->ToTileStart();
|
||||
}
|
||||
|
||||
|
||||
@@ -2043,17 +2043,17 @@ void map_invalidate_region(const CoordsXY& mins, const CoordsXY& maxs)
|
||||
}
|
||||
}
|
||||
|
||||
int32_t map_get_tile_side(int32_t mapX, int32_t mapY)
|
||||
int32_t map_get_tile_side(const CoordsXY& mapPos)
|
||||
{
|
||||
int32_t subMapX = mapX & (32 - 1);
|
||||
int32_t subMapY = mapY & (32 - 1);
|
||||
int32_t subMapX = mapPos.x & (32 - 1);
|
||||
int32_t subMapY = mapPos.y & (32 - 1);
|
||||
return (subMapX < subMapY) ? ((subMapX + subMapY) < 32 ? 0 : 1) : ((subMapX + subMapY) < 32 ? 3 : 2);
|
||||
}
|
||||
|
||||
int32_t map_get_tile_quadrant(int32_t mapX, int32_t mapY)
|
||||
int32_t map_get_tile_quadrant(const CoordsXY& mapPos)
|
||||
{
|
||||
int32_t subMapX = mapX & (32 - 1);
|
||||
int32_t subMapY = mapY & (32 - 1);
|
||||
int32_t subMapX = mapPos.x & (32 - 1);
|
||||
int32_t subMapY = mapPos.y & (32 - 1);
|
||||
return (subMapX > 16) ? (subMapY < 16 ? 1 : 0) : (subMapY < 16 ? 2 : 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -214,8 +214,8 @@ void map_invalidate_tile_full(int32_t x, int32_t y);
|
||||
void map_invalidate_element(int32_t x, int32_t y, TileElement* tileElement);
|
||||
void map_invalidate_region(const CoordsXY& mins, const CoordsXY& maxs);
|
||||
|
||||
int32_t map_get_tile_side(int32_t mapX, int32_t mapY);
|
||||
int32_t map_get_tile_quadrant(int32_t mapX, int32_t mapY);
|
||||
int32_t map_get_tile_side(const CoordsXY& mapPos);
|
||||
int32_t map_get_tile_quadrant(const CoordsXY& mapPos);
|
||||
int32_t map_get_corner_height(int32_t z, int32_t slope, int32_t direction);
|
||||
int32_t tile_element_get_corner_height(const SurfaceElement* surfaceElement, int32_t direction);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user