47 }
else if (y < (
int)
MapMaxY()) {
52 }
else if (x < (
int)
MapMaxX()) {
55 }
else if (y < (
int)
MapMaxY()) {
63 }
else if (y < (
int)
MapMaxY()) {
87 int hminnw =
min(hnorth, hwest);
88 int hmines =
min(heast, hsouth);
89 int hmin =
min(hminnw, hmines);
91 if (h != NULL) *h = hmin;
93 int hmaxnw =
max(hnorth, hwest);
94 int hmaxes =
max(heast, hsouth);
95 int hmax =
max(hmaxnw, hmaxes);
99 if (hnorth != hmin) r |=
SLOPE_N;
100 if (hwest != hmin) r |=
SLOPE_W;
101 if (heast != hmin) r |=
SLOPE_E;
102 if (hsouth != hmin) r |=
SLOPE_S;
119 uint x =
TileX(tile);
120 uint y =
TileY(tile);
173 if (h != NULL) *h = z;
the north corner of the tile is raised
the west corner of the tile is raised
int GetTilePixelZOutsideMap(int x, int y)
Get bottom height of the tile outside map.
Slope GetTilePixelSlopeOutsideMap(int x, int y, int *h)
Return the slope of a given tile outside the map.
static uint TileX(TileIndex tile)
Get the X component of a tile.
the east corner of the tile is raised
static T max(const T a, const T b)
Returns the maximum of two values.
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
static Slope GetTileSlopeGivenHeight(int hnorth, int hwest, int heast, int hsouth, int *h)
Get a tile's slope given the heigh of its four corners.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
indicates the slope is steep
Definition of base types and functions in a cross-platform compatible way.
A number of safeguards to prevent using unsafe methods.
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
int GetTileMaxPixelZOutsideMap(int x, int y)
Get top height of the tile outside the map.
static T min(const T a, const T b)
Returns the minimum of two values.
static uint MapSize()
Get the size of the map.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
uint32 TileIndex
The index/ID of a Tile.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Slope
Enumeration for the slope-type.
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
uint TileHeightOutsideMap(int x, int y)
Returns the tile height for a coordinate outside map.
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
static bool IsInnerTile(TileIndex tile)
Check if a tile is within the map (not a border)
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
Map writing/reading functions for tiles.
the south corner of the tile is raised
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.