1
0
Fork 0

Codechange: Specify underlying type for all enums excluding those exposed to scripts. (#13383)

pull/13403/head
Peter Nelson 2025-01-28 22:17:34 +00:00 committed by GitHub
parent 6fda85c569
commit afc0745aa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
180 changed files with 371 additions and 367 deletions

View File

@ -25,7 +25,7 @@ static constexpr int HELICOPTER_HOLD_MAX_FLYING_ALTITUDE = 184; ///< holding fly
struct Aircraft;
/** An aircraft can be one of those types. */
enum AircraftSubType {
enum AircraftSubType : uint8_t {
AIR_HELICOPTER = 0, ///< an helicopter
AIR_AIRCRAFT = 2, ///< an airplane
AIR_SHADOW = 4, ///< shadow of the aircraft
@ -33,7 +33,7 @@ enum AircraftSubType {
};
/** Flags for air vehicles; shared with disaster vehicles. */
enum AirVehicleFlags {
enum AirVehicleFlags : uint8_t {
VAF_DEST_TOO_FAR = 0, ///< Next destination is too far away.
/* The next two flags are to prevent stair climbing of the aircraft. The idea is that the aircraft

View File

@ -107,7 +107,7 @@ bool IsValidImageIndex<VEH_AIRCRAFT>(uint8_t image_index)
}
/** Helicopter rotor animation states */
enum HelicopterRotorStates {
enum HelicopterRotorStates : uint8_t {
HRS_ROTOR_STOPPED,
HRS_ROTOR_MOVING_1,
HRS_ROTOR_MOVING_2,

View File

@ -25,7 +25,7 @@ static const uint NEW_AIRPORTTILE_OFFSET = 74; ///< offset of firs
static const uint INVALID_AIRPORTTILE = NUM_AIRPORTTILES; ///< id for an invalid airport tile
/** Airport types */
enum AirportTypes {
enum AirportTypes : uint8_t {
AT_SMALL = 0, ///< Small airport.
AT_LARGE = 1, ///< Large airport.
AT_HELIPORT = 2, ///< Heli port.
@ -44,7 +44,7 @@ enum AirportTypes {
};
/** Flags for airport movement data. */
enum AirportMovingDataFlags {
enum AirportMovingDataFlags : uint16_t {
AMED_NOSPDCLAMP = 1 << 0, ///< No speed restrictions.
AMED_TAKEOFF = 1 << 1, ///< Takeoff movement.
AMED_SLOWTURN = 1 << 2, ///< Turn slowly (mostly used in the air).
@ -57,7 +57,7 @@ enum AirportMovingDataFlags {
};
/** Movement States on Airports (headings target) */
enum AirportMovementStates {
enum AirportMovementStates : uint8_t {
TO_ALL = 0, ///< Go in this direction for every target.
HANGAR = 1, ///< Heading for hangar.
TERM1 = 2, ///< Heading for terminal 1.
@ -143,7 +143,7 @@ struct AirportFTAbuildup;
struct AirportFTAClass {
public:
/** Bitmask of airport flags. */
enum Flags {
enum Flags : uint8_t {
AIRPLANES = 0x1, ///< Can planes land on this airport type?
HELICOPTERS = 0x2, ///< Can helicopters land on this airport type?
ALL = AIRPLANES | HELICOPTERS, ///< Mask to check for both planes and helicopters.

View File

@ -24,7 +24,7 @@ struct ContentInfo;
/** Structure holding filename and MD5 information about a single file */
struct MD5File {
/** The result of a checksum check */
enum ChecksumResult {
enum ChecksumResult : uint8_t {
CR_UNKNOWN, ///< The file has not been checked yet
CR_MATCH, ///< The file did exist and the md5 checksum did match
CR_MISMATCH, ///< The file did exist, just the md5 checksum did not match
@ -238,7 +238,7 @@ template <class Tbase_set>
const char *TryGetBaseSetFile(const ContentInfo *ci, bool md5sum, const Tbase_set *s);
/** Types of graphics in the base graphics set */
enum GraphicsFileType {
enum GraphicsFileType : uint8_t {
GFT_BASE, ///< Base sprites for all climates
GFT_LOGOS, ///< Logos, landscape icons and original terrain generator sprites
GFT_ARCTIC, ///< Landscape replacement sprites for arctic
@ -249,7 +249,7 @@ enum GraphicsFileType {
};
/** Blitter type for base graphics sets. */
enum BlitterType {
enum BlitterType : uint8_t {
BLT_8BPP, ///< Base set has 8 bpp sprites only.
BLT_32BPP, ///< Base set has both 8 bpp and 32 bpp sprites.
};
@ -316,7 +316,7 @@ static const uint NUM_SONGS_PLAYLIST = 32;
std::optional<std::string> GetMusicCatEntryName(const std::string &filename, size_t entrynum);
std::optional<std::vector<uint8_t>> GetMusicCatEntryData(const std::string &filename, size_t entrynum);
enum MusicTrackType {
enum MusicTrackType : uint8_t {
MTT_STANDARDMIDI, ///< Standard MIDI file
MTT_MPSMIDI, ///< MPS GM driver MIDI format (contained in a CAT file)
};

View File

@ -34,8 +34,7 @@ struct RoadStopTileData {
/** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */
struct StationRect : public Rect {
enum StationRectMode
{
enum StationRectMode : uint8_t {
ADD_TEST = 0,
ADD_TRY,
ADD_FORCE

View File

@ -38,14 +38,14 @@ public:
static_assert(sizeof(MapValue) == 2);
/** Helper for creating specialised functions for specific optimisations. */
enum ReadMode {
enum ReadMode : uint8_t {
RM_WITH_SKIP, ///< Use normal code for skipping empty pixels.
RM_WITH_MARGIN, ///< Use cached number of empty pixels at begin and end of line to reduce work.
RM_NONE, ///< No specialisation.
};
/** Helper for creating specialised functions for the case where the sprite width is odd or even. */
enum BlockType {
enum BlockType : uint8_t {
BT_EVEN, ///< An even number of pixels in the width; no need for a special case for the last pixel.
BT_ODD, ///< An odd number of pixels in the width; special case for the last pixel.
BT_NONE, ///< No specialisation for either case.
@ -56,7 +56,7 @@ public:
* - calculations (alpha blending),
* - heavy branching (remap lookups and animation buffer handling).
*/
enum SpriteFlags {
enum SpriteFlags : uint8_t {
SF_NONE = 0,
SF_TRANSLUCENT = 1 << 1, ///< The sprite has at least 1 translucent pixel.
SF_NO_REMAP = 1 << 2, ///< The sprite has no remappable colour pixel.

View File

@ -19,7 +19,7 @@
* which is used to determine the proper sprite table to use
* while drawing a given bridge part.
*/
enum BridgePieces {
enum BridgePieces : uint8_t {
BRIDGE_PIECE_NORTH = 0,
BRIDGE_PIECE_SOUTH,
BRIDGE_PIECE_INNER_NORTH,

View File

@ -1159,7 +1159,7 @@ void GUIEngineListAddChildren(GUIEngineList &dst, const GUIEngineList &src, Engi
}
/** Enum referring to the Hotkeys in the build vehicle window */
enum BuildVehicleHotkeys {
enum BuildVehicleHotkeys : int32_t {
BVHK_FOCUS_FILTER_BOX, ///< Focus the edit box for editing the filter string
};

View File

@ -80,7 +80,7 @@ static const CargoType CARGO_NO_REFIT = 0xFE; ///< Do not refit cargo of a vehic
static const CargoType INVALID_CARGO = UINT8_MAX;
/** Mixed cargo types for definitions with cargo that can vary depending on climate. */
enum MixedCargoType {
enum MixedCargoType : uint8_t {
MCT_LIVESTOCK_FRUIT, ///< Cargo can be livestock or fruit.
MCT_GRAIN_WHEAT_MAIZE, ///< Cargo can be grain, wheat or maize.
MCT_VALUABLES_GOLD_DIAMONDS, ///< Cargo can be valuables, gold or diamonds.

View File

@ -292,7 +292,7 @@ public:
typedef typename Tcont::const_reverse_iterator ConstReverseIterator;
/** Kind of actions that could be done with packets on move. */
enum MoveToAction {
enum MoveToAction : uint8_t {
MTA_BEGIN = 0,
MTA_TRANSFER = 0, ///< Transfer the cargo to the station.
MTA_DELIVER, ///< Deliver the cargo to some town or industry.

View File

@ -168,7 +168,7 @@ static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t)
}
/** Available cheats. */
enum CheatNumbers {
enum CheatNumbers : uint8_t {
CHT_MONEY, ///< Change amount of money.
CHT_CHANGE_COMPANY, ///< Switch company.
CHT_EXTRA_DYNAMITE, ///< Dynamite anything.

View File

@ -16,7 +16,7 @@
/**
* Ground types. Valid densities in comments after the enum.
*/
enum ClearGround {
enum ClearGround : uint8_t {
CLEAR_GRASS = 0, ///< 0-3
CLEAR_ROUGH = 1, ///< 3
CLEAR_ROCKS = 2, ///< 3

View File

@ -184,7 +184,7 @@ public:
*
* @see _command_proc_table
*/
enum Commands : uint16_t {
enum Commands : uint8_t {
CMD_BUILD_RAILROAD_TRACK, ///< build a rail track
CMD_REMOVE_RAILROAD_TRACK, ///< remove a rail track
CMD_BUILD_SINGLE_RAIL, ///< build a single rail track
@ -371,7 +371,7 @@ enum Commands : uint16_t {
*
* This enums defines some flags which can be used for the commands.
*/
enum DoCommandFlag {
enum DoCommandFlag : uint16_t {
DC_NONE = 0x000, ///< no flag is set
DC_EXEC = 0x001, ///< execute the given command
DC_AUTO = 0x002, ///< don't allow building on structures
@ -393,7 +393,7 @@ DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
*
* This enumeration defines flags for the _command_proc_table.
*/
enum CommandFlags {
enum CommandFlags : uint16_t {
CMD_SERVER = 0x001, ///< the command can only be initiated by the server
CMD_SPECTATOR = 0x002, ///< the command may be initiated by a spectator
CMD_OFFLINE = 0x004, ///< the command cannot be executed in a multiplayer game; single-player only
@ -410,7 +410,7 @@ enum CommandFlags {
DECLARE_ENUM_AS_BIT_SET(CommandFlags)
/** Types of commands we have. */
enum CommandType {
enum CommandType : uint8_t {
CMDT_LANDSCAPE_CONSTRUCTION, ///< Construction and destruction of objects on the map.
CMDT_VEHICLE_CONSTRUCTION, ///< Construction, modification (incl. refit) and destruction of vehicles.
CMDT_MONEY_MANAGEMENT, ///< Management of money, i.e. loans.
@ -425,7 +425,7 @@ enum CommandType {
};
/** Different command pause levels. */
enum CommandPauseLevel {
enum CommandPauseLevel : uint8_t {
CMDPL_NO_ACTIONS, ///< No user actions may be executed.
CMDPL_NO_CONSTRUCTION, ///< No construction actions may be executed.
CMDPL_NO_LANDSCAPING, ///< No landscaping actions may be executed.

View File

@ -2208,7 +2208,7 @@ struct CompanyWindow : Window
CompanyWidgets query_widget;
/** Display planes in the company window. */
enum CompanyWindowPlanes {
enum CompanyWindowPlanes : uint8_t {
/* Display planes of the #WID_C_SELECT_VIEW_BUILD_HQ selection widget. */
CWP_VB_VIEW = 0, ///< Display the view button
CWP_VB_BUILD, ///< Display the build button

View File

@ -16,7 +16,7 @@
#include "company_type.h"
/** The gender/race combinations that we have faces for */
enum GenderEthnicity {
enum GenderEthnicity : uint8_t {
GENDER_FEMALE = 0, ///< This bit set means a female, otherwise male
ETHNICITY_BLACK = 1, ///< This bit set means black, otherwise white
@ -29,7 +29,7 @@ enum GenderEthnicity {
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) ///< See GenderRace as a bitset
/** Bitgroups of the CompanyManagerFace variable */
enum CompanyManagerFaceVariable {
enum CompanyManagerFaceVariable : uint8_t {
CMFV_GENDER,
CMFV_ETHNICITY,
CMFV_GEN_ETHN,

View File

@ -1959,7 +1959,7 @@ static std::vector<std::pair<std::string_view, NetworkAuthorizedKeys *>> _consol
{ "server", &_settings_client.network.server_authorized_keys },
};
enum ConNetworkAuthorizedKeyAction {
enum ConNetworkAuthorizedKeyAction : uint8_t {
CNAKA_LIST,
CNAKA_ADD,
CNAKA_REMOVE,

View File

@ -16,7 +16,7 @@ static const uint ICON_CMDLN_SIZE = 1024; ///< maximum length of a typed in
static const uint ICON_MAX_STREAMSIZE = 2048; ///< maximum length of a totally expanded command
/** Return values of console hooks (#IConsoleHook). */
enum ConsoleHookResult {
enum ConsoleHookResult : uint8_t {
CHR_ALLOW, ///< Allow command execution.
CHR_DISALLOW, ///< Disallow command execution.
CHR_HIDE, ///< Hide the existence of the command.

View File

@ -13,7 +13,7 @@
#include "gfx_type.h"
/** Modes of the in-game console. */
enum IConsoleModes {
enum IConsoleModes : uint8_t {
ICONSOLE_FULL, ///< In-game console is opened, whole screen.
ICONSOLE_OPENED, ///< In-game console is opened, upper 1/3 of the screen.
ICONSOLE_CLOSED, ///< In-game console is closed.

View File

@ -13,7 +13,7 @@
#include "enum_type.hpp"
/** Various types of a pool. */
enum PoolType {
enum PoolType : uint8_t {
PT_NONE = 0x00, ///< No pool is selected.
PT_NORMAL = 0x01, ///< Normal pool containing game objects.
PT_NCLIENT = 0x02, ///< Network client pools.

View File

@ -23,7 +23,7 @@ static constexpr TimerGameCalendar::Year MIN_EURO_YEAR{2000}; ///< The earliest
* savegame compatibility and in order to refer to them quickly, especially
* for referencing the custom one.
*/
enum Currencies {
enum Currencies : uint8_t {
CURRENCY_GBP, ///< British Pound
CURRENCY_USD, ///< US Dollar
CURRENCY_EUR, ///< Euro

View File

@ -436,7 +436,7 @@ struct DepotWindow : Window {
const Vehicle *wagon;
};
enum DepotGUIAction {
enum DepotGUIAction : uint8_t {
MODE_ERROR,
MODE_DRAG_VEHICLE,
MODE_SHOW_VEHICLE,

View File

@ -55,7 +55,7 @@ DECLARE_INCREMENT_DECREMENT_OPERATORS(Direction)
* modulo DIR_END or use the #ChangeDirDiff(DirDiff, DirDiff) function.
* @see ChangeDirDiff(DirDiff, DirDiff)
*/
enum DirDiff {
enum DirDiff : uint8_t {
DIRDIFF_SAME = 0, ///< Both directions faces to the same direction
DIRDIFF_45RIGHT = 1, ///< Angle of 45 degrees right
DIRDIFF_90RIGHT = 2, ///< Angle of 90 degrees right
@ -92,7 +92,7 @@ DECLARE_ENUM_AS_ADDABLE(DiagDirection)
*
* @see DirDiff
*/
enum DiagDirDiff {
enum DiagDirDiff : uint8_t {
DIAGDIRDIFF_BEGIN = 0, ///< Used for iterations
DIAGDIRDIFF_SAME = 0, ///< Same directions
DIAGDIRDIFF_90RIGHT = 1, ///< 90 degrees right

View File

@ -13,7 +13,7 @@
#include "vehicle_base.h"
/** Different sub types of disaster vehicles. */
enum DisasterSubType {
enum DisasterSubType : uint8_t {
ST_ZEPPELINER, ///< Zeppelin, crashes at airports.
ST_ZEPPELINER_SHADOW, ///< Shadow of the zeppelin.
ST_SMALL_UFO, ///< Small UFO, tries to find a road vehicle to destroy.

View File

@ -35,7 +35,7 @@ public:
virtual ~Driver() = default;
/** The type of driver */
enum Type {
enum Type : uint8_t {
DT_BEGIN = 0, ///< Helper for iteration
DT_MUSIC = 0, ///< A music driver, needs to be before sound to properly shut down extmidi forked music players
DT_SOUND, ///< A sound driver

View File

@ -57,7 +57,7 @@ struct Economy {
};
/** Score categories in the detailed performance rating. */
enum ScoreID {
enum ScoreID : uint8_t {
SCORE_BEGIN = 0,
SCORE_VEHICLES = 0,
SCORE_STATIONS = 1,
@ -71,11 +71,16 @@ enum ScoreID {
SCORE_TOTAL = 9, ///< This must always be the last entry
SCORE_END = 10, ///< How many scores are there..
SCORE_MAX = 1000, ///< The max score that can be in the performance history
/* the scores together of score_info is allowed to be more! */
};
DECLARE_INCREMENT_DECREMENT_OPERATORS(ScoreID)
/**
* The max score that can be in the performance history.
* The scores together of score_info is allowed to be more!
*/
static constexpr int SCORE_MAX = 1000;
/** Data structure for storing how the score is computed for a single score id. */
struct ScoreInfo {
int needed; ///< How much you need to get the perfect score
@ -195,7 +200,7 @@ using Expenses = std::array<Money, EXPENSES_END>;
/**
* Categories of a price bases.
*/
enum PriceCategory {
enum PriceCategory : uint8_t {
PCAT_NONE, ///< Not affected by difficulty settings
PCAT_RUNNING, ///< Price is affected by "vehicle running cost" difficulty setting
PCAT_CONSTRUCTION, ///< Price is affected by "construction cost" difficulty setting

View File

@ -13,7 +13,7 @@
#include "vehicle_type.h"
/** Effect vehicle types */
enum EffectVehicleType {
enum EffectVehicleType : uint8_t {
EV_CHIMNEY_SMOKE = 0, ///< Smoke of power plant (industry).
EV_STEAM_SMOKE = 1, ///< Smoke of steam engines.
EV_DIESEL_SMOKE = 2, ///< Smoke of diesel engines.

View File

@ -90,7 +90,7 @@ struct ShipVehicleInfo {
* If bit 0 is 0 then it is a helicopter, otherwise it is a plane
* in which case bit 1 tells us whether it's a big(fast) plane or not.
*/
enum AircraftSubTypeBits {
enum AircraftSubTypeBits : uint8_t {
AIR_HELI = 0,
AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes
AIR_FAST = 2
@ -168,7 +168,7 @@ struct EngineInfo {
/**
* EngineInfo.misc_flags is a bitmask, with the following values
*/
enum EngineMiscFlags {
enum EngineMiscFlags : uint8_t {
EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves
EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle
EF_USES_2CC = 1, ///< Vehicle uses two company colours
@ -183,7 +183,7 @@ enum EngineMiscFlags {
/**
* Engine.flags is a bitmask, with the following values.
*/
enum EngineFlags {
enum EngineFlags : uint8_t {
ENGINE_AVAILABLE = 1, ///< This vehicle is available to everyone.
ENGINE_EXCLUSIVE_PREVIEW = 2, ///< This vehicle is in the exclusive preview stage, either being used or being offered to a company.
};

View File

@ -20,7 +20,7 @@
struct GRFFile;
/** Message severity/type */
enum WarningLevel {
enum WarningLevel : uint8_t {
WL_INFO, ///< Used for DoCommand-like (and some non-fatal AI GUI) errors/information
WL_WARNING, ///< Other information
WL_ERROR, ///< Errors (eg. saving/loading failed)

View File

@ -60,7 +60,7 @@ class TarScanner : FileScanner {
uint DoScan(Subdirectory sd);
public:
/** The mode of tar scanning. */
enum Mode {
enum Mode : uint8_t {
NONE = 0, ///< Scan nothing.
BASESET = 1 << 0, ///< Scan for base sets.
NEWGRF = 1 << 1, ///< Scan for non-base sets.

View File

@ -13,7 +13,7 @@
#include "core/enum_type.hpp"
/** The different abstract types of files that the system knows about. */
enum AbstractFileType {
enum AbstractFileType : uint8_t {
FT_NONE, ///< nothing to do
FT_SAVEGAME, ///< old or new savegame
FT_SCENARIO, ///< old or new scenario
@ -26,7 +26,7 @@ enum AbstractFileType {
};
/** Kinds of files in each #AbstractFileType. */
enum DetailedFileType {
enum DetailedFileType : uint8_t {
/* Save game and scenario files. */
DFT_OLD_GAME_FILE, ///< Old save game or scenario file.
DFT_GAME_FILE, ///< Save game or scenario file.
@ -50,7 +50,7 @@ enum DetailedFileType {
};
/** Operation performed on the file. */
enum SaveLoadOperation {
enum SaveLoadOperation : uint8_t {
SLO_CHECK, ///< Load file for checking and/or preview.
SLO_LOAD, ///< File is being loaded.
SLO_SAVE, ///< File is being saved.
@ -70,7 +70,7 @@ enum SaveLoadOperation {
* Values are a combination of #AbstractFileType and #DetailedFileType.
* @see GetAbstractFileType GetDetailedFileType
*/
enum FiosType {
enum FiosType : uint16_t {
FIOS_TYPE_DRIVE = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DRIVE),
FIOS_TYPE_PARENT = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_PARENT),
FIOS_TYPE_DIR = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DIR),
@ -112,7 +112,7 @@ inline DetailedFileType GetDetailedFileType(FiosType fios_type)
/**
* The different kinds of subdirectories OpenTTD uses
*/
enum Subdirectory {
enum Subdirectory : uint8_t {
BASE_DIR, ///< Base directory for all subdirectories
SAVE_DIR, ///< Base directory for all savegames
AUTOSAVE_DIR, ///< Subdirectory of save for autosaves
@ -136,7 +136,7 @@ enum Subdirectory {
/**
* Types of searchpaths OpenTTD might use
*/
enum Searchpath : unsigned {
enum Searchpath : uint8_t {
SP_FIRST_DIR,
SP_WORKING_DIR = SP_FIRST_DIR, ///< Search in the working directory
#ifdef USE_XDG

View File

@ -19,7 +19,7 @@
/** Special values for save-load window for the data parameter of #InvalidateWindowData. */
enum SaveLoadInvalidateWindowData {
enum SaveLoadInvalidateWindowData : uint8_t {
SLIWD_RESCAN_FILES, ///< Rescan all files (when changed directory, ...)
SLIWD_SELECTION_CHANGES, ///< File selection has changed (user click, ...)
SLIWD_FILTER_CHANGES, ///< The filename filter has changed (via the editbox)
@ -91,7 +91,7 @@ public:
const FiosItem *FindItem(const std::string_view file);
};
enum SortingBits {
enum SortingBits : uint8_t {
SORT_ASCENDING = 0,
SORT_DESCENDING = 1,
SORT_BY_DATE = 0,

View File

@ -44,7 +44,7 @@
* @note When adding new elements here, make sure to also update all other locations depending on the length and order of this enum.
* See <em>Adding new measurements</em> above.
*/
enum PerformanceElement {
enum PerformanceElement : uint8_t {
PFE_FIRST = 0,
PFE_GAMELOOP = 0, ///< Speed of gameloop processing.
PFE_GL_ECONOMY, ///< Time spent processing cargo movement

View File

@ -13,7 +13,7 @@
#include "../strings_type.h"
struct StringParam {
enum ParamType {
enum ParamType : uint8_t {
UNUSED,
RAW_STRING,
STRING,

View File

@ -14,7 +14,7 @@
#include <thread>
/** Constants related to world generation */
enum LandscapeGenerator {
enum LandscapeGenerator : uint8_t {
/* Order of these enums has to be the same as in lang/english.txt
* Otherwise you will get inconsistent behaviour. */
LG_ORIGINAL = 0, ///< The original landscape generator
@ -24,7 +24,7 @@ enum LandscapeGenerator {
static const uint32_t GENERATE_NEW_SEED = UINT32_MAX; ///< Create a new random seed
/** Modes for GenerateWorld */
enum GenWorldMode {
enum GenWorldMode : uint8_t {
GWM_NEWGAME = 0, ///< Generate a map for a new game
GWM_EMPTY = 1, ///< Generate an empty map (sea-level)
GWM_RANDOM = 2, ///< Generate a random map for SE
@ -32,7 +32,7 @@ enum GenWorldMode {
};
/** Smoothness presets. */
enum TgenSmoothness {
enum TgenSmoothness : uint8_t {
TGEN_SMOOTHNESS_BEGIN, ///< First smoothness value.
TGEN_SMOOTHNESS_VERY_SMOOTH = TGEN_SMOOTHNESS_BEGIN, ///< Smoothness preset 'very smooth'.
TGEN_SMOOTHNESS_SMOOTH, ///< Smoothness preset 'smooth'.
@ -66,7 +66,7 @@ struct GenWorldInfo {
};
/** Current stage of world generation process */
enum GenWorldProgress {
enum GenWorldProgress : uint8_t {
GWP_MAP_INIT, ///< Initialize/allocate the map, start economy
GWP_LANDSCAPE, ///< Create the landscape
GWP_RIVER, ///< Create the rivers

View File

@ -43,7 +43,7 @@
extern void MakeNewgameSettingsLive();
/** Enum for the modes we can generate in. */
enum GenerateLandscapeWindowMode {
enum GenerateLandscapeWindowMode : uint8_t {
GLWM_GENERATE, ///< Generate new game.
GLWM_HEIGHTMAP, ///< Load from heightmap.
GLWM_SCENARIO, ///< Generate flat land.

View File

@ -24,7 +24,7 @@ struct PalSpriteID {
PaletteID pal; ///< The palette (use \c PAL_NONE) if not needed)
};
enum WindowKeyCodes {
enum WindowKeyCodes : uint16_t {
WKC_SHIFT = 0x8000,
WKC_CTRL = 0x4000,
WKC_ALT = 0x2000,
@ -239,7 +239,7 @@ static_assert(sizeof(Colour) == sizeof(uint32_t));
/** Available font sizes */
enum FontSize {
enum FontSize : uint8_t {
FS_NORMAL, ///< Index of the normal font in the font tables.
FS_SMALL, ///< Index of the small font in the font tables.
FS_LARGE, ///< Index of the large font in the font tables.
@ -291,7 +291,7 @@ DECLARE_INCREMENT_DECREMENT_OPERATORS(Colours)
DECLARE_ENUM_AS_ADDABLE(Colours)
/** Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palette.png */
enum TextColour {
enum TextColour : uint16_t {
TC_BEGIN = 0x00,
TC_FROMSTRING = 0x00,
TC_BLUE = 0x00,
@ -328,14 +328,14 @@ static constexpr uint8_t PALETTE_ANIM_SIZE = 28; ///< number of animated colours
static constexpr uint8_t PALETTE_ANIM_START = 227; ///< Index in the _palettes array from which all animations are taking places (table/palettes.h)
/** Define the operation GfxFillRect performs */
enum FillRectMode {
enum FillRectMode : uint8_t {
FILLRECT_OPAQUE, ///< Fill rectangle with a single colour
FILLRECT_CHECKER, ///< Draw only every second pixel, used for greying-out
FILLRECT_RECOLOUR, ///< Apply a recolour sprite to the screen content
};
/** Palettes OpenTTD supports. */
enum PaletteType {
enum PaletteType : uint8_t {
PAL_DOS, ///< Use the DOS palette.
PAL_WINDOWS, ///< Use the Windows palette.
};
@ -364,14 +364,14 @@ struct Palette {
};
/** Modes for 8bpp support */
enum Support8bpp {
enum Support8bpp : uint8_t {
S8BPP_NONE = 0, ///< No support for 8bpp by OS or hardware, force 32bpp blitters.
S8BPP_SYSTEM, ///< No 8bpp support by hardware, do not try to use 8bpp video modes or hardware palettes.
S8BPP_HARDWARE, ///< Full 8bpp support by OS and hardware.
};
/** How to align the to-be drawn text. */
enum StringAlignment {
enum StringAlignment : uint8_t {
SA_LEFT = 0 << 0, ///< Left align the text.
SA_HOR_CENTER = 1 << 0, ///< Horizontally center the text.
SA_RIGHT = 2 << 0, ///< Right align the text (must be a single bit).

View File

@ -31,7 +31,7 @@
#include "safeguards.h"
/** Goal list columns. */
enum GoalColumn {
enum GoalColumn : uint8_t {
GC_GOAL = 0, ///< Goal text column.
GC_PROGRESS, ///< Goal progress column.
};

View File

@ -18,7 +18,7 @@
#include "widgets/vehicle_widget.h"
/** What is the status of our acceleration? */
enum AccelStatus {
enum AccelStatus : uint8_t {
AS_ACCEL, ///< We want to go faster, if possible of course.
AS_BRAKE, ///< We want to stop.
};
@ -51,7 +51,7 @@ struct GroundVehicleCache {
};
/** Ground vehicle flags. */
enum GroundVehicleFlags {
enum GroundVehicleFlags : uint8_t {
GVF_GOINGUP_BIT = 0, ///< Vehicle is currently going uphill. (Cached track information for acceleration)
GVF_GOINGDOWN_BIT = 1, ///< Vehicle is currently going downhill. (Cached track information for acceleration)
GVF_SUPPRESS_IMPLICIT_ORDERS = 2, ///< Disable insertion and removal of automatic orders until the vehicle completes the real order.

View File

@ -190,7 +190,7 @@ void BuildGuiGroupList(GUIGroupList &dst, bool fold, Owner owner, VehicleType ve
class VehicleGroupWindow : public BaseVehicleListWindow {
private:
/* Columns in the group list */
enum ListColumns {
enum ListColumns : uint8_t {
VGC_FOLD, ///< Fold / Unfold button.
VGC_NAME, ///< Group name.
VGC_PROTECT, ///< Autoreplace protect icon.

View File

@ -16,7 +16,7 @@
* Order of these enums has to be the same as in lang/english.txt
* Otherwise you will get inconsistent behaviour.
*/
enum HeightmapRotation {
enum HeightmapRotation : uint8_t {
HM_COUNTER_CLOCKWISE, ///< Rotate the map counter clockwise 45 degrees
HM_CLOCKWISE, ///< Rotate the map clockwise 45 degrees
};

View File

@ -306,7 +306,7 @@ extern IndustryBuildData _industry_builder;
/** Special values for the industry list window for the data parameter of #InvalidateWindowData. */
enum IndustryDirectoryInvalidateWindowData {
enum IndustryDirectoryInvalidateWindowData : uint8_t {
IDIWD_FORCE_REBUILD,
IDIWD_PRODUCTION_CHANGE,
IDIWD_FORCE_RESORT,

View File

@ -58,14 +58,14 @@ bool _ignore_restrictions;
std::bitset<NUM_INDUSTRYTYPES> _displayed_industries; ///< Communication from the industry chain window to the smallmap window about what industries to display.
/** Cargo suffix type (for which window is it requested) */
enum CargoSuffixType {
enum CargoSuffixType : uint8_t {
CST_FUND, ///< Fund-industry window
CST_VIEW, ///< View-industry window
CST_DIR, ///< Industry-directory window
};
/** Ways of displaying the cargo. */
enum CargoSuffixDisplay {
enum CargoSuffixDisplay : uint8_t {
CSD_CARGO, ///< Display the cargo without sub-type (cb37 result 401).
CSD_CARGO_AMOUNT, ///< Display the cargo and amount (if useful), but no sub-type (cb37 result 400 or fail).
CSD_CARGO_TEXT, ///< Display then cargo and supplied string (cb37 result 800-BFF).
@ -138,7 +138,7 @@ static void GetCargoSuffix(uint cargo, CargoSuffixType cst, const Industry *ind,
}
}
enum CargoSuffixInOut {
enum CargoSuffixInOut : uint8_t {
CARGOSUFFIX_OUT = 0,
CARGOSUFFIX_IN = 1,
};
@ -789,14 +789,14 @@ static inline bool IsProductionAlterable(const Industry *i)
class IndustryViewWindow : public Window
{
/** Modes for changing production */
enum Editability {
enum Editability : uint8_t {
EA_NONE, ///< Not alterable
EA_MULTIPLIER, ///< Allow changing the production multiplier
EA_RATE, ///< Allow changing the production rates
};
/** Specific lines in the info panel */
enum InfoLine {
enum InfoLine : uint8_t {
IL_NONE, ///< No line
IL_MULTIPLIER, ///< Production multiplier
IL_RATE1, ///< Production rate of cargo 1
@ -1334,7 +1334,7 @@ static bool CargoFilter(const Industry * const *industry, const std::pair<CargoT
static GUIIndustryList::FilterFunction * const _industry_filter_funcs[] = { &CargoFilter };
/** Enum referring to the Hotkeys in the industry directory window */
enum IndustryDirectoryHotkeys {
enum IndustryDirectoryHotkeys : int32_t {
IDHK_FOCUS_FILTER_BOX, ///< Focus the filter box
};
/**
@ -1986,7 +1986,7 @@ static WindowDesc _industry_cargoes_desc(
);
/** Available types of field. */
enum CargoesFieldType {
enum CargoesFieldType : uint8_t {
CFT_EMPTY, ///< Empty field.
CFT_SMALL_EMPTY, ///< Empty small field (for the header).
CFT_INDUSTRY, ///< Display industry.

View File

@ -19,7 +19,7 @@
* They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h
* How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3)
*/
enum IndustryGraphics {
enum IndustryGraphics : uint8_t {
GFX_COAL_MINE_TOWER_NOT_ANIMATED = 0,
GFX_COAL_MINE_TOWER_ANIMATED = 1,
GFX_POWERPLANT_CHIMNEY = 8,

View File

@ -19,7 +19,7 @@
#include "newgrf_commons.h"
/** Available types of industry lifetimes. */
enum IndustryLifeType {
enum IndustryLifeType : uint8_t {
INDUSTRYLIFE_BLACK_HOLE = 0, ///< Like power plants and banks
INDUSTRYLIFE_EXTRACTIVE = 1 << 0, ///< Like mines
INDUSTRYLIFE_ORGANIC = 1 << 1, ///< Like forests
@ -30,7 +30,7 @@ enum IndustryLifeType {
* Available procedures to check whether an industry may build at a given location.
* @see CheckNewIndustryProc, _check_new_industry_procs[]
*/
enum CheckProc {
enum CheckProc : uint8_t {
CHECK_NOTHING, ///< Always succeeds.
CHECK_FOREST, ///< %Industry should be build above snow-line in arctic climate.
CHECK_REFINERY, ///< %Industry should be positioned near edge of the map.
@ -44,7 +44,7 @@ enum CheckProc {
};
/** How was the industry created */
enum IndustryConstructionType {
enum IndustryConstructionType : uint8_t {
ICT_UNKNOWN, ///< in previous game version or without newindustries activated
ICT_NORMAL_GAMEPLAY, ///< either by user or random creation process
ICT_MAP_GENERATION, ///< during random map creation
@ -52,7 +52,7 @@ enum IndustryConstructionType {
};
/** Various industry behaviours mostly to represent original TTD specialities */
enum IndustryBehaviour {
enum IndustryBehaviour : uint32_t {
INDUSTRYBEH_NONE = 0,
INDUSTRYBEH_PLANT_FIELDS = 1 << 0, ///< periodically plants fields around itself (temp and arctic farms)
INDUSTRYBEH_CUT_TREES = 1 << 1, ///< cuts trees and produce first output cargo from them (lumber mill)
@ -79,7 +79,7 @@ enum IndustryBehaviour {
DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour)
/** Flags for miscellaneous industry tile specialities */
enum IndustryTileSpecialFlags {
enum IndustryTileSpecialFlags : uint8_t {
INDTILE_SPECIAL_NONE = 0,
INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS = 1 << 0, ///< Callback 0x26 needs random bits
INDTILE_SPECIAL_ACCEPTS_ALL_CARGO = 1 << 1, ///< Tile always accepts all cargoes the associated industry accepts

View File

@ -13,7 +13,7 @@
#include "fileio_type.h"
/** Types of groups */
enum IniGroupType {
enum IniGroupType : uint8_t {
IGT_VARIABLES = 0, ///< Values of the form "landscape = hilly".
IGT_LIST = 1, ///< A list of values, separated by \n and terminated by the next group block.
IGT_SEQUENCE = 2, ///< A list of uninterpreted lines, terminated by the next group block.

View File

@ -135,7 +135,7 @@ struct SelectGameWindow : public Window {
vc.delay = std::stoi(match[3].str()) * 1000; // milliseconds
/* Parse flags from second matching group. */
enum IdType {
enum IdType : uint8_t {
ID_NONE, ID_VEHICLE
} id_type = ID_NONE;
for (char c : match[2].str()) {

View File

@ -14,7 +14,7 @@
typedef uint8_t LandscapeID; ///< Landscape type. @see LandscapeType
/** Landscape types */
enum LandscapeType {
enum LandscapeType : uint8_t {
LT_TEMPERATE = 0,
LT_ARCTIC = 1,
LT_TROPIC = 2,

View File

@ -44,7 +44,7 @@ enum DistributionType : uint8_t {
* Refreshing a link makes just sure a minimum capacity is kept. Increasing
* actually adds the given capacity.
*/
enum EdgeUpdateMode {
enum EdgeUpdateMode : uint8_t {
EUM_INCREASE = 1, ///< Increase capacity.
EUM_REFRESH = 1 << 1, ///< Refresh capacity.
EUM_RESTRICTED = 1 << 2, ///< Use restricted link.

View File

@ -25,7 +25,7 @@ protected:
* Various flags about properties of the last examined link that might have
* an influence on the next one.
*/
enum RefreshFlags {
enum RefreshFlags : uint8_t {
USE_NEXT, ///< There was a conditional jump. Try to use the given next order when looking for a new one.
HAS_CARGO, ///< Consist could leave the last stop where it could interact with cargo carrying cargo (i.e. not an "unload all" + "no loading" order).
WAS_REFIT, ///< Consist was refit since the last stop where it could interact with cargo.

View File

@ -178,7 +178,7 @@ static constexpr NWidgetPart _nested_main_window_widgets[] = {
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1),
};
enum {
enum GlobalHotKeys : int32_t {
GHK_QUIT,
GHK_ABANDON,
GHK_CONSOLE,

View File

@ -42,7 +42,7 @@
#include "safeguards.h"
/** Method to open the OSK. */
enum OskActivation {
enum OskActivation : uint8_t {
OSKA_DISABLED, ///< The OSK shall not be activated at all.
OSKA_DOUBLE_CLICK, ///< Double click on the edit box opens OSK.
OSKA_SINGLE_CLICK, ///< Single click after focus click opens OSK.

View File

@ -20,7 +20,7 @@ struct SMFHeader {
};
/** MIDI status byte codes */
enum MidiStatus {
enum MidiStatus : uint8_t {
/* Bytes with top bit unset are data bytes i.e. not status bytes */
/* Channel status messages, require channel number in lower nibble */
MIDIST_NOTEOFF = 0x80,
@ -55,7 +55,7 @@ enum MidiStatus {
* MIDI controller numbers.
* Complete list per General MIDI, missing values are not defined.
*/
enum MidiController {
enum MidiController : uint8_t {
/* Standard continuous controllers (MSB control) */
MIDICT_BANKSELECT = 0,
MIDICT_MODWHEEL = 1,
@ -141,7 +141,7 @@ enum MidiController {
/** Well-known MIDI system exclusive message values for use with the MidiGetStandardSysexMessage function. */
enum class MidiSysexMessage {
enum class MidiSysexMessage : uint8_t {
/** Reset device to General MIDI defaults */
ResetGM,
/** Reset device to (Roland) General Standard defaults */

View File

@ -520,7 +520,7 @@ struct MpsMachine {
MidiFile &target; ///< recipient of data
/** Overridden MIDI status codes used in the data format */
enum MpsMidiStatus {
enum MpsMidiStatus : uint8_t {
MPSMIDIST_SEGMENT_RETURN = 0xFD, ///< resume playing master track from stored position
MPSMIDIST_SEGMENT_CALL = 0xFE, ///< store current position of master track playback, and begin playback of a segment
MPSMIDIST_ENDSONG = 0xFF, ///< immediately end the song

View File

@ -47,7 +47,7 @@ struct MusicSystem {
};
typedef std::vector<PlaylistEntry> Playlist;
enum PlaylistChoices {
enum PlaylistChoices : uint8_t {
PLCH_ALLMUSIC,
PLCH_OLDSTYLE,
PLCH_NEWSTYLE,

View File

@ -183,7 +183,7 @@ public:
*
* Sorting will prefer entries at the top of this list above ones at the bottom.
*/
enum ServerAddressType {
enum ServerAddressType : uint8_t {
SERVER_ADDRESS_DIRECT, ///< Server-address is based on an hostname:port.
SERVER_ADDRESS_INVITE_CODE, ///< Server-address is based on an invite code.
};

View File

@ -20,7 +20,7 @@ bool NetworkCoreInitialize();
void NetworkCoreShutdown();
/** Status of a network client; reasons why a client has quit */
enum NetworkRecvStatus {
enum NetworkRecvStatus : uint8_t {
NETWORK_RECV_STATUS_OKAY, ///< Everything is okay.
NETWORK_RECV_STATUS_DESYNC, ///< A desync did occur.
NETWORK_RECV_STATUS_NEWGRF_MISMATCH, ///< We did not have the required NewGRFs.

View File

@ -20,7 +20,7 @@
#include <thread>
/** The states of sending the packets. */
enum SendPacketsState {
enum SendPacketsState : uint8_t {
SPS_CLOSED, ///< The connection got closed.
SPS_NONE_SENT, ///< The buffer is still full, so no (parts of) packets could be sent.
SPS_PARTLY_SENT, ///< The packets are partly sent; there are more packets to be sent in the queue.
@ -80,7 +80,7 @@ private:
* game-thread, and not at another random time where we might not have the
* lock on the game-state.
*/
enum class Status {
enum class Status : uint8_t {
Init, ///< TCPConnecter is created but resolving hasn't started.
Resolving, ///< The hostname is being resolved (threaded).
Failure, ///< Resolving failed.

View File

@ -70,7 +70,7 @@ enum PacketAdminType : uint8_t {
};
/** Status of an admin. */
enum AdminStatus {
enum AdminStatus : uint8_t {
ADMIN_STATUS_INACTIVE, ///< The admin is not connected nor active.
ADMIN_STATUS_AUTHENTICATE, ///< The admin is connected and working on authentication.
ADMIN_STATUS_ACTIVE, ///< The admin is active.
@ -78,7 +78,7 @@ enum AdminStatus {
};
/** Update types an admin can register a frequency for */
enum AdminUpdateType {
enum AdminUpdateType : uint8_t {
ADMIN_UPDATE_DATE, ///< Updates about the date of the game.
ADMIN_UPDATE_CLIENT_INFO, ///< Updates about the information of clients.
ADMIN_UPDATE_COMPANY_INFO, ///< Updates about the generic information of companies.
@ -93,7 +93,7 @@ enum AdminUpdateType {
};
/** Update frequencies an admin can register. */
enum AdminUpdateFrequency {
enum AdminUpdateFrequency : uint8_t {
ADMIN_FREQUENCY_POLL = 0x01, ///< The admin can poll this.
ADMIN_FREQUENCY_DAILY = 0x02, ///< The admin gets information about this on a daily basis.
ADMIN_FREQUENCY_WEEKLY = 0x04, ///< The admin gets information about this on a weekly basis.
@ -105,7 +105,7 @@ enum AdminUpdateFrequency {
DECLARE_ENUM_AS_BIT_SET(AdminUpdateFrequency)
/** Reasons for removing a company - communicated to admins. */
enum AdminCompanyRemoveReason {
enum AdminCompanyRemoveReason : uint8_t {
ADMIN_CRR_MANUAL, ///< The company is manually removed.
ADMIN_CRR_AUTOCLEAN, ///< The company is removed due to autoclean.
ADMIN_CRR_BANKRUPT, ///< The company went belly-up.

View File

@ -15,7 +15,7 @@
#include "../../3rdparty/md5/md5.h"
/** The values in the enum are important; they are used as database 'keys' */
enum ContentType {
enum ContentType : uint8_t {
CONTENT_TYPE_BEGIN = 1, ///< Helper to mark the begin of the types
CONTENT_TYPE_BASE_GRAPHICS = 1, ///< The content consists of base graphics
CONTENT_TYPE_NEWGRF = 2, ///< The content consists of a NewGRF
@ -44,14 +44,14 @@ enum PacketContentType : uint8_t {
};
/** Unique identifier for the content. */
enum ContentID {
INVALID_CONTENT_ID = UINT32_MAX, ///< Sentinel for invalid content.
};
using ContentID = uint32_t;
static constexpr ContentID INVALID_CONTENT_ID = UINT32_MAX; ///< Sentinel for invalid content.
/** Container for all important information about a piece of content. */
struct ContentInfo {
/** The state the content can be in. */
enum State {
enum State : uint8_t {
UNSELECTED, ///< The content has not been selected
SELECTED, ///< The content has been manually selected
AUTOSELECTED, ///< The content has been selected as dependency

View File

@ -49,7 +49,7 @@ enum PacketCoordinatorType : uint8_t {
/**
* The type of connection the Game Coordinator can detect we have.
*/
enum ConnectionType {
enum ConnectionType : uint8_t {
CONNECTION_TYPE_UNKNOWN, ///< The Game Coordinator hasn't informed us yet what type of connection we have.
CONNECTION_TYPE_ISOLATED, ///< The Game Coordinator failed to find a way to connect to your server. Nobody will be able to join.
CONNECTION_TYPE_DIRECT, ///< The Game Coordinator can directly connect to your server.
@ -60,7 +60,7 @@ enum ConnectionType {
/**
* The type of error from the Game Coordinator.
*/
enum NetworkCoordinatorErrorType {
enum NetworkCoordinatorErrorType : uint8_t {
NETWORK_COORDINATOR_ERROR_UNKNOWN, ///< There was an unknown error.
NETWORK_COORDINATOR_ERROR_REGISTRATION_FAILED, ///< Your request for registration failed.
NETWORK_COORDINATOR_ERROR_INVALID_INVITE_CODE, ///< The invite code given is invalid.

View File

@ -21,7 +21,7 @@ private:
uint8_t token = 0; ///< The token we need to send back to the server to prove we're the right client.
/** Status of the connection with the server. */
enum ServerStatus {
enum ServerStatus : uint8_t {
STATUS_INACTIVE, ///< The client is not connected nor active.
STATUS_JOIN, ///< We are trying to join a server.
STATUS_AUTH_GAME, ///< Last action was requesting game (server) password.

View File

@ -320,7 +320,7 @@ struct ContentListFilterData {
};
/** Filter criteria for NetworkContentListWindow. */
enum ContentListFilterCriteria {
enum ContentListFilterCriteria : uint8_t {
CONTENT_FILTER_TEXT = 0, ///< Filter by query sting
CONTENT_FILTER_TYPE_OR_SELECTED,///< Filter by being of displayed type or selected for download
};

View File

@ -222,7 +222,7 @@ public:
class NetworkAuthenticationClientHandler : public NetworkAuthenticationHandler {
public:
/** The processing result of receiving a request. */
enum RequestResult {
enum RequestResult : uint8_t {
AWAIT_USER_INPUT, ///< We have requested some user input, but must wait on that.
READY_FOR_RESPONSE, ///< We do not have to wait for user input, and can immediately respond to the server.
INVALID, ///< We have received an invalid request.
@ -258,7 +258,7 @@ public:
class NetworkAuthenticationServerHandler : public NetworkAuthenticationHandler {
public:
/** The processing result of receiving a response. */
enum ResponseResult {
enum ResponseResult : uint8_t {
AUTHENTICATED, ///< The client was authenticated successfully.
NOT_AUTHENTICATED, ///< All authentications for this handler have been exhausted.
RETRY_NEXT_METHOD, ///< The client failed to authenticate, but there is another method to try.

View File

@ -49,7 +49,7 @@ using X25519Mac = std::array<uint8_t, X25519_MAC_SIZE>;
using X25519KeyExchangeMessage = std::array<uint8_t, X25519_KEY_EXCHANGE_MESSAGE_SIZE>;
/** The side of the key exchange. */
enum class X25519KeyExchangeSide {
enum class X25519KeyExchangeSide : uint8_t {
CLIENT, ///< We are the client.
SERVER, ///< We are the server.
};

View File

@ -15,7 +15,7 @@
#include "network_type.h"
/** The status a server can be in. */
enum NetworkGameListStatus {
enum NetworkGameListStatus : uint8_t {
NGLS_OFFLINE, ///< Server is offline (or cannot be queried).
NGLS_ONLINE, ///< Server is online.
NGLS_FULL, ///< Server is full and cannot be queried.

View File

@ -1313,7 +1313,7 @@ static WindowDesc _client_list_desc(
* The possibly entries in a DropDown for an admin.
* Client and companies are mixed; they just have to be unique.
*/
enum DropDownAdmin {
enum DropDownAdmin : uint8_t {
DD_CLIENT_ADMIN_KICK,
DD_CLIENT_ADMIN_BAN,
DD_COMPANY_ADMIN_RESET,

View File

@ -38,7 +38,7 @@ struct NetworkCompanyInfo : NetworkCompanyStats {
std::string clients; ///< The clients that control this company (Name1, name2, ..)
};
enum NetworkRelayWindowCloseData {
enum NetworkRelayWindowCloseData : uint8_t {
NRWCD_UNHANDLED = 0, ///< Relay request is unhandled.
NRWCD_HANDLED = 1, ///< Relay request is handled, either by user or by timeout.
};

View File

@ -40,7 +40,7 @@
typedef class ServerNetworkGameSocketHandler NetworkClientSocket;
/** Status of the clients during joining. */
enum NetworkJoinStatus {
enum NetworkJoinStatus : uint8_t {
NETWORK_JOIN_STATUS_CONNECTING,
NETWORK_JOIN_STATUS_AUTHORIZING,
NETWORK_JOIN_STATUS_WAITING,

View File

@ -50,7 +50,7 @@ protected:
public:
/** Status of a client */
enum ClientStatus {
enum ClientStatus : uint8_t {
STATUS_INACTIVE, ///< The client is not connected nor active.
STATUS_AUTH_GAME, ///< The client is authorizing with game (server) password.
STATUS_IDENTIFY, ///< The client is identifying itself.

View File

@ -24,7 +24,7 @@ protected:
bool IsCancelled() const override { return false; }
public:
enum class Reason {
enum class Reason : uint8_t {
PREVIEW, ///< User is previewing the survey result.
LEAVE, ///< User is leaving the game (but not exiting the application).
EXIT, ///< User is exiting the application.

View File

@ -25,7 +25,7 @@ static const uint MAX_CLIENT_SLOTS = 256;
/**
* Vehicletypes in the order they are send in info packets.
*/
enum NetworkVehicleType {
enum NetworkVehicleType : uint8_t {
NETWORK_VEH_TRAIN = 0,
NETWORK_VEH_LORRY,
NETWORK_VEH_BUS,
@ -87,7 +87,7 @@ DECLARE_ENUM_AS_ADDABLE(DestType)
* Actions that can be used for NetworkTextMessage.
* @warning The values of the enum items are part of the admin network API. Only append at the end.
*/
enum NetworkAction {
enum NetworkAction : uint8_t {
NETWORK_ACTION_JOIN,
NETWORK_ACTION_LEAVE,
NETWORK_ACTION_SERVER_MESSAGE,
@ -107,7 +107,7 @@ enum NetworkAction {
* The error codes we send around in the protocols.
* @warning The values of the enum items are part of the admin network API. Only append at the end.
*/
enum NetworkErrorCode {
enum NetworkErrorCode : uint8_t {
NETWORK_ERROR_GENERAL, // Try to use this one like never
/* Signals from clients */

View File

@ -314,7 +314,7 @@ static const uint NUM_STATIONS_PER_GRF = UINT16_MAX - 1;
/** Temporary engine data used when loading only */
struct GRFTempEngineData {
/** Summary state of refittability properties */
enum Refittability {
enum Refittability : uint8_t {
UNSET = 0, ///< No properties assigned. Default refit masks shall be activated.
EMPTY, ///< GRF defined vehicle as not-refittable. The vehicle shall only carry the default cargo.
NONEMPTY, ///< GRF defined the vehicle as refittable. If the refitmask is empty after translation (cargotypes not available), disable the vehicle.
@ -997,7 +997,7 @@ static void ConvertTTDBasePrice(uint32_t base_pointer, const char *error_locatio
}
/** Possible return values for the FeatureChangeInfo functions */
enum ChangeInfoResult {
enum ChangeInfoResult : uint8_t {
CIR_SUCCESS, ///< Variable was parsed and read
CIR_DISABLED, ///< GRF was disabled due to error
CIR_UNHANDLED, ///< Variable was parsed but unread

View File

@ -23,7 +23,7 @@
* List of different canal 'features'.
* Each feature gets an entry in the canal spritegroup table
*/
enum CanalFeature {
enum CanalFeature : uint8_t {
CF_WATERSLOPE,
CF_LOCKS,
CF_DIKES,
@ -42,7 +42,7 @@ struct CanalProperties {
uint8_t flags; ///< Flags controlling display.
};
enum GrfLoadingStage {
enum GrfLoadingStage : uint8_t {
GLS_FILESCAN,
GLS_SAFETYSCAN,
GLS_LABELSCAN,
@ -54,7 +54,7 @@ enum GrfLoadingStage {
DECLARE_INCREMENT_DECREMENT_OPERATORS(GrfLoadingStage)
enum GrfMiscBit {
enum GrfMiscBit : uint8_t {
GMB_DESERT_TREES_FIELDS = 0, // Unsupported.
GMB_DESERT_PAVED_ROADS = 1,
GMB_FIELD_BOUNDING_BOX = 2, // Unsupported.
@ -64,7 +64,7 @@ enum GrfMiscBit {
GMB_SECOND_ROCKY_TILE_SET = 6,
};
enum GrfSpecFeature {
enum GrfSpecFeature : uint8_t {
GSF_TRAINS,
GSF_ROADVEHICLES,
GSF_SHIPS,
@ -159,14 +159,14 @@ struct GRFFile : ZeroedMemoryAllocator {
}
};
enum ShoreReplacement {
enum ShoreReplacement : uint8_t {
SHORE_REPLACE_NONE, ///< No shore sprites were replaced.
SHORE_REPLACE_ACTION_5, ///< Shore sprites were replaced by Action5.
SHORE_REPLACE_ACTION_A, ///< Shore sprites were replaced by ActionA (using grass tiles for the corner-shores).
SHORE_REPLACE_ONLY_NEW, ///< Only corner-shores were loaded by Action5 (openttd(w/d).grf only).
};
enum TramReplacement {
enum TramReplacement : uint8_t {
TRAMWAY_REPLACE_DEPOT_NONE, ///< No tram depot graphics were loaded.
TRAMWAY_REPLACE_DEPOT_WITH_TRACK, ///< Electrified depot graphics with tram track were loaded.
TRAMWAY_REPLACE_DEPOT_NO_TRACK, ///< Electrified depot graphics without tram track were loaded.

View File

@ -11,7 +11,7 @@
#define NEWGRF_ACT5_H
/** The type of action 5 type. */
enum Action5BlockType {
enum Action5BlockType : uint8_t {
A5BLOCK_FIXED, ///< Only allow replacing a whole block of sprites. (TTDP compatible)
A5BLOCK_ALLOW_OFFSET, ///< Allow replacing any subset by specifiing an offset.
A5BLOCK_INVALID, ///< unknown/not-implemented type

View File

@ -67,7 +67,7 @@ public:
};
/** List of default airport classes. */
enum AirportClassID {
enum AirportClassID : uint8_t {
APC_BEGIN = 0, ///< Lowest valid airport class id
APC_SMALL = 0, ///< id for small airports class
APC_LARGE, ///< id for large airports class
@ -80,7 +80,7 @@ enum AirportClassID {
DECLARE_INCREMENT_DECREMENT_OPERATORS(AirportClassID)
/** TTDP airport types. Used to map our types to TTDPatch's */
enum TTDPAirportType {
enum TTDPAirportType : uint8_t {
ATP_TTDP_SMALL, ///< Same as AT_SMALL
ATP_TTDP_LARGE, ///< Same as AT_LARGE
ATP_TTDP_HELIPORT, ///< Same as AT_HELIPORT

View File

@ -23,7 +23,7 @@ struct AnimationInfo {
};
/** Animation triggers for station. */
enum StationAnimationTrigger {
enum StationAnimationTrigger : uint8_t {
SAT_BUILT, ///< Trigger tile when built.
SAT_NEW_CARGO, ///< Trigger station on new cargo arrival.
SAT_CARGO_TAKEN, ///< Trigger station when cargo is completely taken.
@ -34,7 +34,7 @@ enum StationAnimationTrigger {
};
/** Animation triggers of the industries. */
enum IndustryAnimationTrigger {
enum IndustryAnimationTrigger : uint8_t {
IAT_CONSTRUCTION_STATE_CHANGE, ///< Trigger whenever the construction state changes.
IAT_TILELOOP, ///< Trigger in the periodic tile loop.
IAT_INDUSTRY_TICK, ///< Trigger every tick.
@ -43,7 +43,7 @@ enum IndustryAnimationTrigger {
};
/** Animation triggers for airport tiles */
enum AirpAnimationTrigger {
enum AirpAnimationTrigger : uint8_t {
AAT_BUILT, ///< Triggered when the airport is built (for all tiles at the same time).
AAT_TILELOOP, ///< Triggered in the periodic tile loop.
AAT_STATION_NEW_CARGO, ///< Triggered when new cargo arrives at the station (for all tiles at the same time).
@ -53,7 +53,7 @@ enum AirpAnimationTrigger {
};
/** Animation triggers for objects. */
enum ObjectAnimationTrigger {
enum ObjectAnimationTrigger : uint8_t {
OAT_BUILT, ///< Triggered when the object is built (for all tiles at the same time).
OAT_TILELOOP, ///< Triggered in the periodic tile loop.
OAT_256_TICKS, ///< Triggered every 256 ticks (for all tiles at the same time).

View File

@ -17,7 +17,7 @@
* industry, etc.
* Names are formatted as CBID_<CLASS>_<CALLBACK>
*/
enum CallbackID {
enum CallbackID : uint16_t {
/** Set when using the callback resolve system, but not to resolve a callback. */
CBID_NO_CALLBACK = 0x00,
@ -297,7 +297,7 @@ enum CallbackID {
* Callback masks for vehicles, indicates which callbacks are used by a vehicle.
* Some callbacks are always used and don't have a mask.
*/
enum VehicleCallbackMask {
enum VehicleCallbackMask : uint8_t {
CBM_VEHICLE_VISUAL_EFFECT = 0, ///< Visual effects and wagon power (trains, road vehicles and ships)
CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains and road vehicles)
CBM_VEHICLE_LOAD_AMOUNT = 2, ///< Load amount
@ -313,7 +313,7 @@ enum VehicleCallbackMask {
/**
* Callback masks for stations.
*/
enum StationCallbackMask {
enum StationCallbackMask : uint8_t {
CBM_STATION_AVAIL = 0, ///< Availability of station in construction window
CBM_STATION_DRAW_TILE_LAYOUT = 1, ///< Use callback to select a tile layout to use when drawing.
CBM_STATION_ANIMATION_NEXT_FRAME = 2, ///< Use a custom next frame callback
@ -324,7 +324,7 @@ enum StationCallbackMask {
/**
* Callback masks for road stops.
*/
enum RoadStopCallbackMask {
enum RoadStopCallbackMask : uint8_t {
CBM_ROAD_STOP_AVAIL = 0, ///< Availability of road stop in construction window
CBM_ROAD_STOP_ANIMATION_NEXT_FRAME = 1, ///< Use a custom next frame callback
CBM_ROAD_STOP_ANIMATION_SPEED = 2, ///< Customize the animation speed of the road stop
@ -333,7 +333,7 @@ enum RoadStopCallbackMask {
/**
* Callback masks for houses.
*/
enum HouseCallbackMask {
enum HouseCallbackMask : uint8_t {
CBM_HOUSE_ALLOW_CONSTRUCTION = 0, ///< decide whether the house can be built on a given tile
CBM_HOUSE_ANIMATION_NEXT_FRAME = 1, ///< decides next animation frame
CBM_HOUSE_ANIMATION_START_STOP = 2, ///< periodically start/stop the animation
@ -352,14 +352,14 @@ enum HouseCallbackMask {
/**
* Callback masks for canals.
*/
enum CanalCallbackMask {
enum CanalCallbackMask : uint8_t {
CBM_CANAL_SPRITE_OFFSET = 0, ///< Enable add sprite offset callback
};
/**
* Callback masks for cargoes.
*/
enum CargoCallbackMask {
enum CargoCallbackMask : uint8_t {
CBM_CARGO_PROFIT_CALC = 0, ///< custom profit calculation
CBM_CARGO_STATION_RATING_CALC = 1, ///< custom station rating for this cargo type
};
@ -367,7 +367,7 @@ enum CargoCallbackMask {
/**
* Callback masks for Industries
*/
enum IndustryCallbackMask {
enum IndustryCallbackMask : uint8_t {
CBM_IND_PROBABILITY = 0, ///< industry availability/probability callback
CBM_IND_PRODUCTION_CARGO_ARRIVAL = 1, ///< call production callback when cargo arrives at the industry
CBM_IND_PRODUCTION_256_TICKS = 2, ///< call production callback every 256 ticks
@ -388,7 +388,7 @@ enum IndustryCallbackMask {
/**
* Callback masks for industry tiles
*/
enum IndustryTileCallbackMask {
enum IndustryTileCallbackMask : uint8_t {
CBM_INDT_ANIM_NEXT_FRAME = 0, ///< decides next animation frame
CBM_INDT_ANIM_SPEED = 1, ///< decides animation speed
CBM_INDT_CARGO_ACCEPTANCE = 2, ///< decides amount of cargo acceptance
@ -401,7 +401,7 @@ enum IndustryTileCallbackMask {
/**
* Callback masks for objects
*/
enum ObjectCallbackMask {
enum ObjectCallbackMask : uint8_t {
CBM_OBJ_SLOPE_CHECK = 0, ///< decides slope suitability
CBM_OBJ_ANIMATION_NEXT_FRAME = 1, ///< decides next animation frame
CBM_OBJ_ANIMATION_SPEED = 2, ///< decides animation speed
@ -413,7 +413,7 @@ enum ObjectCallbackMask {
/**
* Callback masks for airport tiles
*/
enum AirportTileCallbackMask {
enum AirportTileCallbackMask : uint8_t {
CBM_AIRT_ANIM_NEXT_FRAME = 0, ///< decides next animation frame
CBM_AIRT_ANIM_SPEED = 1, ///< decides animation speed
CBM_AIRT_SHAPE_CHECK = 4, ///< decides slope suitability

View File

@ -14,7 +14,7 @@
#include "tile_type.h"
/** Flags controlling the display of canals. */
enum CanalFeatureFlag {
enum CanalFeatureFlag : uint8_t {
CFF_HAS_FLAT_SPRITE = 0, ///< Additional flat ground sprite in the beginning.
};

View File

@ -20,7 +20,7 @@
#include "company_type.h"
/** Context for tile accesses */
enum TileContext {
enum TileContext : uint8_t {
TCX_NORMAL, ///< Nothing special.
TCX_UPPER_HALFTILE, ///< Querying information about the upper part of a tile with halftile foundation.
TCX_ON_BRIDGE, ///< Querying information about stuff on the bridge (via some bridgehead).
@ -29,7 +29,7 @@ enum TileContext {
/**
* Flags to enable register usage in sprite layouts.
*/
enum TileLayoutFlags {
enum TileLayoutFlags : uint8_t {
TLF_NOTHING = 0x00,
TLF_DODRAW = 0x01, ///< Only draw sprite if value of register TileLayoutRegisters::dodraw is non-zero.
@ -49,7 +49,7 @@ enum TileLayoutFlags {
TLF_KNOWN_FLAGS = 0xFF, ///< Known flags. Any unknown set flag will disable the GRF.
/** Flags which are still required after loading the GRF. */
TLF_DRAWING_FLAGS = ~TLF_CUSTOM_PALETTE,
TLF_DRAWING_FLAGS = TLF_KNOWN_FLAGS & ~TLF_CUSTOM_PALETTE,
/** Flags which do not work for the (first) ground sprite. */
TLF_NON_GROUND_FLAGS = TLF_BB_XY_OFFSET | TLF_BB_Z_OFFSET | TLF_CHILD_X_OFFSET | TLF_CHILD_Y_OFFSET,

View File

@ -17,7 +17,7 @@
#include "3rdparty/md5/md5.h"
/** GRF config bit flags */
enum GCF_Flags {
enum GCF_Flags : uint8_t {
GCF_SYSTEM, ///< GRF file is an openttd-internal system grf
GCF_UNSAFE, ///< GRF file is unsafe for static usage
GCF_STATIC, ///< GRF file is used statically (can be used in any MP game)
@ -29,7 +29,7 @@ enum GCF_Flags {
};
/** Status of GRF */
enum GRFStatus {
enum GRFStatus : uint8_t {
GCS_UNKNOWN, ///< The status of this grf file is unknown
GCS_DISABLED, ///< GRF file is disabled
GCS_NOT_FOUND, ///< GRF file was not found in the local cache
@ -38,7 +38,7 @@ enum GRFStatus {
};
/** Encountered GRF bugs */
enum GRFBugs {
enum GRFBugs : uint8_t {
GBUG_VEH_LENGTH, ///< Length of rail vehicle changes when not inside a depot
GBUG_VEH_REFIT, ///< Articulated vehicles carry different cargoes resp. are differently refittable than specified in purchase list
GBUG_VEH_POWERED_WAGON, ///< Powered wagon changed poweredness state when not inside a depot
@ -47,14 +47,14 @@ enum GRFBugs {
};
/** Status of post-gameload GRF compatibility check */
enum GRFListCompatibility {
enum GRFListCompatibility : uint8_t {
GLC_ALL_GOOD, ///< All GRF needed by game are present
GLC_COMPATIBLE, ///< Compatible (eg. the same ID, but different checksum) GRF found in at least one case
GLC_NOT_FOUND, ///< At least one GRF couldn't be found (higher priority than GLC_COMPATIBLE)
};
/** Information that can/has to be stored about a GRF's palette. */
enum GRFPalette {
enum GRFPalette : uint8_t {
GRFP_USE_BIT = 0, ///< The bit used for storing the palette to use.
GRFP_GRF_OFFSET = 2, ///< The offset of the GRFP_GRF data.
GRFP_GRF_SIZE = 2, ///< The size of the GRFP_GRF data.
@ -202,7 +202,7 @@ struct GRFConfig {
using GRFConfigList = GRFConfig *;
/** Method to find GRFs using FindGRFConfig */
enum FindGRFConfigMode {
enum FindGRFConfigMode : uint8_t {
FGCM_EXACT, ///< Only find Grfs matching md5sum
FGCM_COMPATIBLE, ///< Find best compatible Grf wrt. desired_version
FGCM_NEWEST, ///< Find newest Grf

View File

@ -15,7 +15,7 @@
#include "vehicle_type.h"
/** Current state of spritepicker */
enum NewGrfDebugSpritePickerMode {
enum NewGrfDebugSpritePickerMode : uint8_t {
SPM_NONE,
SPM_WAIT_CLICK,
SPM_REDRAW,

View File

@ -77,7 +77,7 @@ static inline uint GetInspectWindowNumber(GrfSpecFeature feature, uint index)
* The type of a property to show. This is used to
* provide an appropriate representation in the GUI.
*/
enum NIType {
enum NIType : uint8_t {
NIT_INT, ///< The property is a simple integer
NIT_CARGO, ///< The property is a cargo
};

View File

@ -94,7 +94,7 @@ static int MapOldSubType(const Vehicle *v)
/* TTDP style aircraft movement states for GRF Action 2 Var 0xE2 */
enum TTDPAircraftMovementStates {
enum TTDPAircraftMovementStates : uint8_t {
AMS_TTDP_HANGAR,
AMS_TTDP_TO_HANGAR,
AMS_TTDP_TO_PAD1,
@ -230,7 +230,7 @@ static uint8_t MapAircraftMovementState(const Aircraft *v)
/* TTDP style aircraft movement action for GRF Action 2 Var 0xE6 */
enum TTDPAircraftMovementActions {
enum TTDPAircraftMovementActions : uint8_t {
AMA_TTDP_IN_HANGAR,
AMA_TTDP_ON_PAD1,
AMA_TTDP_ON_PAD2,

View File

@ -46,7 +46,7 @@ struct VehicleScopeResolver : public ScopeResolver {
/** Resolver for a vehicle (chain) */
struct VehicleResolverObject : public ResolverObject {
/** Application of 'wagon overrides'. */
enum WagonOverride {
enum WagonOverride : uint8_t {
WO_NONE, //!< Resolve no wagon overrides.
WO_UNCACHED, //!< Resolve wagon overrides.
WO_CACHED, //!< Resolve wagon overrides using TrainCache::cached_override.
@ -103,13 +103,13 @@ bool UsesWagonOverride(const Vehicle *v);
int GetVehicleProperty(const Vehicle *v, PropertyID property, int orig_value, bool is_signed = false);
int GetEngineProperty(EngineID engine, PropertyID property, int orig_value, const Vehicle *v = nullptr, bool is_signed = false);
enum class BuildProbabilityType {
enum class BuildProbabilityType : uint8_t {
Reversed = 0,
};
bool TestVehicleBuildProbability(Vehicle *v, EngineID engine, BuildProbabilityType type);
enum VehicleTrigger {
enum VehicleTrigger : uint8_t {
VEHICLE_TRIGGER_NEW_CARGO = 0x01,
/* Externally triggered only for the first vehicle in chain */
VEHICLE_TRIGGER_DEPOT = 0x02,

View File

@ -17,7 +17,7 @@
struct SpriteGroup;
/** AI events for asking the NewGRF for information. */
enum AIConstructionEvent {
enum AIConstructionEvent : uint8_t {
AICE_TRAIN_CHECK_RAIL_ENGINE = 0x00, ///< Check if we should build an engine
AICE_TRAIN_CHECK_ELRAIL_ENGINE = 0x01, ///< Check if we should build an engine
AICE_TRAIN_CHECK_MONORAIL_ENGINE = 0x02, ///< Check if we should build an engine

View File

@ -109,7 +109,7 @@ bool CanDeleteHouse(TileIndex tile);
bool NewHouseTileLoop(TileIndex tile);
enum HouseTrigger {
enum HouseTrigger : uint8_t {
/* The tile of the house has been triggered during the tileloop. */
HOUSE_TRIGGER_TILE_LOOP = 0x01,
/*

View File

@ -68,7 +68,7 @@ struct IndustriesResolverObject : public ResolverObject {
};
/** When should the industry(tile) be triggered for random bits? */
enum IndustryTrigger {
enum IndustryTrigger : uint8_t {
/** Triggered each tile loop */
INDUSTRY_TRIGGER_TILELOOP_PROCESS = 1,
/** Triggered (whole industry) each 256 ticks */
@ -78,7 +78,7 @@ enum IndustryTrigger {
};
/** From where has callback #CBID_INDUSTRY_PROBABILITY been called */
enum IndustryAvailabilityCallType {
enum IndustryAvailabilityCallType : uint8_t {
IACT_MAPGENERATION, ///< during random map generation
IACT_RANDOMCREATION, ///< during creation of random ingame industry
IACT_USERCREATION, ///< from the Fund/build window

View File

@ -67,7 +67,7 @@ bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigge
/** Available industry tile triggers. */
enum IndustryTileTrigger {
enum IndustryTileTrigger : uint8_t {
INDTILE_TRIGGER_TILE_LOOP = 0x01, ///< The tile of the industry has been triggered during the tileloop.
INDUSTRY_TRIGGER_INDUSTRY_TICK = 0x02, ///< The industry has been triggered via its tick.
INDUSTRY_TRIGGER_RECEIVED_CARGO = 0x04, ///< Cargo has been delivered.

View File

@ -15,7 +15,7 @@
* Names are formatted as PROP_<CLASS>_<NAME>
* @todo Currently the list only contains properties which are used more than once in the code. I.e. they are available for callback 0x36.
*/
enum PropertyID {
enum PropertyID : uint8_t {
PROP_VEHICLE_LOAD_AMOUNT = 0x07, ///< Loading speed
PROP_TRAIN_SPEED = 0x09, ///< Max. speed: 1 unit = 1/1.6 mph = 1 km-ish/h

View File

@ -34,7 +34,7 @@ enum RoadStopClassID : uint16_t {
DECLARE_INCREMENT_DECREMENT_OPERATORS(RoadStopClassID)
/* Some Triggers etc. */
enum RoadStopRandomTrigger {
enum RoadStopRandomTrigger : uint8_t {
RSRT_NEW_CARGO, ///< Trigger roadstop on arrival of new cargo.
RSRT_CARGO_TAKEN, ///< Trigger roadstop when cargo is completely taken.
RSRT_VEH_ARRIVES, ///< Trigger roadstop when road vehicle arrives.
@ -66,7 +66,7 @@ enum RoadStopDrawMode : uint8_t {
};
DECLARE_ENUM_AS_BIT_SET(RoadStopDrawMode)
enum RoadStopSpecFlags {
enum RoadStopSpecFlags : uint8_t {
RSF_CB141_RANDOM_BITS = 0, ///< Callback 141 needs random bits.
RSF_NO_CATENARY = 2, ///< Do not show catenary.
RSF_DRIVE_THROUGH_ONLY = 3, ///< Stop is drive-through only.
@ -76,7 +76,7 @@ enum RoadStopSpecFlags {
RSF_DRAW_MODE_REGISTER = 8, ///< Read draw mode from register 0x100.
};
enum RoadStopView {
enum RoadStopView : uint8_t {
RSV_BAY_NE = 0, ///< Bay road stop, facing Northeast
RSV_BAY_SE = 1, ///< Bay road stop, facing Southeast
RSV_BAY_SW = 2, ///< Bay road stop, facing Southwest

View File

@ -15,7 +15,7 @@
#include "vehicle_type.h"
/** Events at which a sound might be played. */
enum VehicleSoundEvent {
enum VehicleSoundEvent : uint8_t {
VSE_START = 1, ///< Vehicle starting, i.e. leaving, the station.
VSE_TUNNEL = 2, ///< Train entering a tunnel.
VSE_BREAKDOWN = 3, ///< Vehicle breaking down.

View File

@ -49,7 +49,7 @@ template class NewGRFClass<StationSpec, StationClassID, STAT_CLASS_MAX>;
static const uint NUM_STATIONSSPECS_PER_STATION = 255; ///< Maximum number of parts per station.
enum TriggerArea {
enum TriggerArea : uint8_t {
TA_TILE,
TA_PLATFORM,
TA_WHOLE,

View File

@ -93,7 +93,7 @@ enum StationClassID : uint16_t {
/** Allow incrementing of StationClassID variables */
DECLARE_INCREMENT_DECREMENT_OPERATORS(StationClassID)
enum StationSpecFlags {
enum StationSpecFlags : uint8_t {
SSF_SEPARATE_GROUND, ///< Use different sprite set for ground sprites.
SSF_DIV_BY_STATION_SIZE, ///< Divide cargo amount by station size.
SSF_CB141_RANDOM_BITS, ///< Callback 141 needs random bits.
@ -102,7 +102,7 @@ enum StationSpecFlags {
};
/** Randomisation triggers for stations */
enum StationRandomTrigger {
enum StationRandomTrigger : uint8_t {
SRT_NEW_CARGO, ///< Trigger station on new cargo arrival.
SRT_CARGO_TAKEN, ///< Trigger station when cargo is completely taken.
SRT_TRAIN_ARRIVES, ///< Trigger platform when train arrives.

View File

@ -17,7 +17,7 @@
/**
* Mode switches to the behaviour of persistent storage array.
*/
enum PersistentStorageMode {
enum PersistentStorageMode : uint8_t {
PSM_ENTER_GAMELOOP, ///< Enter the gameloop, changes will be permanent.
PSM_LEAVE_GAMELOOP, ///< Leave the gameloop, changes will be temporary.
PSM_ENTER_COMMAND, ///< Enter command scope, changes will be permanent.

View File

@ -39,7 +39,7 @@
* the grf base will not be used in order to find the string, but rather for
* jumping from standard langID scheme to the new one.
*/
enum GRFBaseLanguages {
enum GRFBaseLanguages : uint8_t {
GRFLB_AMERICAN = 0x01,
GRFLB_ENGLISH = 0x02,
GRFLB_GERMAN = 0x04,
@ -48,7 +48,7 @@ enum GRFBaseLanguages {
GRFLB_GENERIC = 0x80,
};
enum GRFExtendedLanguages {
enum GRFExtendedLanguages : uint8_t {
GRFLX_AMERICAN = 0x00,
GRFLX_ENGLISH = 0x01,
GRFLX_GERMAN = 0x02,

View File

@ -103,7 +103,7 @@ DECLARE_ENUM_AS_BIT_SET(NewsFlag)
/**
* News display options
*/
enum NewsDisplay {
enum NewsDisplay : uint8_t {
ND_OFF, ///< Only show a reminder in the status bar
ND_SUMMARY, ///< Show ticker
ND_FULL, ///< Show newspaper

View File

@ -15,7 +15,7 @@
#include "core/enum_type.hpp"
/** Mode which defines the state of the game. */
enum GameMode {
enum GameMode : uint8_t {
GM_MENU,
GM_NORMAL,
GM_EDITOR,
@ -23,7 +23,7 @@ enum GameMode {
};
/** Mode which defines what mode we're switching to. */
enum SwitchMode {
enum SwitchMode : uint8_t {
SM_NONE,
SM_NEWGAME, ///< New Game --> 'Random game'.
SM_RESTARTGAME, ///< Restart --> 'Random game' with current settings.
@ -42,7 +42,7 @@ enum SwitchMode {
};
/** Display Options */
enum DisplayOptions {
enum DisplayOptions : uint8_t {
DO_SHOW_TOWN_NAMES = 0, ///< Display town names.
DO_SHOW_STATION_NAMES = 1, ///< Display station names.
DO_SHOW_SIGNS = 2, ///< Display signs.

View File

@ -477,7 +477,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
}
/** Hotkeys for order window. */
enum {
enum OrderHotKeys : int32_t {
OHK_SKIP,
OHK_DELETE,
OHK_GOTO,
@ -534,7 +534,7 @@ enum {
struct OrdersWindow : public Window {
private:
/** Under what reason are we using the PlaceObject functionality? */
enum OrderPlaceObjectState {
enum OrderPlaceObjectState : uint8_t {
OPOS_NONE,
OPOS_GOTO,
OPOS_CONDITIONAL,
@ -543,7 +543,7 @@ private:
};
/** Displayed planes of the #NWID_SELECTION widgets. */
enum DisplayPane {
enum DisplayPane : uint8_t {
/* WID_O_SEL_TOP_ROW_GROUNDVEHICLE */
DP_GROUNDVEHICLE_ROW_NORMAL = 0, ///< Display the row for normal/depot orders in the top row of the train/rv order window.
DP_GROUNDVEHICLE_ROW_CONDITIONAL = 1, ///< Display the row for conditional orders in the top row of the train/rv order window.

View File

@ -49,7 +49,7 @@ enum OrderType : uint8_t {
/**
* Flags related to the unloading order.
*/
enum OrderUnloadFlags {
enum OrderUnloadFlags : uint8_t {
OUF_UNLOAD_IF_POSSIBLE = 0, ///< Unload all cargo that the station accepts.
OUFB_UNLOAD = 1 << 0, ///< Force unloading all cargo onto the platform, possibly not getting paid.
OUFB_TRANSFER = 1 << 1, ///< Transfer all cargo onto the platform.
@ -59,7 +59,7 @@ enum OrderUnloadFlags {
/**
* Flags related to the loading order.
*/
enum OrderLoadFlags {
enum OrderLoadFlags : uint8_t {
OLF_LOAD_IF_POSSIBLE = 0, ///< Load as long as there is cargo that fits in the train.
OLFB_FULL_LOAD = 1 << 1, ///< Full load all cargoes of the consist.
OLF_FULL_LOAD_ANY = 3, ///< Full load a single cargo of the consist.
@ -69,7 +69,7 @@ enum OrderLoadFlags {
/**
* Non-stop order flags.
*/
enum OrderNonStopFlags {
enum OrderNonStopFlags : uint8_t {
ONSF_STOP_EVERYWHERE = 0, ///< The vehicle will stop at any station it passes and the destination.
ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1, ///< The vehicle will not stop at any stations it passes except the destination.
ONSF_NO_STOP_AT_DESTINATION_STATION = 2, ///< The vehicle will stop at any station it passes except the destination.
@ -80,7 +80,7 @@ enum OrderNonStopFlags {
/**
* Where to stop the trains.
*/
enum OrderStopLocation {
enum OrderStopLocation : uint8_t {
OSL_PLATFORM_NEAR_END = 0, ///< Stop at the near end of the platform
OSL_PLATFORM_MIDDLE = 1, ///< Stop at the middle of the platform
OSL_PLATFORM_FAR_END = 2, ///< Stop at the far end of the platform
@ -90,7 +90,7 @@ enum OrderStopLocation {
/**
* Reasons that could cause us to go to the depot.
*/
enum OrderDepotTypeFlags {
enum OrderDepotTypeFlags : uint8_t {
ODTF_MANUAL = 0, ///< Manually initiated order.
ODTFB_SERVICE = 1 << 0, ///< This depot order is because of the servicing limit.
ODTFB_PART_OF_ORDERS = 1 << 1, ///< This depot order is because of a regular order.
@ -99,7 +99,7 @@ enum OrderDepotTypeFlags {
/**
* Actions that can be performed when the vehicle enters the depot.
*/
enum OrderDepotActionFlags {
enum OrderDepotActionFlags : uint8_t {
ODATF_SERVICE_ONLY = 0, ///< Only service the vehicle.
ODATFB_HALT = 1 << 0, ///< Service the vehicle and then halt it.
ODATFB_NEAREST_DEPOT = 1 << 1, ///< Send the vehicle to the nearest depot.
@ -110,7 +110,7 @@ DECLARE_ENUM_AS_BIT_SET(OrderDepotActionFlags)
/**
* Variables (of a vehicle) to 'cause' skipping on.
*/
enum OrderConditionVariable {
enum OrderConditionVariable : uint8_t {
OCV_LOAD_PERCENTAGE, ///< Skip based on the amount of load
OCV_RELIABILITY, ///< Skip based on the reliability
OCV_MAX_SPEED, ///< Skip based on the maximum speed
@ -125,7 +125,7 @@ enum OrderConditionVariable {
/**
* Comparator for the skip reasoning.
*/
enum OrderConditionComparator {
enum OrderConditionComparator : uint8_t {
OCC_EQUALS, ///< Skip if both values are equal
OCC_NOT_EQUALS, ///< Skip if both values are not equal
OCC_LESS_THAN, ///< Skip if the value is less than the limit
@ -157,7 +157,7 @@ enum ModifyOrderFlags : uint8_t {
/**
* Depot action to switch to when doing a #MOF_DEPOT_ACTION.
*/
enum OrderDepotAction {
enum OrderDepotAction : uint8_t {
DA_ALWAYS_GO, ///< Always go to the depot
DA_SERVICE, ///< Service only if needed
DA_STOP, ///< Go to the depot and stop there

View File

@ -36,7 +36,7 @@ extern "C" {
CTRunDelegateGetWidthCallback getWidth;
} CTRunDelegateCallbacks;
enum {
enum : int32_t {
kCTRunDelegateVersion1 = 1,
kCTRunDelegateCurrentVersion = kCTRunDelegateVersion1
};

Some files were not shown because too many files have changed in this diff Show More