OpenTTD
game_info.hpp
Go to the documentation of this file.
1 /* $Id: game_info.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_INFO_HPP
13 #define GAME_INFO_HPP
14 
15 #include "../script/script_info.hpp"
16 
18 class GameInfo : public ScriptInfo {
19 public:
20  GameInfo();
21  ~GameInfo();
22 
26  static void RegisterAPI(Squirrel *engine);
27 
31  static SQInteger Constructor(HSQUIRRELVM vm);
32 
36  bool CanLoadFromVersion(int version) const;
37 
41  const char *GetAPIVersion() const { return this->api_version; }
42 
43  /* virtual */ bool IsDeveloperOnly() const { return this->is_developer_only; }
44 
45 private:
48  const char *api_version;
49 };
50 
52 class GameLibrary : public ScriptInfo {
53 public:
54  GameLibrary() : ScriptInfo(), category(NULL) {};
55  ~GameLibrary();
56 
60  static void RegisterAPI(Squirrel *engine);
61 
65  static SQInteger Constructor(HSQUIRRELVM vm);
66 
70  const char *GetCategory() const { return this->category; }
71 
72 private:
73  const char *category;
74 };
75 
76 #endif /* GAME_INFO_HPP */
int version
Version of the script.
static void RegisterAPI(Squirrel *engine)
Register the functions of this class.
Definition: game_info.cpp:37
bool is_developer_only
Is the script selectable by non-developers?
Definition: game_info.hpp:47
All static information from an Game like name, version, etc.
Definition: game_info.hpp:18
All static information from an Game library like name, version, etc.
Definition: game_info.hpp:52
static SQInteger Constructor(HSQUIRRELVM vm)
Create an Game, using this GameInfo as start-template.
Definition: game_info.cpp:55
All static information from an Script like name, version, etc.
Definition: script_info.hpp:32
int min_loadable_version
The Game can load savegame data if the version is equal or greater than this.
Definition: game_info.hpp:46
bool CanLoadFromVersion(int version) const
Check if we can start this Game.
Definition: game_info.cpp:103
const char * category
The category this library is in.
Definition: game_info.hpp:73
const char * GetAPIVersion() const
Get the API version this Game is written for.
Definition: game_info.hpp:41
const char * api_version
API version used by this Game.
Definition: game_info.hpp:48
const char * GetCategory() const
Get the category this library is in.
Definition: game_info.hpp:70
class Squirrel * engine
Engine used to register for Squirrel.
bool IsDeveloperOnly() const
Can this script be selected by developers only?
Definition: game_info.hpp:43