diff options
author | truebrain <truebrain@openttd.org> | 2011-12-19 20:58:59 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-19 20:58:59 +0000 |
commit | 55de5d336c2b82aa2393a28e09b64f72f4661a25 (patch) | |
tree | e22b50238bfb53086c4e27e0d8487f9e332f7b6f /src/script/api/script_game.hpp | |
parent | 5ff98b45c1f9097f521c95cfa46728e1f39a8f6d (diff) | |
download | openttd-55de5d336c2b82aa2393a28e09b64f72f4661a25.tar.xz |
(svn r23618) -Add: ScriptGame::Pause, ScriptGame::Unpause, and ScriptGame::GetLandscape (GameScript only)
Diffstat (limited to 'src/script/api/script_game.hpp')
-rw-r--r-- | src/script/api/script_game.hpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/script/api/script_game.hpp b/src/script/api/script_game.hpp new file mode 100644 index 000000000..3b66ba1f8 --- /dev/null +++ b/src/script/api/script_game.hpp @@ -0,0 +1,68 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * 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. + * 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. + * 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/>. + */ + +/** @file script_game.hpp Everything to manipulate the current running game. */ + +#ifndef SCRIPT_GAME_HPP +#define SCRIPT_GAME_HPP + +#include "script_object.hpp" +#include "../../landscape_type.h" + +/** + * Class that handles some game related functions. + * @api game + */ +class ScriptGame : public ScriptObject { +public: + /** + * Type of landscapes known in the game. + */ + enum LandscapeType { + /* Note: these values represent part of the in-game LandscapeType enum */ + LT_TEMPERATE = ::LT_TEMPERATE, ///< Temperate climiate. + LT_ARCTIC = ::LT_ARCTIC, ///< Arctic climate. + LT_TROPIC = ::LT_TROPIC, ///< Tropic climate. + LT_TOYLAND = ::LT_TOYLAND, ///< Toyland climate. + }; + + /** + * Pause the server. + * @return True if the action succeeded. + */ + static bool Pause(); + + /** + * Unpause the server. + * @return True if the action succeeded. + */ + static bool Unpause(); + + /** + * Check if the game is paused. + * @return True if and only if the game is paused (by which-ever means). + * @note That a game is paused, doesn't always means you can unpause it. If + * the game has been manually paused, or because of the pause_on_join in + * Multiplayer for example, you cannot unpause the game. + */ + static bool IsPaused(); + + /** + * Get the current landscape. + */ + static LandscapeType GetLandscape(); + + /** + * Is this a multiplayer game? + * @return True if this is a server in a multiplayer game. + */ + static bool IsMultiplayer(); +}; + +#endif /* SCRIPT_GAME_HPP */ |