Files @ r27710:ffce37a1a229
Branch filter:

Location: cpp/openttd-patchpack/source/src/openttd.h - annotation

Patric Stout
Fix: [CI] preview for one PR could cancel the preview of another (#11121)
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r9111:983de9c5a848
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r25710:60c9c8536270
r27371:b9ad4c1bff08
r11847:235c011992a8
r11847:235c011992a8
r17330:ddf80ef4b607
r11222:f66b1fc27a15
r8121:d05602c69734
r8121:d05602c69734
r11222:f66b1fc27a15
r18398:d59db4740015
r8121:d05602c69734
r8121:d05602c69734
r17330:ddf80ef4b607
r11223:d5864a79dfb6
r11223:d5864a79dfb6
r24346:26e38cece3d1
r24346:26e38cece3d1
r24642:720af5d46e64
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r24346:26e38cece3d1
r25347:06f82554f1b8
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r17675:70155598b958
r15173:a59afd6301a6
r17675:70155598b958
r17675:70155598b958
r17675:70155598b958
r17675:70155598b958
r17675:70155598b958
r17675:70155598b958
r17894:3efa365a1d98
r6427:94a91cd8da86
r6427:94a91cd8da86
r11222:f66b1fc27a15
r11223:d5864a79dfb6
r27371:b9ad4c1bff08
r25710:60c9c8536270
r24420:db10f80aa828
r11847:235c011992a8
r11847:235c011992a8
r23680:22892a275fd4
r13520:b28b2da3bc7b
r13520:b28b2da3bc7b
r13520:b28b2da3bc7b
r13520:b28b2da3bc7b
r13520:b28b2da3bc7b
r13520:b28b2da3bc7b
r18760:babf79514cd5
r24483:c8962d3f47a6
r27177:0168210eb854
r13607:a7e0aef7f832
r17675:70155598b958
r13607:a7e0aef7f832
r11847:235c011992a8
r14900:c679fdaeebe6
r11847:235c011992a8
r11847:235c011992a8
r23680:22892a275fd4
r8121:d05602c69734
r17264:fce9f3d3fb3f
r17264:fce9f3d3fb3f
r17264:fce9f3d3fb3f
r20485:b630adf7e860
r26832:a6bd9039c80b
r17264:fce9f3d3fb3f
r17264:fce9f3d3fb3f
r18613:c44011152b31
r18613:c44011152b31
r25168:6c3c16b68f58
r27371:b9ad4c1bff08
r25029:37f02ef4446d
r26832:a6bd9039c80b
r27177:0168210eb854
r26832:a6bd9039c80b
r5475:3f5cd13d1b63
/*
 * 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 openttd.h Some generic types. */

#ifndef OPENTTD_H
#define OPENTTD_H

#include <atomic>
#include <chrono>
#include "core/enum_type.hpp"

/** Mode which defines the state of the game. */
enum GameMode {
	GM_MENU,
	GM_NORMAL,
	GM_EDITOR,
	GM_BOOTSTRAP
};

/** Mode which defines what mode we're switching to. */
enum SwitchMode {
	SM_NONE,
	SM_NEWGAME,           ///< New Game --> 'Random game'.
	SM_RESTARTGAME,       ///< Restart --> 'Random game' with current settings.
	SM_RELOADGAME,        ///< Reload the savegame / scenario / heightmap you started the game with.
	SM_EDITOR,            ///< Switch to scenario editor.
	SM_LOAD_GAME,         ///< Load game, Play Scenario.
	SM_MENU,              ///< Switch to game intro menu.
	SM_SAVE_GAME,         ///< Save game.
	SM_SAVE_HEIGHTMAP,    ///< Save heightmap.
	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.
	SM_RESTART_HEIGHTMAP, ///< Load a heightmap and start a new game from it with current settings.
	SM_JOIN_GAME,         ///< Join a network game.
};

/** Display Options */
enum DisplayOptions {
	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.
	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.
};

extern GameMode _game_mode;
extern SwitchMode _switch_mode;
extern std::chrono::steady_clock::time_point _switch_mode_time;
extern std::atomic<bool> _exit_game;
extern bool _save_config;

/** Modes of pausing we've got */
enum PauseMode : byte {
	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'
	PM_PAUSED_GAME_SCRIPT    = 1 << 5, ///< A game paused by a game script
	PM_PAUSED_LINK_GRAPH     = 1 << 6, ///< A game paused due to the link graph schedule lagging
	PM_COMMAND_DURING_PAUSE  = 1 << 7, ///< A game paused, and a command executed during the pause; resets on autosave

	/** Pause mode bits when paused for network reasons. */
	PMB_PAUSED_NETWORK = PM_PAUSED_ACTIVE_CLIENTS | PM_PAUSED_JOIN,
};
DECLARE_ENUM_AS_BIT_SET(PauseMode)

/** The current pause mode */
extern PauseMode _pause_mode;

void AskExitGame();
void AskExitToGameMenu();

int openttd_main(int argc, char *argv[]);
void StateGameLoop();
void HandleExitGameRequest();

void SwitchToMode(SwitchMode new_mode);

bool RequestNewGRFScan(struct NewGRFScanCallback *callback = nullptr);
void GenerateSavegameId();

void OpenBrowser(const char *url);
void ChangeAutosaveFrequency(bool reset);

#endif /* OPENTTD_H */