game.hpp

Go to the documentation of this file.
00001 /* $Id: game.hpp 23737 2012-01-03 20:37:56Z truebrain $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef GAME_HPP
00013 #define GAME_HPP
00014 
00015 #include "../core/string_compare_type.hpp"
00016 #include <map>
00017 
00019 typedef std::map<const char *, class ScriptInfo *, StringCompare> ScriptInfoList;
00020 
00021 #include "../script/api/script_event_types.hpp"
00022 
00026 class Game {
00027 public:
00031   static void GameLoop();
00032 
00036   static void Initialize();
00037 
00041   static void StartNew();
00042 
00046   static void Uninitialize(bool keepConfig);
00047 
00051   static void NewEvent(class ScriptEvent *event);
00052 
00056   static class GameInstance *GetGameInstance() { return Game::instance; }
00057 
00061   static class GameInfo *GetInfo() { return Game::info; }
00062 
00063   static void Rescan();
00064   static void ResetConfig();
00065 
00069   static void Save();
00070 
00074   static void Load(int version);
00075 
00077   static char *GetConsoleList(char *p, const char *last, bool newest_only = false);
00079   static char *GetConsoleLibraryList(char *p, const char *last);
00081   static const ScriptInfoList *GetInfoList();
00083   static const ScriptInfoList *GetUniqueInfoList();
00085   static class GameInfo *FindInfo(const char *name, int version, bool force_exact_match);
00087   static class GameLibrary *FindLibrary(const char *library, int version);
00088 
00092   static class GameInstance *GetInstance() { return Game::instance; }
00093 
00097   static const char *GetMainScript();
00098 
00099 #if defined(ENABLE_NETWORK)
00100 
00101   static bool HasGame(const struct ContentInfo *ci, bool md5sum);
00102   static bool HasGameLibrary(const ContentInfo *ci, bool md5sum);
00103 #endif
00104 
00105 private:
00106   static uint frame_counter;                        
00107   static class GameInstance *instance;              
00108   static class GameScannerInfo *scanner_info;       
00109   static class GameScannerLibrary *scanner_library; 
00110   static class GameInfo *info;                      
00111 };
00112 
00113 #endif /* GAME_HPP */