OpenTTD

game_instance.hpp
Go to the documentation of this file.
1 /* $Id: game_instance.hpp 23737 2012-01-03 20:37:56Z truebrain $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef GAME_INSTANCE_HPP
13 #define GAME_INSTANCE_HPP
14
15 #include "../script/script_instance.hpp"
16
18 class GameInstance : public ScriptInstance {
19 public:
20 GameInstance();
21
26 void Initialize(class GameInfo *info);
27
28 /* virtual */ int GetSetting(const char *name);
29 /* virtual */ ScriptInfo *FindLibrary(const char *library, int version);
30
31 private:
32 /* virtual */ void RegisterAPI();
33 /* virtual */ void Died();
34 /* virtual */ CommandCallback *GetDoCommandCallback();
35 /* virtual */ void LoadDummyScript() {}
36 };
37
38 #endif /* GAME_INSTANCE_HPP */
GameInstance::LoadDummyScript
void LoadDummyScript()
Load the dummy script.
Definition: game_instance.hpp:35
GameInstance::RegisterAPI
void RegisterAPI()
Register all API functions to the VM.
Definition: game_instance.cpp:105
GameInstance::Died
void Died()
Tell the script it died.
Definition: game_instance.cpp:230
GameInstance::GetDoCommandCallback
CommandCallback * GetDoCommandCallback()
Get the callback handling DoCommands in case of networking.
Definition: game_instance.cpp:260
GameInfo
All static information from an Game like name, version, etc.
Definition: game_info.hpp:18
GameInstance
Runtime information about a game script like a pointer to the squirrel vm and the current state...
Definition: game_instance.hpp:18
ScriptInfo
All static information from an Script like name, version, etc.
Definition: script_info.hpp:32
ScriptInstance
Runtime information about a script like a pointer to the squirrel vm and the current state...
Definition: script_instance.hpp:25
GameInstance::FindLibrary
ScriptInfo * FindLibrary(const char *library, int version)
Find a library.
Definition: game_instance.cpp:225
GameInstance::GetSetting
int GetSetting(const char *name)
Get the value of a setting of the current instance.
Definition: game_instance.cpp:220
CommandCallback
void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
Define a callback function for the client, after the command is finished.
Definition: command_type.h:467
GameInstance::Initialize
void Initialize(class GameInfo *info)
Initialize the script and prepare it for its first run.
Definition: game_instance.cpp:95