30 int hminnw = std::min(hnorth, hwest);
31 int hmines = std::min(heast, hsouth);
32 int hmin = std::min(hminnw, hmines);
34 int hmaxnw = std::max(hnorth, hwest);
35 int hmaxes = std::max(heast, hsouth);
36 int hmax = std::max(hmaxnw, hmaxes);
40 if (hnorth != hmin) r |=
SLOPE_N;
41 if (hwest != hmin) r |=
SLOPE_W;
42 if (heast != hmin) r |=
SLOPE_E;
43 if (hsouth != hmin) r |=
SLOPE_S;
57 uint x1 =
TileX(tile);
58 uint y1 =
TileY(tile);
97 uint x1 =
TileX(tile);
98 uint y1 =
TileY(tile);
107 if (h !=
nullptr) *h = z;
118 uint x1 =
TileX(tile);
119 uint y1 =
TileY(tile);
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
A number of safeguards to prevent using unsafe methods.
Slope
Enumeration for the slope-type.
@ SLOPE_W
the west corner of the tile is raised
@ SLOPE_E
the east corner of the tile is raised
@ SLOPE_S
the south corner of the tile is raised
@ SLOPE_N
the north corner of the tile is raised
@ SLOPE_STEEP
indicates the slope is steep
Definition of base types and functions in a cross-platform compatible way.
static uint MaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
static debug_inline uint MaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
std::tuple< Slope, int > GetTilePixelSlopeOutsideMap(int x, int y)
Return the slope of a given tile, also for tiles outside the map (virtual "black" tiles).
std::tuple< Slope, int > GetTileSlopeZ(TileIndex tile)
Return the slope of a given tile inside the map.
static std::tuple< Slope, int > GetTileSlopeGivenHeight(int hnorth, int hwest, int heast, int hsouth)
Get a tile's slope given the heigh of its four corners.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
Map writing/reading functions for tiles.
static debug_inline uint TileHeight(Tile tile)
Returns the height of a tile.
uint TileHeightOutsideMap(int x, int y)
Returns the height of a tile, also for tiles outside the map (virtual "black" tiles).
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in ZOOM_BASE.