OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
11 #include "../core/backup_type.hpp"
12 #include "../company_base.h"
13 #include "../company_func.h"
14 #include "../network/network.h"
15 #include "../window_func.h"
16 #include "../framerate_type.h"
23 #include "../safeguards.h"
81 if (
info ==
nullptr)
return;
166 void Game::ResetConfig()
269 bool Game::HasGameLibrary(
const ContentInfo *ci,
bool md5sum)
void Change(const U &new_value)
Change the value of the variable.
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
static class GameInfo * FindInfo(const char *name, int version, bool force_exact_match)
Wrapper function for GameScannerInfo::FindInfo.
static bool IsPaused()
Checks if the Game Script is paused.
void InsertEvent(class ScriptEvent *event)
Insert an event for this script.
void GameLoop()
Run the GameLoop of a script.
void Save()
Call the script Save function and save all data in the savegame.
Class to backup a specific variable and restore it later.
uint DoScan(Subdirectory sd)
Perform the scanning of a particular subdirectory.
bool _network_server
network-server is active
static uint frame_counter
Tick counter for the Game code.
void Unpause()
Resume execution of the script.
static void Load(int version)
Load data for a GameScript from a savegame.
class GameConfig * game_config
settings for gamescript
static void Unpause()
Resume execution of the Game Script.
char * GetConsoleList(char *p, const char *last, bool newest_only) const
Get the list of registered scripts to print on the console.
void RescanDir()
Rescan the script dir.
void Pause()
Suspends the script for the current tick and then pause the execution of script.
const ScriptInfoList * GetUniqueInfoList()
Get the list of the latest version of all registered scripts.
int version
Version of the script.
static GameScannerLibrary * GetScannerLibrary()
Gets the ScriptScanner instance that is used to find Game Libraries.
std::map< const char *, class ScriptInfo *, StringCompare > ScriptInfoList
A list that maps AI names to their AIInfo object.
static class GameScannerLibrary * scanner_library
Scanner for GS Libraries.
Container for all important information about a piece of content.
static void SaveEmpty()
Don't save any data in the savegame.
const char * GetName() const
Get the name of the Script.
static void Pause()
Suspends the Game Script and then pause the execution of the script.
void Initialize(class GameInfo *info)
Initialize the script and prepare it for its first run.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
class GameLibrary * FindLibrary(const char *library, int version)
Find a library in the pool.
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
static void Uninitialize(bool keepConfig)
Uninitialize the Game system.
bool _networking
are we in networking mode?
static void LoadEmpty()
Load and discard data from a savegame.
@ GAME
Scan for game scripts.
Runtime information about a game script like a pointer to the squirrel vm and the current state.
@ PFE_GAMESCRIPT
Game script execution.
CompanyID _current_company
Company currently doing an action.
static void GameLoop()
Called every game-tick to let Game do something.
@ WC_AI_DEBUG
AI debug window; Window numbers:
bool HasScript(const struct ContentInfo *ci, bool md5sum)
Check whether we have a script with the exact characteristics as ci.
void AnchorUnchangeableSettings()
As long as the default of a setting has not been changed, the value of the setting is not stored.
const ScriptInfoList * GetInfoList()
Get the list of all registered scripts.
static class GameInfo * info
Current selected GameInfo.
void Restore()
Restore the variable.
@ WC_AI_LIST
AI list; Window numbers:
bool ResetInfo(bool force_exact_match)
When ever the Game Scanner is reloaded, all infos become invalid.
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
static GameConfig * GetConfig(ScriptSettingSource source=SSS_DEFAULT)
Get the config of a company.
@ WC_AI_SETTINGS
AI settings; Window numbers:
static bool HasGame(const struct ContentInfo *ci, bool md5sum)
Wrapper function for GameScanner::HasGame.
All static information from an Game like name, version, etc.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
static void Save()
Save data from a GameScript to a savegame.
#define Debug(name, level, format_string,...)
Ouptut a line of debugging information.
All static information from an Game library like name, version, etc.
static GameScannerInfo * GetScannerInfo()
Gets the ScriptScanner instance that is used to find Game scripts.
bool IsPaused()
Checks if the script is paused.
void Change(const char *name, int version=-1, bool force_exact_match=false, bool is_random=false)
Set another Script to be loaded in this slot.
void CollectGarbage()
Let the VM collect any garbage.
void Load(int version)
Load data from a savegame and store it on the stack.
static const ScriptInfoList * GetUniqueInfoList()
Wrapper function for GameScanner::GetUniqueInfoList.
const char * name
Full name of the script.
class GameInfo * FindInfo(const char *nameParam, int versionParam, bool force_exact_match)
Check if we have a game by name and version available in our list.
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
@ SSS_FORCE_GAME
Get the Script config from the current game.
static char * GetConsoleLibraryList(char *p, const char *last)
Wrapper function for GameScanner::GetConsoleLibraryList.
static void StartNew()
Start up a new GameScript.
bool HasScript() const
Is this config attached to an Script? In other words, is there a Script that is assigned to this slot...
static class GameScannerInfo * scanner_info
Scanner for Game scripts.
static char * GetConsoleList(char *p, const char *last, bool newest_only=false)
Wrapper function for GameScanner::GetConsoleList.
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
static class GameInstance * instance
Instance to the current active Game.
static class GameLibrary * FindLibrary(const char *library, int version)
Wrapper function for GameScanner::FindLibrary.
static const ScriptInfoList * GetInfoList()
Wrapper function for GameScanner::GetInfoList.
static void Initialize()
Initialize the Game system.