# game.hpp

Go to the documentation of this file.

    00001 /* $Id: game.hpp 24537 2012-09-21 19:58:18Z zuu $ */
    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 "game_scanner.hpp"
    00017 #include <map>
    00018
    00020 typedef std::map<const char *, class ScriptInfo *, StringCompare> ScriptInfoList;
    00021
    00022 #include "../script/api/script_event_types.hpp"
    00023
    00027 class Game {
    00028 public:
    00032   static void GameLoop();
    00033
    00037   static void Initialize();
    00038
    00042   static void StartNew();
    00043
    00047   static void Uninitialize(bool keepConfig);
    00048
    00054   static void Pause();
    00055
    00061   static void Unpause();
    00062
    00067   static bool IsPaused();
    00068
    00072   static void NewEvent(class ScriptEvent *event);
    00073
    00077   static class GameInstance *GetGameInstance() { return Game::instance; }
    00078
    00082   static class GameInfo *GetInfo() { return Game::info; }
    00083
    00084   static void Rescan();
    00085   static void ResetConfig();
    00086
    00090   static void Save();
    00091
    00095   static void Load(int version);
    00096
    00098   static char *GetConsoleList(char *p, const char *last, bool newest_only = false);
    00100   static char *GetConsoleLibraryList(char *p, const char *last);
    00102   static const ScriptInfoList *GetInfoList();
    00104   static const ScriptInfoList *GetUniqueInfoList();
    00106   static class GameInfo *FindInfo(const char *name, int version, bool force_exact_match);
    00108   static class GameLibrary *FindLibrary(const char *library, int version);
    00109
    00113   static class GameInstance *GetInstance() { return Game::instance; }
    00114
    00118   static const char *GetMainScript();
    00119
    00120 #if defined(ENABLE_NETWORK)
    00121
    00122   static bool HasGame(const struct ContentInfo *ci, bool md5sum);
    00123   static bool HasGameLibrary(const ContentInfo *ci, bool md5sum);
    00124 #endif
    00125
    00126   static GameScannerInfo *GetScannerInfo();
    00128   static GameScannerLibrary *GetScannerLibrary();
    00129
    00130 private:
    00131   static uint frame_counter;
    00132   static class GameInstance *instance;
    00133   static class GameScannerInfo *scanner_info;
    00134   static class GameScannerLibrary *scanner_library;
    00135   static class GameInfo *info;
    00136 };
    00137
    00138 #endif /* GAME_HPP */