|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
14 #include "script/script_gui.h"
33 #include "viewport_kdtree.h"
35 #include "3rdparty/monocypher/monocypher.h"
42 extern void MakeNewgameSettingsLive();
44 void InitializeSound();
46 void InitializeVehicles();
48 void InitializeRoadGui();
49 void InitializeAirportGui();
50 void InitializeDockGui();
51 void InitializeGraphGui();
53 void InitializeTownGui();
54 void InitializeIndustries();
56 void InitializeTrees();
71 std::array<uint8_t, 32> random_bytes;
74 auto current_time = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
75 std::string coding_string = fmt::format(
"{}{}", current_time, subject);
77 std::array<uint8_t, 16> digest;
78 crypto_blake2b_ctx ctx;
79 crypto_blake2b_init(&ctx, digest.size());
80 crypto_blake2b_update(&ctx, random_bytes.data(), random_bytes.size());
81 crypto_blake2b_update(&ctx,
reinterpret_cast<const uint8_t *
>(coding_string.data()), coding_string.size());
82 crypto_blake2b_final(&ctx, digest.data());
95 void InitializeGame(uint size_x, uint size_y,
bool reset_date,
bool reset_settings)
106 _cur_tileloop_tile = 1;
108 if (reset_settings) MakeNewgameSettingsLive();
110 _newgrf_profilers.clear();
129 RebuildStationKdtree();
131 RebuildViewportKdtree();
138 InitializeVehicles();
141 InitializeLandscape();
144 InitializeAirportGui();
146 InitializeGraphGui();
151 InitializeIndustries();
153 InitializeBuildingCounts();
void InitializeCompanies()
Initialize the pool of companies.
static void Clear()
Clear all link graphs and jobs from the schedule.
std::string FormatArrayAsHex(std::span< const byte > data)
Format a byte array into a continuous hex string.
static TickCounter counter
Monotonic counter, in ticks, since start of game.
static Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
Gamelog _gamelog
Gamelog instance.
static void Allocate(uint size_x, uint size_y)
(Re)allocates a map with the given dimension
void NetworkInitChatMessage()
Initialize all buffers of the chat visualisation.
void ResetPersistentNewGRFData()
Reset NewGRF data which is stored persistently in savegames.
void InitNewsItemStructs()
Initialize the news-items data structures.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
void UnInitWindowSystem()
Close down the windowing system.
static bool UsingWallclockUnits(bool newgame=false)
Check if we are using wallclock units.
void Reset()
Resets and frees all memory allocated - used before loading or starting a new game.
void InitializeScriptGui()
Reset the Script windows to their initial state.
void Revision()
Logs a change in game revision.
GameCreationSettings game_creation
settings used during the creation of a game (map)
@ PM_UNPAUSED
A normal unpaused game.
void InitializeOldNames()
Initialize the old names table memory.
void InitializeEconomy()
Resets economy to initial values.
std::string GenerateUid(std::string_view subject)
Generate an unique ID.
static Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
PauseMode _pause_mode
The current pause mode.
static void Initialize()
Initialize the AI system.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
TimerGameCalendar::Year starting_year
starting date
static void Clean(PoolType)
Clean all pools of given type.
static void SetDate(Date date, DateFract fract)
Set the date.
uint16_t _game_speed
Current game-speed; 100 is 1x, 0 is infinite.
void InitializeCheats()
Reinitialise all the cheats.
@ GLAT_START
Game created.
void RandomBytesWithFallback(std::span< uint8_t > buf)
Fill the given buffer with random bytes.
void StartAction(GamelogActionType at)
Stores information about new action, but doesn't allocate it Action is allocated only when there is a...
void StopAction()
Stops logging of any changes.
@ PT_NORMAL
Normal pool containing game objects.
void InitializeMusic()
Prepare the music system for use.
void GenerateSavegameId()
Generate an unique savegame ID.
GRFConfig * _grfconfig
First item in list of current GRF set up.
static void SetDate(Date date, DateFract fract)
Set the date.
void Mode()
Logs a change in game mode (scenario editor or game)
void InitializeObjectGui()
Reset all data of the object GUI.
void InitializeObjects()
Initialize/reset the objects.
void GRFAddList(const GRFConfig *newg)
Logs adding of list of GRFs.
void InitializeRailGui()
Initialize rail building GUI settings.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
void InitializeAnimatedTiles()
Initialize all animated tile variables to some known begin point.
TileIndex redsq
The tile that has to get a red selection.
std::string _savegame_id
Unique ID of the current savegame.
static void Initialize()
Initialize the Game system.