OpenTTD
Static Public Member Functions | Static Private Attributes
Game Class Reference

Main Game class. More...

#include <game.hpp>

Static Public Member Functions

static void GameLoop ()
 Called every game-tick to let Game do something.
 
static void Initialize ()
 Initialize the Game system.
 
static void StartNew ()
 Start up a new GameScript.
 
static void Uninitialize (bool keepConfig)
 Uninitialize the Game system.
 
static void Pause ()
 Suspends the Game Script and then pause the execution of the script. More...
 
static void Unpause ()
 Resume execution of the Game Script. More...
 
static bool IsPaused ()
 Checks if the Game Script is paused. More...
 
static void NewEvent (class ScriptEvent *event)
 Queue a new event for a Game Script.
 
static class GameInstanceGetGameInstance ()
 Get the current GameScript instance.
 
static class GameInfoGetInfo ()
 Get the current GameInfo.
 
static void Rescan ()
 
static void ResetConfig ()
 
static void Save ()
 Save data from a GameScript to a savegame.
 
static void Load (int version)
 Load data for a GameScript from a savegame.
 
static char * GetConsoleList (char *p, const char *last, bool newest_only=false)
 Wrapper function for GameScanner::GetConsoleList.
 
static char * GetConsoleLibraryList (char *p, const char *last)
 Wrapper function for GameScanner::GetConsoleLibraryList.
 
static const ScriptInfoListGetInfoList ()
 Wrapper function for GameScanner::GetInfoList.
 
static const ScriptInfoListGetUniqueInfoList ()
 Wrapper function for GameScanner::GetUniqueInfoList.
 
static class GameInfoFindInfo (const char *name, int version, bool force_exact_match)
 Wrapper function for GameScannerInfo::FindInfo.
 
static class GameLibraryFindLibrary (const char *library, int version)
 Wrapper function for GameScanner::FindLibrary.
 
static class GameInstanceGetInstance ()
 Get the current active instance.
 
static bool HasGame (const struct ContentInfo *ci, bool md5sum)
 Wrapper function for GameScanner::HasGame. More...
 
static bool HasGameLibrary (const ContentInfo *ci, bool md5sum)
 
static GameScannerInfoGetScannerInfo ()
 Gets the ScriptScanner instance that is used to find Game scripts.
 
static GameScannerLibraryGetScannerLibrary ()
 Gets the ScriptScanner instance that is used to find Game Libraries.
 

Static Private Attributes

static uint frame_counter = 0
 Tick counter for the Game code.
 
static class GameInstanceinstance = NULL
 Instance to the current active Game.
 
static class GameScannerInfoscanner_info = NULL
 Scanner for Game scripts.
 
static class GameScannerLibraryscanner_library = NULL
 Scanner for GS Libraries.
 
static class GameInfoinfo = NULL
 Current selected GameInfo.
 

Detailed Description

Main Game class.

Contains all functions needed to start, stop, save and load Game Scripts.

Definition at line 27 of file game.hpp.

Member Function Documentation

◆ HasGame()

bool Game::HasGame ( const struct ContentInfo ci,
bool  md5sum 
)
static

Wrapper function for GameScanner::HasGame.

Check whether we have an Game (library) with the exact characteristics as ci.

Parameters
cithe characteristics to search on (shortname and md5sum)
md5sumwhether to check the MD5 checksum
Returns
true iff we have an Game (library) matching.

Definition at line 259 of file game_core.cpp.

References ScriptScanner::HasScript().

Referenced by GetInstance(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().

◆ IsPaused()

bool Game::IsPaused ( )
static

Checks if the Game Script is paused.

Returns
true if the Game Script is paused, otherwise false.

Definition at line 129 of file game_core.cpp.

References ScriptInstance::IsPaused().

Referenced by AIDebugWindow::OnClick(), and AIDebugWindow::OnInvalidateData().

◆ Pause()

void Game::Pause ( )
static

Suspends the Game Script and then pause the execution of the script.

The script will not be resumed from its suspended state until the script has been unpaused.

Definition at line 119 of file game_core.cpp.

References ScriptInstance::Pause().

Referenced by AIDebugWindow::OnInvalidateData().

◆ Unpause()

void Game::Unpause ( )
static

Resume execution of the Game Script.

This function will not actually execute the script, but set a flag so that the script is executed my the usual mechanism that executes the script.

Definition at line 124 of file game_core.cpp.

References ScriptInstance::Unpause().

Referenced by AIDebugWindow::OnClick().


The documentation for this class was generated from the following files: