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"
77 if (_game_mode == GM_MENU)
return;
84 if (
info ==
nullptr)
return;
95 config->SetToLoadData(
nullptr);
139 ScriptObjectRef counter(event);
157 void Game::ResetConfig()
248 bool Game::HasGameLibrary(
const ContentInfo *ci,
bool md5sum)
static GameConfig * GetConfig(ScriptSettingSource source=SSS_DEFAULT)
Get the config of a company.
All static information from an Game like name, version, etc.
All static information from an Game library like name, version, etc.
static void StartNew()
Start up a new GameScript.
static GameInfo * info
Current selected GameInfo.
static class GameInfo * FindInfo(const std::string &name, int version, bool force_exact_match)
Wrapper function for GameScannerInfo::FindInfo.
static GameScannerLibrary * GetScannerLibrary()
Gets the ScriptScanner instance that is used to find Game Libraries.
static void Unpause()
Resume execution of the Game Script.
static bool IsPaused()
Checks if the Game Script is paused.
static uint frame_counter
Tick counter for the Game code.
static std::unique_ptr< GameInstance > instance
Instance to the current active Game.
static void Save()
Save data from a GameScript to a savegame.
static bool HasGame(const struct ContentInfo *ci, bool md5sum)
Wrapper function for GameScanner::HasGame.
static class GameLibrary * FindLibrary(const std::string &library, int version)
Wrapper function for GameScanner::FindLibrary.
static const ScriptInfoList * GetUniqueInfoList()
Wrapper function for GameScanner::GetUniqueInfoList.
static void Pause()
Suspends the Game Script and then pause the execution of the script.
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
static void GameLoop()
Called every game-tick to let Game do something.
static void GetConsoleList(std::back_insert_iterator< std::string > &output_iterator, bool newest_only)
Wrapper function for GameScanner::GetConsoleList.
static void GetConsoleLibraryList(std::back_insert_iterator< std::string > &output_iterator)
Wrapper function for GameScanner::GetConsoleLibraryList.
static void Uninitialize(bool keepConfig)
Uninitialize the Game system.
static std::unique_ptr< GameScannerInfo > scanner_info
Scanner for Game scripts.
static const ScriptInfoList * GetInfoList()
Wrapper function for GameScanner::GetInfoList.
static void Initialize()
Initialize the Game system.
static std::unique_ptr< GameScannerLibrary > scanner_library
Scanner for GS Libraries.
static GameScannerInfo * GetScannerInfo()
Gets the ScriptScanner instance that is used to find Game scripts.
@ SSS_FORCE_GAME
Get the Script config from the current game.
void AnchorUnchangeableSettings()
As long as the default of a setting has not been changed, the value of the setting is not stored.
static void SaveEmpty()
Don't save any data in the savegame.
@ Game
Scan for game scripts.
uint DoScan(Subdirectory sd)
Perform the scanning of a particular subdirectory.
CompanyID _current_company
Company currently doing an action.
static constexpr Owner OWNER_DEITY
The object is owned by a superuser / goal script.
#define Debug(category, level, format_string,...)
Output a line of debugging information.
@ PFE_GAMESCRIPT
Game script execution.
Base functions for all Games.
GameConfig stores the configuration settings of every Game.
GameInfo keeps track of all information of an Game, like Author, Description, ...
The GameInstance tracks games.
declarations of the class for Game scanner
bool _networking
are we in networking mode?
bool _network_server
network-server is active
std::map< std::string, class ScriptInfo *, CaseInsensitiveComparator > ScriptInfoList
Type for the list of scripts.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
Class to backup a specific variable and restore it later.
void Change(const U &new_value)
Change the value of the variable.
void Restore()
Restore the variable.
Container for all important information about a piece of content.
ScriptConfigSettings script_config
AI and Gamescript configuration.
std::unique_ptr< class GameConfig > game
settings for gamescript
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
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-...
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...
@ WC_SCRIPT_SETTINGS
Script settings; Window numbers:
@ WC_SCRIPT_LIST
Scripts list; Window numbers:
@ WC_GAME_OPTIONS
Game options window; Window numbers:
@ WC_SCRIPT_DEBUG
Script debug window; Window numbers: