2005-07-24 14:12:37 +00:00
/* $Id$ */
2008-04-19 10:18:38 +00:00
2009-08-21 20:21:05 +00:00
/*
* 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/>.
*/
2008-05-06 15:11:33 +00:00
/** @file openttd.h Some generic types. */
2005-07-24 14:12:37 +00:00
2005-07-15 21:28:26 +00:00
# ifndef OPENTTD_H
# define OPENTTD_H
2004-08-09 17:04:08 +00:00
2009-05-06 15:06:57 +00:00
# include "core/enum_type.hpp"
2011-02-14 19:52:26 +00:00
/** Mode which defines the state of the game. */
2009-02-25 00:14:46 +00:00
enum GameMode {
2007-12-22 23:30:28 +00:00
GM_MENU ,
GM_NORMAL ,
2009-02-25 00:14:46 +00:00
GM_EDITOR ,
2011-11-17 21:17:17 +00:00
GM_BOOTSTRAP
2007-12-22 23:30:28 +00:00
} ;
2011-02-14 19:52:26 +00:00
/** Mode which defines what mode we're switching to. */
2009-02-25 00:45:52 +00:00
enum SwitchMode {
SM_NONE ,
2011-05-28 09:56:14 +00:00
SM_NEWGAME , ///< New Game --> 'Random game'.
SM_RESTARTGAME , ///< Restart --> 'Random game' with current settings.
SM_EDITOR , ///< Switch to scenario editor.
2011-05-28 13:55:34 +00:00
SM_LOAD_GAME , ///< Load game, Play Scenario.
2011-05-28 09:56:14 +00:00
SM_MENU , ///< Switch to game intro menu.
2011-05-28 13:55:34 +00:00
SM_SAVE_GAME , ///< Save game.
SM_SAVE_HEIGHTMAP , ///< Save heightmap.
2011-05-28 09:56:14 +00:00
SM_GENRANDLAND , ///< Generate random land within scenario editor.
SM_LOAD_SCENARIO , ///< Load scenario from scenario editor.
SM_START_HEIGHTMAP , ///< Load a heightmap and start a new game from it.
SM_LOAD_HEIGHTMAP , ///< Load heightmap from scenario editor.
2004-08-09 17:04:08 +00:00
} ;
2011-05-14 18:38:54 +00:00
/** Display Options */
2010-05-13 09:44:44 +00:00
enum DisplayOptions {
2011-05-14 18:38:54 +00:00
DO_SHOW_TOWN_NAMES = 0 , ///< Display town names.
DO_SHOW_STATION_NAMES = 1 , ///< Display station names.
DO_SHOW_SIGNS = 2 , ///< Display signs.
DO_FULL_ANIMATION = 3 , ///< Perform palette animation.
DO_FULL_DETAIL = 5 , ///< Also draw details of track and roads.
DO_SHOW_WAYPOINT_NAMES = 6 , ///< Display waypoint names.
2011-08-01 18:41:21 +00:00
DO_SHOW_COMPETITOR_SIGNS = 7 , ///< Display signs, station names and waypoint names of opponent companies. Buoys and oilrig-stations are always shown, even if this option is turned off.
2007-04-05 07:49:04 +00:00
} ;
2009-02-25 00:14:46 +00:00
extern GameMode _game_mode ;
2009-02-25 00:45:52 +00:00
extern SwitchMode _switch_mode ;
2007-12-22 23:30:28 +00:00
extern bool _exit_game ;
2009-05-06 15:06:57 +00:00
/** Modes of pausing we've got */
enum PauseMode {
2009-11-12 17:46:04 +00:00
PM_UNPAUSED = 0 , ///< A normal unpaused game
PM_PAUSED_NORMAL = 1 < < 0 , ///< A game normally paused
PM_PAUSED_SAVELOAD = 1 < < 1 , ///< A game paused for saving/loading
PM_PAUSED_JOIN = 1 < < 2 , ///< A game paused for 'pause_on_join'
PM_PAUSED_ERROR = 1 < < 3 , ///< A game paused because a (critical) error
PM_PAUSED_ACTIVE_CLIENTS = 1 < < 4 , ///< A game paused for 'min_active_clients'
2011-12-19 20:58:59 +00:00
PM_PAUSED_GAME_SCRIPT = 1 < < 5 , ///< A game paused by a game script
2009-11-17 14:06:28 +00:00
2011-05-14 18:38:54 +00:00
/** Pause mode bits when paused for network reasons. */
2009-11-17 14:06:28 +00:00
PMB_PAUSED_NETWORK = PM_PAUSED_ACTIVE_CLIENTS | PM_PAUSED_JOIN ,
2009-05-06 15:06:57 +00:00
} ;
2010-03-23 22:25:43 +00:00
DECLARE_ENUM_AS_BIT_SET ( PauseMode )
2009-05-06 15:06:57 +00:00
typedef SimpleTinyEnumT < PauseMode , byte > PauseModeByte ;
/** The current pause mode */
extern PauseModeByte _pause_mode ;
2007-12-22 23:30:28 +00:00
2011-02-07 22:15:46 +00:00
void AskExitGame ( ) ;
void AskExitToGameMenu ( ) ;
int ttd_main ( int argc , char * argv [ ] ) ;
void HandleExitGameRequest ( ) ;
2011-12-10 08:31:14 +00:00
void SwitchToMode ( SwitchMode new_mode ) ;
2005-07-15 21:28:26 +00:00
# endif /* OPENTTD_H */