OpenTTD Source: Snowline functions and data structures

OpenTTD Source 15.0-beta1

Data Structures | Functions | Variables
Snowline functions and data structures

## Data Structures
struct | SnowLine
| Structure describing the height of the snow line each day of the year. More...

## Functions
bool | IsSnowLineSet ()
| Has a snow line table already been loaded.
void | SetSnowLine (uint8_t table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS])
| Set a variable snow line, as loaded from a newgrf file.
uint8_t | GetSnowLine ()
| Get the current snow line, either variable or static.
uint8_t | HighestSnowLine ()
| Get the highest possible snow line height, either variable or static.
uint8_t | LowestSnowLine ()
| Get the lowest possible snow line height, either variable or static.
void | ClearSnowLine ()
| Clear the variable snow line table and free the memory.

## Variables
static SnowLine * | _snow_line = nullptr
| Description of the snow line throughout the year.

## Detailed Description

## Function Documentation

## ◆ ClearSnowLine()

void ClearSnowLine | ( |  | ) |

Clear the variable snow line table and free the memory.

Definition at line 641 of file landscape.cpp.

References _snow_line, and free().

Referenced by ResetNewGRFData().

## ◆ GetSnowLine()

uint8_t GetSnowLine | ( |  | ) |

Get the current snow line, either variable or static.

Returns
  the snow line height.

Definition at line 609 of file landscape.cpp.

References _settings_game, _snow_line, TimerGameCalendar::ConvertDateToYMD(), TimerGameCalendar::date, GameSettings::game_creation, GameCreationSettings::snow_line_height, and SnowLine::table.

Referenced by TownViewWindow::DrawWidget(), GetGlobalVariable(), GetTerrainType(), PlaceTreesRandomly(), SplitGroundSpriteForOverlay(), TileLoopClearAlps(), and UpdateTownGrowth().

## ◆ HighestSnowLine()

uint8_t HighestSnowLine | ( |  | ) |

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

Returns
  the highest snow line height.

Definition at line 622 of file landscape.cpp.

References _settings_game, _snow_line, GameSettings::game_creation, SnowLine::highest_value, and GameCreationSettings::snow_line_height.

Referenced by CheckNewIndustry_Farm(), CheckNewIndustry_Forest(), and TryBuildTownHouse().

## ◆ IsSnowLineSet()

bool IsSnowLineSet | ( |  | ) |

Has a snow line table already been loaded.

Returns
  true if the table has been loaded already.

Definition at line 580 of file landscape.cpp.

References _snow_line.

Referenced by GlobalVarChangeInfo().

## ◆ LowestSnowLine()

uint8_t LowestSnowLine | ( |  | ) |

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

Returns
  the lowest snow line height.

Definition at line 632 of file landscape.cpp.

References _settings_game, _snow_line, GameSettings::game_creation, SnowLine::lowest_value, and GameCreationSettings::snow_line_height.

Referenced by TownViewWindow::DrawWidget(), and TownViewWindow::GetDesiredInfoHeight().

## ◆ SetSnowLine()

void SetSnowLine | ( | uint8_t | 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 590 of file landscape.cpp.

References _snow_line, SnowLine::highest_value, SnowLine::lowest_value, SNOW_LINE_DAYS, SNOW_LINE_MONTHS, and SnowLine::table.

Referenced by GlobalVarChangeInfo().

## Variable Documentation

## ◆ _snow_line

SnowLine* _snow_line = nullptr
| static

Description of the snow line throughout the year.

If it is `nullptr`, a static snowline height is used, as set by `_settings_game.game_creation.snow_line_height`. Otherwise it points to a table loaded from a newGRF file that describes the variable snowline.

See also
  GetSnowLine() GameCreationSettings

Definition at line 96 of file landscape.cpp.

Referenced by ClearSnowLine(), GetSnowLine(), HighestSnowLine(), IsSnowLineSet(), LowestSnowLine(), and SetSnowLine().