1
0
Fork 0

Codechange: rename DECLARE_POSTFIX_INCREMENT to DECLARE_INCREMENT_DECREMENT_OPERATORS

pull/13397/head
Rubidium 2025-01-26 22:16:16 +01:00 committed by rubidium42
parent 0207f91b8d
commit 45444f9666
30 changed files with 36 additions and 36 deletions

View File

@ -30,7 +30,7 @@ enum BridgePieces {
NUM_BRIDGE_PIECES, NUM_BRIDGE_PIECES,
}; };
DECLARE_POSTFIX_INCREMENT(BridgePieces) DECLARE_INCREMENT_DECREMENT_OPERATORS(BridgePieces)
static const uint MAX_BRIDGES = 13; ///< Maximal number of available bridge specs. static const uint MAX_BRIDGES = 13; ///< Maximal number of available bridge specs.
constexpr uint SPRITES_PER_BRIDGE_PIECE = 32; ///< Number of sprites there are per bridge piece. constexpr uint SPRITES_PER_BRIDGE_PIECE = 32; ///< Number of sprites there are per bridge piece.

View File

@ -50,7 +50,7 @@ enum CompanyManagerFaceVariable {
CMFV_GLASSES, CMFV_GLASSES,
CMFV_END, CMFV_END,
}; };
DECLARE_POSTFIX_INCREMENT(CompanyManagerFaceVariable) DECLARE_INCREMENT_DECREMENT_OPERATORS(CompanyManagerFaceVariable)
/** Information about the valid values of CompanyManagerFace bitgroups as well as the sprites to draw */ /** Information about the valid values of CompanyManagerFace bitgroups as well as the sprites to draw */
struct CompanyManagerFaceBitsInfo { struct CompanyManagerFaceBitsInfo {

View File

@ -34,7 +34,7 @@ enum Owner : uint8_t {
COMPANY_NEW_COMPANY = 254, ///< The client wants a new company COMPANY_NEW_COMPANY = 254, ///< The client wants a new company
COMPANY_SPECTATOR = 255, ///< The client is spectating COMPANY_SPECTATOR = 255, ///< The client is spectating
}; };
DECLARE_POSTFIX_INCREMENT(Owner) DECLARE_INCREMENT_DECREMENT_OPERATORS(Owner)
DECLARE_ENUM_AS_ADDABLE(Owner) DECLARE_ENUM_AS_ADDABLE(Owner)
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0' static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0'

View File

@ -57,8 +57,8 @@ inline constexpr enum_type operator --(enum_type &e, int)
return e_org; return e_org;
} }
/** Some enums need to have allowed incrementing (i.e. StationClassID) */ /** For some enums it is useful to have pre/post increment/decrement operators */
#define DECLARE_POSTFIX_INCREMENT(enum_type) \ #define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type) \
template <> struct is_enum_incrementable<enum_type> { \ template <> struct is_enum_incrementable<enum_type> { \
static const bool value = true; \ static const bool value = true; \
}; };

View File

@ -36,7 +36,7 @@ enum Direction : uint8_t {
}; };
/** Allow incrementing of Direction variables */ /** Allow incrementing of Direction variables */
DECLARE_POSTFIX_INCREMENT(Direction) DECLARE_INCREMENT_DECREMENT_OPERATORS(Direction)
/** /**
* Enumeration for the difference between two directions. * Enumeration for the difference between two directions.
@ -79,7 +79,7 @@ enum DiagDirection : uint8_t {
DIAGDIR_END, ///< Used for iterations DIAGDIR_END, ///< Used for iterations
INVALID_DIAGDIR = 0xFF, ///< Flag for an invalid DiagDirection INVALID_DIAGDIR = 0xFF, ///< Flag for an invalid DiagDirection
}; };
DECLARE_POSTFIX_INCREMENT(DiagDirection) DECLARE_INCREMENT_DECREMENT_OPERATORS(DiagDirection)
DECLARE_ENUM_AS_ADDABLE(DiagDirection) DECLARE_ENUM_AS_ADDABLE(DiagDirection)
/** /**
@ -102,7 +102,7 @@ enum DiagDirDiff {
}; };
/** Allow incrementing of DiagDirDiff variables */ /** Allow incrementing of DiagDirDiff variables */
DECLARE_POSTFIX_INCREMENT(DiagDirDiff) DECLARE_INCREMENT_DECREMENT_OPERATORS(DiagDirDiff)
/** /**

View File

@ -50,7 +50,7 @@ public:
virtual std::string_view GetName() const = 0; virtual std::string_view GetName() const = 0;
}; };
DECLARE_POSTFIX_INCREMENT(Driver::Type) DECLARE_INCREMENT_DECREMENT_OPERATORS(Driver::Type)
/** Base for all driver factories. */ /** Base for all driver factories. */

View File

@ -74,7 +74,7 @@ enum ScoreID {
SCORE_MAX = 1000, ///< The max score that can be in the performance history SCORE_MAX = 1000, ///< The max score that can be in the performance history
/* the scores together of score_info is allowed to be more! */ /* the scores together of score_info is allowed to be more! */
}; };
DECLARE_POSTFIX_INCREMENT(ScoreID) DECLARE_INCREMENT_DECREMENT_OPERATORS(ScoreID)
/** Data structure for storing how the score is computed for a single score id. */ /** Data structure for storing how the score is computed for a single score id. */
struct ScoreInfo { struct ScoreInfo {
@ -163,7 +163,7 @@ enum Price : uint8_t {
PR_END, PR_END,
INVALID_PRICE = 0xFF INVALID_PRICE = 0xFF
}; };
DECLARE_POSTFIX_INCREMENT(Price) DECLARE_INCREMENT_DECREMENT_OPERATORS(Price)
typedef Money Prices[PR_END]; ///< Prices of everything. @see Price typedef Money Prices[PR_END]; ///< Prices of everything. @see Price
typedef int8_t PriceMultipliers[PR_END]; typedef int8_t PriceMultipliers[PR_END];

View File

@ -153,7 +153,7 @@ enum Searchpath : unsigned {
NUM_SEARCHPATHS NUM_SEARCHPATHS
}; };
DECLARE_POSTFIX_INCREMENT(Searchpath) DECLARE_INCREMENT_DECREMENT_OPERATORS(Searchpath)
class FileHandle { class FileHandle {
public: public:

View File

@ -77,7 +77,7 @@ enum PerformanceElement {
PFE_AI14, ///< AI execution for player slot 15 PFE_AI14, ///< AI execution for player slot 15
PFE_MAX, ///< End of enum, must be last. PFE_MAX, ///< End of enum, must be last.
}; };
DECLARE_POSTFIX_INCREMENT(PerformanceElement) DECLARE_INCREMENT_DECREMENT_OPERATORS(PerformanceElement)
/** Type used to hold a performance timing measurement */ /** Type used to hold a performance timing measurement */
typedef uint64_t TimingMeasurement; typedef uint64_t TimingMeasurement;

View File

@ -248,7 +248,7 @@ enum FontSize {
FS_BEGIN = FS_NORMAL, ///< First font. FS_BEGIN = FS_NORMAL, ///< First font.
}; };
DECLARE_POSTFIX_INCREMENT(FontSize) DECLARE_INCREMENT_DECREMENT_OPERATORS(FontSize)
inline const char *FontSizeToName(FontSize fs) inline const char *FontSizeToName(FontSize fs)
{ {
@ -287,7 +287,7 @@ enum Colours : uint8_t {
COLOUR_END, COLOUR_END,
INVALID_COLOUR = 0xFF, INVALID_COLOUR = 0xFF,
}; };
DECLARE_POSTFIX_INCREMENT(Colours) DECLARE_INCREMENT_DECREMENT_OPERATORS(Colours)
DECLARE_ENUM_AS_ADDABLE(Colours) DECLARE_ENUM_AS_ADDABLE(Colours)
/** Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palette.png */ /** Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palette.png */

View File

@ -61,7 +61,7 @@ enum HouseZonesBits : uint8_t {
}; };
static_assert(HZB_END == 5); static_assert(HZB_END == 5);
DECLARE_POSTFIX_INCREMENT(HouseZonesBits) DECLARE_INCREMENT_DECREMENT_OPERATORS(HouseZonesBits)
enum HouseZones : uint16_t { enum HouseZones : uint16_t {
HZ_NOZNS = 0x0000, ///< 0 This is just to get rid of zeros, meaning none HZ_NOZNS = 0x0000, ///< 0 This is just to get rid of zeros, meaning none

View File

@ -57,7 +57,7 @@ enum LiveryScheme : uint8_t {
LS_END LS_END
}; };
DECLARE_POSTFIX_INCREMENT(LiveryScheme) DECLARE_INCREMENT_DECREMENT_OPERATORS(LiveryScheme)
/** List of different livery classes, used only by the livery GUI. */ /** List of different livery classes, used only by the livery GUI. */
enum LiveryClass : uint8_t { enum LiveryClass : uint8_t {

View File

@ -42,7 +42,7 @@
/* This file handles all the server-commands */ /* This file handles all the server-commands */
DECLARE_POSTFIX_INCREMENT(ClientID) DECLARE_INCREMENT_DECREMENT_OPERATORS(ClientID)
/** The identifier counter for new clients (is never decreased) */ /** The identifier counter for new clients (is never decreased) */
static ClientID _network_client_id = CLIENT_ID_FIRST; static ClientID _network_client_id = CLIENT_ID_FIRST;

View File

@ -52,7 +52,7 @@ enum GrfLoadingStage {
GLS_END, GLS_END,
}; };
DECLARE_POSTFIX_INCREMENT(GrfLoadingStage) DECLARE_INCREMENT_DECREMENT_OPERATORS(GrfLoadingStage)
enum GrfMiscBit { enum GrfMiscBit {
GMB_DESERT_TREES_FIELDS = 0, // Unsupported. GMB_DESERT_TREES_FIELDS = 0, // Unsupported.

View File

@ -77,7 +77,7 @@ enum AirportClassID {
}; };
/** Allow incrementing of AirportClassID variables */ /** Allow incrementing of AirportClassID variables */
DECLARE_POSTFIX_INCREMENT(AirportClassID) DECLARE_INCREMENT_DECREMENT_OPERATORS(AirportClassID)
/** TTDP airport types. Used to map our types to TTDPatch's */ /** TTDP airport types. Used to map our types to TTDPatch's */
enum TTDPAirportType { enum TTDPAirportType {

View File

@ -51,7 +51,7 @@ enum ObjectClassID : uint16_t {
INVALID_OBJECT_CLASS = UINT16_MAX, ///< Class for the less fortunate. INVALID_OBJECT_CLASS = UINT16_MAX, ///< Class for the less fortunate.
}; };
/** Allow incrementing of ObjectClassID variables */ /** Allow incrementing of ObjectClassID variables */
DECLARE_POSTFIX_INCREMENT(ObjectClassID) DECLARE_INCREMENT_DECREMENT_OPERATORS(ObjectClassID)
/** An object that isn't use for transport, industries or houses. /** An object that isn't use for transport, industries or houses.
* @note If you change this struct, adopt the initialization of * @note If you change this struct, adopt the initialization of

View File

@ -31,7 +31,7 @@ enum RoadStopClassID : uint16_t {
ROADSTOP_CLASS_WAYP, ///< Waypoint class. ROADSTOP_CLASS_WAYP, ///< Waypoint class.
ROADSTOP_CLASS_MAX = UINT16_MAX, ///< Maximum number of classes. ROADSTOP_CLASS_MAX = UINT16_MAX, ///< Maximum number of classes.
}; };
DECLARE_POSTFIX_INCREMENT(RoadStopClassID) DECLARE_INCREMENT_DECREMENT_OPERATORS(RoadStopClassID)
/* Some Triggers etc. */ /* Some Triggers etc. */
enum RoadStopRandomTrigger { enum RoadStopRandomTrigger {

View File

@ -103,7 +103,7 @@ enum VarSpriteGroupScope : uint8_t {
VSG_END VSG_END
}; };
DECLARE_POSTFIX_INCREMENT(VarSpriteGroupScope) DECLARE_INCREMENT_DECREMENT_OPERATORS(VarSpriteGroupScope)
enum DeterministicSpriteGroupSize : uint8_t { enum DeterministicSpriteGroupSize : uint8_t {
DSG_SIZE_BYTE, DSG_SIZE_BYTE,

View File

@ -91,7 +91,7 @@ enum StationClassID : uint16_t {
}; };
/** Allow incrementing of StationClassID variables */ /** Allow incrementing of StationClassID variables */
DECLARE_POSTFIX_INCREMENT(StationClassID) DECLARE_INCREMENT_DECREMENT_OPERATORS(StationClassID)
enum StationSpecFlags { enum StationSpecFlags {
SSF_SEPARATE_GROUND, ///< Use different sprite set for ground sprites. SSF_SEPARATE_GROUND, ///< Use different sprite set for ground sprites.

View File

@ -81,7 +81,7 @@ enum ColourShade : uint8_t {
SHADE_LIGHTEREST, SHADE_LIGHTEREST,
SHADE_END, SHADE_END,
}; };
DECLARE_POSTFIX_INCREMENT(ColourShade) DECLARE_INCREMENT_DECREMENT_OPERATORS(ColourShade)
uint8_t GetColourGradient(Colours colour, ColourShade shade); uint8_t GetColourGradient(Colours colour, ColourShade shade);
void SetColourGradient(Colours colour, ColourShade shade, uint8_t palette_colour); void SetColourGradient(Colours colour, ColourShade shade, uint8_t palette_colour);

View File

@ -35,7 +35,7 @@ enum RailType : uint8_t {
}; };
/** Allow incrementing of Track variables */ /** Allow incrementing of Track variables */
DECLARE_POSTFIX_INCREMENT(RailType) DECLARE_INCREMENT_DECREMENT_OPERATORS(RailType)
/** /**
* The different railtypes we support, but then a bitmask of them. * The different railtypes we support, but then a bitmask of them.

View File

@ -29,7 +29,7 @@ enum RoadType : uint8_t {
ROADTYPE_END = 63, ///< Used for iterations ROADTYPE_END = 63, ///< Used for iterations
INVALID_ROADTYPE = 63, ///< flag for invalid roadtype INVALID_ROADTYPE = 63, ///< flag for invalid roadtype
}; };
DECLARE_POSTFIX_INCREMENT(RoadType) DECLARE_INCREMENT_DECREMENT_OPERATORS(RoadType)
/** /**
* The different roadtypes we support, but then a bitmask of them. * The different roadtypes we support, but then a bitmask of them.

View File

@ -137,7 +137,7 @@ EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = ai_includes.hpp EXCLUDE_PATTERNS = ai_includes.hpp
EXCLUDE_SYMBOLS = GetClassName \ EXCLUDE_SYMBOLS = GetClassName \
DECLARE_ENUM_AS_BIT_SET \ DECLARE_ENUM_AS_BIT_SET \
DECLARE_POSTFIX_INCREMENT DECLARE_INCREMENT_DECREMENT_OPERATORS
EXAMPLE_PATH = EXAMPLE_PATH =
EXAMPLE_PATTERNS = * EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO EXAMPLE_RECURSIVE = NO

View File

@ -137,7 +137,7 @@ EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = game_includes.hpp EXCLUDE_PATTERNS = game_includes.hpp
EXCLUDE_SYMBOLS = GetClassName \ EXCLUDE_SYMBOLS = GetClassName \
DECLARE_ENUM_AS_BIT_SET \ DECLARE_ENUM_AS_BIT_SET \
DECLARE_POSTFIX_INCREMENT DECLARE_INCREMENT_DECREMENT_OPERATORS
EXAMPLE_PATH = EXAMPLE_PATH =
EXAMPLE_PATTERNS = * EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO EXAMPLE_RECURSIVE = NO

View File

@ -450,6 +450,6 @@ public:
static ScriptCompany::Colours GetSecondaryLiveryColour(LiveryScheme scheme); static ScriptCompany::Colours GetSecondaryLiveryColour(LiveryScheme scheme);
}; };
DECLARE_POSTFIX_INCREMENT(ScriptCompany::CompanyID) DECLARE_INCREMENT_DECREMENT_OPERATORS(ScriptCompany::CompanyID)
#endif /* SCRIPT_COMPANY_HPP */ #endif /* SCRIPT_COMPANY_HPP */

View File

@ -1227,7 +1227,7 @@ enum RestrictionMode {
RM_CHANGED_AGAINST_NEW, ///< Show only settings which are different compared to the user's new game setting values. RM_CHANGED_AGAINST_NEW, ///< Show only settings which are different compared to the user's new game setting values.
RM_END, ///< End for iteration. RM_END, ///< End for iteration.
}; };
DECLARE_POSTFIX_INCREMENT(RestrictionMode) DECLARE_INCREMENT_DECREMENT_OPERATORS(RestrictionMode)
/** Filter for settings list. */ /** Filter for settings list. */
struct SettingFilter { struct SettingFilter {

View File

@ -25,7 +25,7 @@ enum TextfileType {
TFT_END, TFT_END,
}; };
DECLARE_POSTFIX_INCREMENT(TextfileType) DECLARE_INCREMENT_DECREMENT_OPERATORS(TextfileType)
DECLARE_ENUM_AS_ADDABLE(TextfileType) DECLARE_ENUM_AS_ADDABLE(TextfileType)
#endif /* TEXTFILE_TYPE_H */ #endif /* TEXTFILE_TYPE_H */

View File

@ -29,7 +29,7 @@ enum Track : uint8_t {
}; };
/** Allow incrementing of Track variables */ /** Allow incrementing of Track variables */
DECLARE_POSTFIX_INCREMENT(Track) DECLARE_INCREMENT_DECREMENT_OPERATORS(Track)
/** Bitfield corresponding to Track */ /** Bitfield corresponding to Track */
enum TrackBits : uint8_t { enum TrackBits : uint8_t {
@ -87,7 +87,7 @@ enum Trackdir : uint8_t {
}; };
/** Allow incrementing of Trackdir variables */ /** Allow incrementing of Trackdir variables */
DECLARE_POSTFIX_INCREMENT(Trackdir) DECLARE_INCREMENT_DECREMENT_OPERATORS(Trackdir)
/** /**
* Enumeration of bitmasks for the TrackDirs * Enumeration of bitmasks for the TrackDirs

View File

@ -34,7 +34,7 @@ enum VehicleType : uint8_t {
VEH_END, VEH_END,
VEH_INVALID = 0xFF, ///< Non-existing type of vehicle. VEH_INVALID = 0xFF, ///< Non-existing type of vehicle.
}; };
DECLARE_POSTFIX_INCREMENT(VehicleType) DECLARE_INCREMENT_DECREMENT_OPERATORS(VehicleType)
DECLARE_ENUM_AS_ADDABLE(VehicleType) DECLARE_ENUM_AS_ADDABLE(VehicleType)
struct Vehicle; struct Vehicle;

View File

@ -41,7 +41,7 @@ enum ZoomLevel : uint8_t {
ZOOM_LVL_MIN = ZOOM_LVL_IN_4X, ///< Minimum zoom level. ZOOM_LVL_MIN = ZOOM_LVL_IN_4X, ///< Minimum zoom level.
ZOOM_LVL_MAX = ZOOM_LVL_OUT_8X, ///< Maximum zoom level. ZOOM_LVL_MAX = ZOOM_LVL_OUT_8X, ///< Maximum zoom level.
}; };
DECLARE_POSTFIX_INCREMENT(ZoomLevel) DECLARE_INCREMENT_DECREMENT_OPERATORS(ZoomLevel)
DECLARE_ENUM_AS_ADDABLE(ZoomLevel) DECLARE_ENUM_AS_ADDABLE(ZoomLevel)
static uint const ZOOM_BASE_SHIFT = static_cast<uint>(ZOOM_LVL_NORMAL); static uint const ZOOM_BASE_SHIFT = static_cast<uint>(ZOOM_LVL_NORMAL);