OpenTTD Source: src/openttd.h Source File

OpenTTD Source 13.1

openttd.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
7
10 #ifndef OPENTTD_H
11 #define OPENTTD_H
12
13 #include <atomic>
14 #include "core/enum_type.hpp"
15
17 enum GameMode {
18 GM_MENU,
19 GM_NORMAL,
20 GM_EDITOR,
21 GM_BOOTSTRAP
22 };
23
25 enum SwitchMode {
26 SM_NONE,
27 SM_NEWGAME,
28 SM_RESTARTGAME,
29 SM_RELOADGAME,
30 SM_EDITOR,
31 SM_LOAD_GAME,
32 SM_MENU,
33 SM_SAVE_GAME,
34 SM_SAVE_HEIGHTMAP,
35 SM_GENRANDLAND,
36 SM_LOAD_SCENARIO,
37 SM_START_HEIGHTMAP,
38 SM_LOAD_HEIGHTMAP,
39 SM_RESTART_HEIGHTMAP,
40 SM_JOIN_GAME,
41 };
42
44 enum DisplayOptions {
45 DO_SHOW_TOWN_NAMES = 0,
46 DO_SHOW_STATION_NAMES = 1,
47 DO_SHOW_SIGNS = 2,
48 DO_FULL_ANIMATION = 3,
49 DO_FULL_DETAIL = 5,
50 DO_SHOW_WAYPOINT_NAMES = 6,
51 DO_SHOW_COMPETITOR_SIGNS = 7,
52 };
53
54 extern GameMode _game_mode;
55 extern SwitchMode _switch_mode;
56 extern std::atomic<bool> _exit_game;
57 extern bool _save_config;
58
60 enum PauseMode : byte {
61 PM_UNPAUSED = 0,
62 PM_PAUSED_NORMAL = 1 << 0,
63 PM_PAUSED_SAVELOAD = 1 << 1,
64 PM_PAUSED_JOIN = 1 << 2,
65 PM_PAUSED_ERROR = 1 << 3,
66 PM_PAUSED_ACTIVE_CLIENTS = 1 << 4,
67 PM_PAUSED_GAME_SCRIPT = 1 << 5,
68 PM_PAUSED_LINK_GRAPH = 1 << 6,
69
71 PMB_PAUSED_NETWORK = PM_PAUSED_ACTIVE_CLIENTS | PM_PAUSED_JOIN,
72 };
73 DECLARE_ENUM_AS_BIT_SET(PauseMode)
74
75
76 extern PauseMode _pause_mode;
77
78 void AskExitGame();
79 void AskExitToGameMenu();
80
81 int openttd_main(int argc, char *argv[]);
82 void HandleExitGameRequest();
83
84 void SwitchToMode(SwitchMode new_mode);
85
86 bool RequestNewGRFScan(struct NewGRFScanCallback *callback = nullptr);
87
88 #endif /* OPENTTD_H */
DO_SHOW_COMPETITOR_SIGNS
@ DO_SHOW_COMPETITOR_SIGNS
Display signs, station names and waypoint names of opponent companies. Buoys and oilrig-stations are ...
Definition: openttd.h:51
SwitchMode
SwitchMode
Mode which defines what mode we're switching to.
Definition: openttd.h:25
SM_START_HEIGHTMAP
@ SM_START_HEIGHTMAP
Load a heightmap and start a new game from it.
Definition: openttd.h:37
SM_LOAD_GAME
@ SM_LOAD_GAME
Load game, Play Scenario.
Definition: openttd.h:31
SM_EDITOR
@ SM_EDITOR
Switch to scenario editor.
Definition: openttd.h:30
DisplayOptions
DisplayOptions
Display Options.
Definition: openttd.h:44
PMB_PAUSED_NETWORK
@ PMB_PAUSED_NETWORK
Pause mode bits when paused for network reasons.
Definition: openttd.h:71
SM_LOAD_SCENARIO
@ SM_LOAD_SCENARIO
Load scenario from scenario editor.
Definition: openttd.h:36
PM_UNPAUSED
@ PM_UNPAUSED
A normal unpaused game.
Definition: openttd.h:61
DO_FULL_ANIMATION
@ DO_FULL_ANIMATION
Perform palette animation.
Definition: openttd.h:48
PM_PAUSED_SAVELOAD
@ PM_PAUSED_SAVELOAD
A game paused for saving/loading.
Definition: openttd.h:63
SM_NEWGAME
@ SM_NEWGAME
New Game --> 'Random game'.
Definition: openttd.h:27
SM_SAVE_HEIGHTMAP
@ SM_SAVE_HEIGHTMAP
Save heightmap.
Definition: openttd.h:34
RequestNewGRFScan
bool RequestNewGRFScan(struct NewGRFScanCallback *callback=nullptr)
Request a new NewGRF scan.
Definition: openttd.cpp:1453
DO_SHOW_STATION_NAMES
@ DO_SHOW_STATION_NAMES
Display station names.
Definition: openttd.h:46
PauseMode
PauseMode
Modes of pausing we've got.
Definition: openttd.h:60
GameMode
GameMode
Mode which defines the state of the game.
Definition: openttd.h:17
SM_GENRANDLAND
@ SM_GENRANDLAND
Generate random land within scenario editor.
Definition: openttd.h:35
SM_SAVE_GAME
@ SM_SAVE_GAME
Save game.
Definition: openttd.h:33
DO_FULL_DETAIL
@ DO_FULL_DETAIL
Also draw details of track and roads.
Definition: openttd.h:49
PM_PAUSED_GAME_SCRIPT
@ PM_PAUSED_GAME_SCRIPT
A game paused by a game script.
Definition: openttd.h:67
openttd_main
int openttd_main(int argc, char *argv[])
Main entry point for this lovely game.
Definition: openttd.cpp:531
SM_LOAD_HEIGHTMAP
@ SM_LOAD_HEIGHTMAP
Load heightmap from scenario editor.
Definition: openttd.h:38
PM_PAUSED_ACTIVE_CLIENTS
@ PM_PAUSED_ACTIVE_CLIENTS
A game paused for 'min_active_clients'.
Definition: openttd.h:66
_switch_mode
SwitchMode _switch_mode
The next mainloop command.
Definition: gfx.cpp:49
PM_PAUSED_NORMAL
@ PM_PAUSED_NORMAL
A game normally paused.
Definition: openttd.h:62
SM_RESTART_HEIGHTMAP
@ SM_RESTART_HEIGHTMAP
Load a heightmap and start a new game from it with current settings.
Definition: openttd.h:39
DO_SHOW_SIGNS
@ DO_SHOW_SIGNS
Display signs.
Definition: openttd.h:47
DO_SHOW_TOWN_NAMES
@ DO_SHOW_TOWN_NAMES
Display town names.
Definition: openttd.h:45
SM_RELOADGAME
@ SM_RELOADGAME
Reload the savegame / scenario / heightmap you started the game with.
Definition: openttd.h:29
SM_MENU
@ SM_MENU
Switch to game intro menu.
Definition: openttd.h:32
PM_PAUSED_LINK_GRAPH
@ PM_PAUSED_LINK_GRAPH
A game paused due to the link graph schedule lagging.
Definition: openttd.h:68
enum_type.hpp
PM_PAUSED_JOIN
@ PM_PAUSED_JOIN
A game paused for 'pause_on_join'.
Definition: openttd.h:64
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
NewGRFScanCallback
Callback for NewGRF scanning.
Definition: newgrf_config.h:213
PM_PAUSED_ERROR
@ PM_PAUSED_ERROR
A game paused because a (critical) error.
Definition: openttd.h:65
SM_JOIN_GAME
@ SM_JOIN_GAME
Join a network game.
Definition: openttd.h:40
DO_SHOW_WAYPOINT_NAMES
@ DO_SHOW_WAYPOINT_NAMES
Display waypoint names.
Definition: openttd.h:50
_pause_mode
PauseMode _pause_mode
The current pause mode.
Definition: gfx.cpp:50
SM_RESTARTGAME
@ SM_RESTARTGAME
Restart --> 'Random game' with current settings.
Definition: openttd.h:28