OpenTTD Source: src/misc.cpp File Reference

OpenTTD Source 15.0-RC2

Functions | Variables
misc.cpp File Reference

Misc functions that shouldn't be here. More...

`#include "stdafx.h"`
`#include "landscape.h"`
`#include "news_func.h"`
`#include "ai/ai.hpp"`
`#include "script/script_gui.h"`
`#include "newgrf.h"`
`#include "newgrf_house.h"`
`#include "economy_func.h"`
`#include "timer/timer_game_calendar.h"`
`#include "timer/timer_game_economy.h"`
`#include "timer/timer_game_tick.h"`
`#include "texteff.hpp"`
`#include "gfx_func.h"`
`#include "gamelog.h"`
`#include "animated_tile_func.h"`
`#include "tilehighlight_func.h"`
`#include "network/network_func.h"`
`#include "window_func.h"`
`#include "core/pool_type.hpp"`
`#include "game/game.hpp"`
`#include "linkgraph/linkgraphschedule.h"`
`#include "station_kdtree.h"`
`#include "town_kdtree.h"`
`#include "viewport_kdtree.h"`
`#include "newgrf_profiling.h"`
`#include "3rdparty/monocypher/monocypher.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Functions
void | MakeNewgameSettingsLive ()
void | InitializeSound ()
void | InitializeMusic ()
| Prepare the music system for use.
void | InitializeVehicles ()
void | InitializeRailGui ()
| Initialize rail building GUI settings.
void | InitializeRoadGui ()
void | InitializeAirportGui ()
void | InitializeDockGui ()
void | InitializeGraphGui ()
void | InitializeObjectGui ()
| Reset all data of the object GUI.
void | InitializeTownGui ()
void | InitializeIndustries ()
void | InitializeObjects ()
| Initialize/reset the objects.
void | InitializeTrees ()
void | InitializeCompanies ()
| Initialize the pool of companies.
void | InitializeCheats ()
| Reinitialise all the cheats.
void | InitializeOldNames ()
| Initialize the old names table memory.
std::string | GenerateUid (std::string_view subject)
| Generate an unique ID.
void | GenerateSavegameId ()
| Generate an unique savegame ID.
void | InitializeGame (uint size_x, uint size_y, bool reset_date, bool reset_settings)

## Variables
TileIndex | _cur_tileloop_tile

## Detailed Description

Misc functions that shouldn't be here.

Definition in file misc.cpp.

## Function Documentation

## ◆ GenerateSavegameId()

void GenerateSavegameId | ( |  | ) |

Generate an unique savegame ID.

Definition at line 87 of file misc.cpp.

References _game_session_stats, GenerateUid(), and GameSessionStats::savegame_id.

Referenced by AfterLoadGame().

## ◆ GenerateUid()

std::string GenerateUid | ( | std::string_view | subject | ) |

Generate an unique ID.

It isn't as much of an unique ID but more a hashed digest of a random string and a time. It is very likely to be unique, but it does not follow any UUID standard.

Definition at line 66 of file misc.cpp.

References FormatArrayAsHex(), and RandomBytesWithFallback().

Referenced by GenerateSavegameId().

## ◆ InitializeAirportGui()

void InitializeAirportGui | ( |  | ) |

Definition at line 637 of file airport_gui.cpp.

## ◆ InitializeCheats()

void InitializeCheats | ( |  | ) |

Reinitialise all the cheats.

Definition at line 19 of file cheat.cpp.

References _cheats.

## ◆ InitializeCompanies()

void InitializeCompanies | ( |  | ) |

Initialize the pool of companies.

Definition at line 684 of file company_cmd.cpp.

References _cur_company_tick_index.

## ◆ InitializeDockGui()

void InitializeDockGui | ( |  | ) |

Definition at line 614 of file dock_gui.cpp.

## ◆ InitializeGame()

void InitializeGame | ( | uint | size_x,
|  | uint | size_y,
|  | bool | reset_date,
|  | bool | reset_settings
| ) |  |

Definition at line 92 of file misc.cpp.

## ◆ InitializeGraphGui()

void InitializeGraphGui | ( |  | ) |

Definition at line 2063 of file graph_gui.cpp.

## ◆ InitializeIndustries()

void InitializeIndustries | ( |  | ) |

Definition at line 3150 of file industry_cmd.cpp.

## ◆ InitializeMusic()

void InitializeMusic | ( |  | ) |

Prepare the music system for use.

Called from `InitializeGame`

Definition at line 472 of file music_gui.cpp.

References MusicSystem::BuildPlaylists().

## ◆ InitializeObjectGui()

void InitializeObjectGui | ( |  | ) |

Reset all data of the object GUI.

Definition at line 435 of file object_gui.cpp.

References _object_gui, OBJECT_CLASS_BEGIN, and ObjectPickerSelection::sel_class.

## ◆ InitializeObjects()

void InitializeObjects | ( |  | ) |

Initialize/reset the objects.

Definition at line 73 of file object_cmd.cpp.

References Object::ResetTypeCounts().

## ◆ InitializeOldNames()

void InitializeOldNames | ( |  | ) |

Initialize the old names table memory.

Definition at line 108 of file strings_sl.cpp.

References _old_name_array, and NUM_OLD_STRINGS.

## ◆ InitializeRailGui()

void InitializeRailGui | ( |  | ) |

Initialize rail building GUI settings.

Definition at line 1915 of file rail_gui.cpp.

References _build_depot_direction, _station_gui, _waypoint_gui, DIAGDIR_NW, WaypointPickerSelection::sel_class, StationPickerSelection::sel_class, WaypointPickerSelection::sel_type, StationPickerSelection::sel_type, STAT_CLASS_DFLT, and STAT_CLASS_WAYP.

## ◆ InitializeRoadGui()

void InitializeRoadGui | ( |  | ) |

Definition at line 1749 of file road_gui.cpp.

## ◆ InitializeSound()

void InitializeSound | ( |  | ) |

Definition at line 90 of file sound.cpp.

## ◆ InitializeTownGui()

void InitializeTownGui | ( |  | ) |

Definition at line 1358 of file town_gui.cpp.

## ◆ InitializeTrees()

void InitializeTrees | ( |  | ) |

Definition at line 1001 of file tree_cmd.cpp.

## ◆ InitializeVehicles()

void InitializeVehicles | ( |  | ) |

Definition at line 668 of file vehicle.cpp.

## ◆ MakeNewgameSettingsLive()

void MakeNewgameSettingsLive | ( |  | ) |
| extern

Definition at line 352 of file openttd.cpp.

## Variable Documentation

## ◆ _cur_tileloop_tile

TileIndex _cur_tileloop_tile
| extern

Definition at line 789 of file landscape.cpp.