Fix some daylength issues, possible division by zero in main menu.
[openttd-joker.git] / src / script / api / script_game.cpp
blobe52642515d733fa693f4d77779598592854559e4
1 /* $Id: script_game.cpp 23740 2012-01-03 21:32:51Z rubidium $ */
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 */
10 /** @file script_game.cpp Implementation of ScriptGame. */
12 #include "../../stdafx.h"
13 #include "script_game.hpp"
14 #include "../../command_type.h"
15 #include "../../settings_type.h"
16 #include "../../network/network.h"
18 #include "../../safeguards.h"
20 /* static */ bool ScriptGame::Pause()
22 return ScriptObject::DoCommand(0, PM_PAUSED_GAME_SCRIPT, 1, CMD_PAUSE);
25 /* static */ bool ScriptGame::Unpause()
27 return ScriptObject::DoCommand(0, PM_PAUSED_GAME_SCRIPT, 0, CMD_PAUSE);
30 /* static */ bool ScriptGame::IsPaused()
32 return !!_pause_mode;
35 /* static */ ScriptGame::LandscapeType ScriptGame::GetLandscape()
37 return (ScriptGame::LandscapeType)_settings_game.game_creation.landscape;
40 /* static */ bool ScriptGame::IsMultiplayer()
42 #ifdef ENABLE_NETWORK
43 return _network_server;
44 #else
45 return false;
46 #endif