1 /* 2 * This file is part of OpenTTD. 3 * 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. 4 * 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. 5 * 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/>. 6 */ 7 8 /** @file game_instance.hpp The GameInstance tracks games. */ 9 10 #ifndef GAME_INSTANCE_HPP 11 #define GAME_INSTANCE_HPP 12 13 #include "../script/script_instance.hpp" 14 15 /** Runtime information about a game script like a pointer to the squirrel vm and the current state. */ 16 class GameInstance : public ScriptInstance { 17 public: 18 GameInstance(); 19 20 /** 21 * Initialize the script and prepare it for its first run. 22 * @param info The GameInfo to start. 23 */ 24 void Initialize(class GameInfo *info); 25 26 int GetSetting(const char *name) override; 27 ScriptInfo *FindLibrary(const char *library, int version) override; 28 29 private: 30 void RegisterAPI() override; 31 void Died() override; 32 CommandCallback *GetDoCommandCallback() override; LoadDummyScript()33 void LoadDummyScript() override {} 34 }; 35 36 #endif /* GAME_INSTANCE_HPP */ 37