# landscape.h File Reference

`#include "core/geometry_type.hpp"`
`#include "tile_cmd.h"`
`#include "slope_type.h"`
`#include "direction_type.h"`

Go to the source code of this file.

## Data Structures
struct | SnowLine
## Enumerations
enum | { SNOW_LINE_MONTHS = 12, SNOW_LINE_DAYS = 32 }
## Functions
bool | IsSnowLineSet (void)
| Has a snow line table already been loaded.
void | SetSnowLine (byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS])
| Set a variable snow line, as loaded from a newgrf file.
byte | GetSnowLine (void)
| Get the current snow line, either variable or static.
byte | HighestSnowLine (void)
| Get the highest possible snow line height, either variable or static.
void | ClearSnowLine (void)
| Clear the variable snow line table and free the memory.
uint | GetPartialZ (int x, int y, Slope corners)
uint | GetSlopeZ (int x, int y)
void | GetSlopeZOnEdge (Slope tileh, DiagDirection edge, int *z1, int *z2)
| Determine the Z height of the corners of a specific tile edge.
int | GetSlopeZInCorner (Slope tileh, Corner corner)
| Determine the Z height of a corner relative to TileZ.
Slope | GetFoundationSlope (TileIndex tile, uint *z)
| Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation, the function returns the same as GetTileSlope.
static Point | RemapCoords (int x, int y, int z)
static Point | RemapCoords2 (int x, int y)
uint | ApplyFoundationToSlope (Foundation f, Slope *s)
| Applys a foundation to a slope.
void | DrawFoundation (TileInfo *ti, Foundation f)
void | DoClearSquare (TileIndex tile)
void | RunTileLoop ()
void | InitializeLandscape ()
void | GenerateLandscape (byte mode)
TileIndex | AdjustTileCoordRandomly (TileIndex a, byte rng)

## Detailed Description

Definition in file landscape.h.

## Function Documentation

uint ApplyFoundationToSlope | ( | Foundation | f,
|  | Slope * | s |
| ) |  |  |

Applys a foundation to a slope.

Precondition:
  Foundation and slope must be valid combined.

Parameters:

  | f | The Foundation.
  | s | The Slope to modify.

Returns:
  Increment to the tile Z coordinate.

Definition at line 73 of file landscape.cpp.

References FOUNDATION_INCLINED_X, FOUNDATION_INCLINED_Y, FOUNDATION_STEEP_BOTH, FOUNDATION_STEEP_LOWER, GetHalftileFoundationCorner(), GetHighestSlopeCorner(), GetRailFoundationCorner(), HalftileSlope(), IsFoundation(), IsLeveledFoundation(), IsNonContinuousFoundation(), IsSpecialRailFoundation(), IsSteepSlope(), OppositeCorner(), SLOPE_FLAT, SLOPE_NE, SLOPE_NW, SLOPE_SE, SLOPE_SW, SlopeWithOneCornerRaised(), SlopeWithThreeCornersRaised(), and TILE_HEIGHT.

Slope GetFoundationSlope | ( | TileIndex | tile,
|  | uint * | z |
| ) |  |  |

Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation, the function returns the same as GetTileSlope.

Parameters:

  | tile | The tile of interest.
  | z | returns the z of the foundation slope. (Can be NULL, if not needed)

Returns:
  The slope on top of the foundation.

Definition at line 302 of file landscape.cpp.

References GetTileType().

int GetSlopeZInCorner | ( | Slope | tileh,
|  | Corner | corner |
| ) |  |  |

Determine the Z height of a corner relative to TileZ.

Precondition:
  The slope must not be a halftile slope.

Parameters:

  | tileh | The slope.
  | corner | The corner.

Returns:
  Z position of corner relative to TileZ.

Definition at line 255 of file landscape.cpp.

References IsHalftileSlope(), SlopeWithOneCornerRaised(), SteepSlope(), and TILE_HEIGHT.

void GetSlopeZOnEdge | ( | Slope | tileh,
|  | DiagDirection | edge,
|  | int * | z1,
|  | int * | z2 |
| ) |  |  |

Determine the Z height of the corners of a specific tile edge.

Note:
  If a tile has a non-continuous halftile foundation, a corner can have different heights wrt. it's edges.

Precondition:
  z1 and z2 must be initialized (typ. with TileZ). The corner heights just get added.

Parameters:

  | tileh | The slope of the tile.
  | edge | The edge of interest.
  | z1 | Gets incremented by the height of the first corner of the edge. (near corner wrt. the camera)
  | z2 | Gets incremented by the height of the second corner of the edge. (far corner wrt. the camera)

Definition at line 273 of file landscape.cpp.

References GetHalftileSlopeCorner(), IsHalftileSlope(), RemoveHalftileSlope(), SLOPE_E, SLOPE_N, SLOPE_S, SLOPE_STEEP_E, SLOPE_STEEP_N, SLOPE_STEEP_S, SLOPE_STEEP_W, SLOPE_W, SlopeWithOneCornerRaised(), and TILE_HEIGHT.

byte GetSnowLine | ( | void |  | ) |

Get the current snow line, either variable or static.

Returns:
  the snow line height.

Definition at line 513 of file landscape.cpp.

References ConvertDateToYMD().

byte HighestSnowLine | ( | void |  | ) |

Get the highest possible snow line height, either variable or static.

Returns:
  the highest snow line height.

Definition at line 526 of file landscape.cpp.

bool IsSnowLineSet | ( | void |  | ) |

Has a snow line table already been loaded.

Returns:
  true if the table has been loaded already.

Definition at line 488 of file landscape.cpp.

void SetSnowLine | ( | byte | table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS] | ) |

Set a variable snow line, as loaded from a newgrf file.

Parameters:

  | table | the 12 * 32 byte table containing the snowline for each day

Definition at line 497 of file landscape.cpp.

References max().