# functions.h File Reference

`#include "core/random_func.hpp"`
`#include "command_type.h"`
`#include "tile_cmd.h"`

Go to the source code of this file.

## Functions
void | DrawHillyLandTile (const TileInfo *ti)
void | DrawClearLandTile (const TileInfo *ti, byte set)
void | DrawClearLandFence (const TileInfo *ti)
void | TileLoopClearHelper (TileIndex tile)
bool | CheckPlayerHasMoney (CommandCost cost)
void | SubtractMoneyFromPlayer (CommandCost cost)
void | SubtractMoneyFromPlayerFract (PlayerID player, CommandCost cost)
bool | CheckOwnership (Owner owner)
bool | CheckTileOwnership (TileIndex tile)
void | AddAnimatedTile (TileIndex tile)
| Add the given tile to the animated tile table (if it does not exist on that table yet).
void | DeleteAnimatedTile (TileIndex tile)
| Removes the given tile from the animated tile table.
void | AnimateAnimatedTiles ()
| Animate all tiles in the animated tile list, i.e. call AnimateTile on them.
void | InitializeAnimatedTiles ()
| Initialize all animated tile variables to some known begin point.
void | PlaceTreesRandomly ()
| Place some trees randomly.
void | InitializeLandscapeVariables (bool only_constants)
bool | IsCustomName (StringID id)
char * | CopyFromOldName (StringID id)
void | MarkTileDirty (int x, int y)
| Mark a tile given by its coordinate dirty for repaint.
void | MarkTileDirtyByTile (TileIndex tile)
| Mark a tile given by its index dirty for repaint.
void | MarkAllViewportsDirty (int left, int top, int right, int bottom)
| Mark all viewports dirty for repaint.
void | ShowCostOrIncomeAnimation (int x, int y, int z, Money cost)
void | ShowFeederIncomeAnimation (int x, int y, int z, Money cost)
void | ShowHighscoreTable (int difficulty, int8 rank)
| Show the highscore table for a given difficulty.
void | AskExitGame ()
void | AskExitToGameMenu ()
void | RedrawAutosave ()
StringID | RemapOldStringID (StringID s)
| remap a string ID from the old format to the new format
void | UpdateViewportSignPos (ViewportSign *sign, int left, int top, StringID str)
void | GameSizeChanged ()
const char * | GetCurrentLocale (const char *param)
| Determine the current charset based on the environment First check some default values, after this one we passed ourselves and if none exist return the value for $LANG.
int | ttd_main (int argc, char *argv[])
void | HandleExitGameRequest ()

## Detailed Description

Definition in file functions.h.

## Function Documentation

void AddAnimatedTile | ( | TileIndex | tile | ) |

Add the given tile to the animated tile table (if it does not exist on that table yet).

Also increases the size of the table if necessary.

Parameters:

  | tile | the tile to make animated

Definition at line 459 of file texteff.cpp.

References MarkTileDirtyByTile().

Referenced by MakeHouseTile(), and TileLoop_Town().

void DeleteAnimatedTile | ( | TileIndex | tile | ) |

Removes the given tile from the animated tile table.

Parameters:

  | tile | the tile to remove

Definition at line 438 of file texteff.cpp.

References MarkTileDirtyByTile().

Referenced by AnimateTile_Town(), and HaltLift().

const char* GetCurrentLocale | ( | const char * |  | ) |

Determine the current charset based on the environment First check some default values, after this one we passed ourselves and if none exist return the value for $LANG.

Parameters:

  | param | environment variable to check conditionally if default ones are not set. Pass NULL if you don't want additional checks.

Returns:
  return string containing current charset, or NULL if not-determinable

Definition at line 1314 of file strings.cpp.

Referenced by InitializeLanguagePacks().

void PlaceTreesRandomly | ( |  | ) |

Place some trees randomly.

This function just place some trees randomly on the map.

Definition at line 238 of file tree_cmd.cpp.

References CanPlantTreesOnTile(), GetTropicZone(), GWP_TREE, IncreaseGeneratingWorldProgress(), PlaceTree(), PlaceTreeAtSameHeight(), RandomTileSeed(), ScaleByMapSize(), TILE_HEIGHT, TP_IMPROVED, and TROPICZONE_RAINFOREST.

Referenced by GenerateTrees().

StringID RemapOldStringID | ( | StringID | s | ) |

remap a string ID from the old format to the new format

Parameters:

  | s | StringID that requires remapping

Returns:
  translated ID

Definition at line 1219 of file strings.cpp.

References IsInsideMM().

Referenced by SlSaveLoadConv().

void ShowHighscoreTable | ( | int | difficulty,
|  | int8 | ranking |
| ) |  |  |

Show the highscore table for a given difficulty.

When called from endgame ranking is set to the top5 element that was newly added and is thus highlighted

Definition at line 1471 of file player_gui.cpp.

References _networking, AllocateWindowDesc(), CMD_PAUSE, DoCommandP(), HideVitalWindows(), and MarkWholeScreenDirty().

Referenced by EndGameWndProc().