OpenTTD: src/game/game.hpp Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

game.hpp
Go to the documentation of this file.
1 /* $Id: game.hpp 25114 2013-03-22 21:21:45Z frosch $ */
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_HPP
13 #define GAME_HPP
14
15 #include "../core/string_compare_type.hpp"
16 #include "game_scanner.hpp"
17 #include <map>
18
20 typedef std::map<const char *, class ScriptInfo *, StringCompare> ScriptInfoList;
21
22 #include "../script/api/script_event_types.hpp"
23
27 class Game {
28 public:
32 static void GameLoop();
33
37 static void Initialize();
38
42 static void StartNew();
43
47 static void Uninitialize(bool keepConfig);
48
54 static void Pause();
55
61 static void Unpause();
62
67 static bool IsPaused();
68
72 static void NewEvent(class ScriptEvent *event);
73
77 static class GameInstance *GetGameInstance() { return Game::instance; }
78
82 static class GameInfo *GetInfo() { return Game::info; }
83
84 static void Rescan();
85 static void ResetConfig();
86
90 static void Save();
91
95 static void Load(int version);
96
98 static char *GetConsoleList(char *p, const char *last, bool newest_only = false);
100 static char *GetConsoleLibraryList(char *p, const char *last);
102 static const ScriptInfoList *GetInfoList();
104 static const ScriptInfoList *GetUniqueInfoList();
106 static class GameInfo *FindInfo(const char *name, int version, bool force_exact_match);
108 static class GameLibrary *FindLibrary(const char *library, int version);
109
113 static class GameInstance *GetInstance() { return Game::instance; }
114
115 #if defined(ENABLE_NETWORK)
116
117 static bool HasGame(const struct ContentInfo *ci, bool md5sum);
118 static bool HasGameLibrary(const ContentInfo *ci, bool md5sum);
119 #endif
120
121 static GameScannerInfo *GetScannerInfo();
123 static GameScannerLibrary *GetScannerLibrary();
124
125 private:
126 static uint frame_counter;
127 static class GameInstance *instance;
128 static class GameScannerInfo *scanner_info;
129 static class GameScannerLibrary *scanner_library;
130 static class GameInfo *info;
131 };
132
133 #endif /* GAME_HPP */