From 45444f96666dd947013005488373295a8b923cb5 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 26 Jan 2025 22:16:16 +0100 Subject: [PATCH] Codechange: rename DECLARE_POSTFIX_INCREMENT to DECLARE_INCREMENT_DECREMENT_OPERATORS --- src/bridge.h | 2 +- src/company_manager_face.h | 2 +- src/company_type.h | 2 +- src/core/enum_type.hpp | 4 ++-- src/direction_type.h | 6 +++--- src/driver.h | 2 +- src/economy_type.h | 4 ++-- src/fileio_type.h | 2 +- src/framerate_type.h | 2 +- src/gfx_type.h | 4 ++-- src/house.h | 2 +- src/livery.h | 2 +- src/network/network_server.cpp | 2 +- src/newgrf.h | 2 +- src/newgrf_airport.h | 2 +- src/newgrf_object.h | 2 +- src/newgrf_roadstop.h | 2 +- src/newgrf_spritegroup.h | 2 +- src/newgrf_station.h | 2 +- src/palette_func.h | 2 +- src/rail_type.h | 2 +- src/road_type.h | 2 +- src/script/api/Doxyfile_AI.in | 2 +- src/script/api/Doxyfile_GS.in | 2 +- src/script/api/script_company.hpp | 2 +- src/settings_gui.cpp | 2 +- src/textfile_type.h | 2 +- src/track_type.h | 4 ++-- src/vehicle_type.h | 2 +- src/zoom_type.h | 2 +- 30 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/bridge.h b/src/bridge.h index 4f849baa52..e54e94cf72 100644 --- a/src/bridge.h +++ b/src/bridge.h @@ -30,7 +30,7 @@ enum BridgePieces { NUM_BRIDGE_PIECES, }; -DECLARE_POSTFIX_INCREMENT(BridgePieces) +DECLARE_INCREMENT_DECREMENT_OPERATORS(BridgePieces) 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. diff --git a/src/company_manager_face.h b/src/company_manager_face.h index ed551c49cd..db64b720f8 100644 --- a/src/company_manager_face.h +++ b/src/company_manager_face.h @@ -50,7 +50,7 @@ enum CompanyManagerFaceVariable { CMFV_GLASSES, 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 */ struct CompanyManagerFaceBitsInfo { diff --git a/src/company_type.h b/src/company_type.h index 355bde8630..0118e0e4a0 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -34,7 +34,7 @@ enum Owner : uint8_t { COMPANY_NEW_COMPANY = 254, ///< The client wants a new company COMPANY_SPECTATOR = 255, ///< The client is spectating }; -DECLARE_POSTFIX_INCREMENT(Owner) +DECLARE_INCREMENT_DECREMENT_OPERATORS(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' diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp index 753037309c..f36f96156c 100644 --- a/src/core/enum_type.hpp +++ b/src/core/enum_type.hpp @@ -57,8 +57,8 @@ inline constexpr enum_type operator --(enum_type &e, int) return e_org; } -/** Some enums need to have allowed incrementing (i.e. StationClassID) */ -#define DECLARE_POSTFIX_INCREMENT(enum_type) \ +/** For some enums it is useful to have pre/post increment/decrement operators */ +#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type) \ template <> struct is_enum_incrementable { \ static const bool value = true; \ }; diff --git a/src/direction_type.h b/src/direction_type.h index 84bc130a84..b372300f38 100644 --- a/src/direction_type.h +++ b/src/direction_type.h @@ -36,7 +36,7 @@ enum Direction : uint8_t { }; /** Allow incrementing of Direction variables */ -DECLARE_POSTFIX_INCREMENT(Direction) +DECLARE_INCREMENT_DECREMENT_OPERATORS(Direction) /** * Enumeration for the difference between two directions. @@ -79,7 +79,7 @@ enum DiagDirection : uint8_t { DIAGDIR_END, ///< Used for iterations INVALID_DIAGDIR = 0xFF, ///< Flag for an invalid DiagDirection }; -DECLARE_POSTFIX_INCREMENT(DiagDirection) +DECLARE_INCREMENT_DECREMENT_OPERATORS(DiagDirection) DECLARE_ENUM_AS_ADDABLE(DiagDirection) /** @@ -102,7 +102,7 @@ enum DiagDirDiff { }; /** Allow incrementing of DiagDirDiff variables */ -DECLARE_POSTFIX_INCREMENT(DiagDirDiff) +DECLARE_INCREMENT_DECREMENT_OPERATORS(DiagDirDiff) /** diff --git a/src/driver.h b/src/driver.h index ef39391890..37d14e8064 100644 --- a/src/driver.h +++ b/src/driver.h @@ -50,7 +50,7 @@ public: virtual std::string_view GetName() const = 0; }; -DECLARE_POSTFIX_INCREMENT(Driver::Type) +DECLARE_INCREMENT_DECREMENT_OPERATORS(Driver::Type) /** Base for all driver factories. */ diff --git a/src/economy_type.h b/src/economy_type.h index 73f2f384ea..0ee5e9e79b 100644 --- a/src/economy_type.h +++ b/src/economy_type.h @@ -74,7 +74,7 @@ enum ScoreID { 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_POSTFIX_INCREMENT(ScoreID) +DECLARE_INCREMENT_DECREMENT_OPERATORS(ScoreID) /** Data structure for storing how the score is computed for a single score id. */ struct ScoreInfo { @@ -163,7 +163,7 @@ enum Price : uint8_t { PR_END, INVALID_PRICE = 0xFF }; -DECLARE_POSTFIX_INCREMENT(Price) +DECLARE_INCREMENT_DECREMENT_OPERATORS(Price) typedef Money Prices[PR_END]; ///< Prices of everything. @see Price typedef int8_t PriceMultipliers[PR_END]; diff --git a/src/fileio_type.h b/src/fileio_type.h index a8c3469f0f..1b55b257a3 100644 --- a/src/fileio_type.h +++ b/src/fileio_type.h @@ -153,7 +153,7 @@ enum Searchpath : unsigned { NUM_SEARCHPATHS }; -DECLARE_POSTFIX_INCREMENT(Searchpath) +DECLARE_INCREMENT_DECREMENT_OPERATORS(Searchpath) class FileHandle { public: diff --git a/src/framerate_type.h b/src/framerate_type.h index 8dd84c29ce..722595519b 100644 --- a/src/framerate_type.h +++ b/src/framerate_type.h @@ -77,7 +77,7 @@ enum PerformanceElement { PFE_AI14, ///< AI execution for player slot 15 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 */ typedef uint64_t TimingMeasurement; diff --git a/src/gfx_type.h b/src/gfx_type.h index 61db1de4df..984c2d9132 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -248,7 +248,7 @@ enum FontSize { FS_BEGIN = FS_NORMAL, ///< First font. }; -DECLARE_POSTFIX_INCREMENT(FontSize) +DECLARE_INCREMENT_DECREMENT_OPERATORS(FontSize) inline const char *FontSizeToName(FontSize fs) { @@ -287,7 +287,7 @@ enum Colours : uint8_t { COLOUR_END, INVALID_COLOUR = 0xFF, }; -DECLARE_POSTFIX_INCREMENT(Colours) +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 */ diff --git a/src/house.h b/src/house.h index 914a44ca35..0b47e6570e 100644 --- a/src/house.h +++ b/src/house.h @@ -61,7 +61,7 @@ enum HouseZonesBits : uint8_t { }; static_assert(HZB_END == 5); -DECLARE_POSTFIX_INCREMENT(HouseZonesBits) +DECLARE_INCREMENT_DECREMENT_OPERATORS(HouseZonesBits) enum HouseZones : uint16_t { HZ_NOZNS = 0x0000, ///< 0 This is just to get rid of zeros, meaning none diff --git a/src/livery.h b/src/livery.h index d9371fb9ba..8bd68fa42d 100644 --- a/src/livery.h +++ b/src/livery.h @@ -57,7 +57,7 @@ enum LiveryScheme : uint8_t { LS_END }; -DECLARE_POSTFIX_INCREMENT(LiveryScheme) +DECLARE_INCREMENT_DECREMENT_OPERATORS(LiveryScheme) /** List of different livery classes, used only by the livery GUI. */ enum LiveryClass : uint8_t { diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index be04e39a99..bcbfa0fe0b 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -42,7 +42,7 @@ /* 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) */ static ClientID _network_client_id = CLIENT_ID_FIRST; diff --git a/src/newgrf.h b/src/newgrf.h index 7a4f1be93d..518f9cb2c4 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -52,7 +52,7 @@ enum GrfLoadingStage { GLS_END, }; -DECLARE_POSTFIX_INCREMENT(GrfLoadingStage) +DECLARE_INCREMENT_DECREMENT_OPERATORS(GrfLoadingStage) enum GrfMiscBit { GMB_DESERT_TREES_FIELDS = 0, // Unsupported. diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index 3242e482c5..9c1607a6e0 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -77,7 +77,7 @@ enum AirportClassID { }; /** 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 */ enum TTDPAirportType { diff --git a/src/newgrf_object.h b/src/newgrf_object.h index 799896f309..7fecb0e58a 100644 --- a/src/newgrf_object.h +++ b/src/newgrf_object.h @@ -51,7 +51,7 @@ enum ObjectClassID : uint16_t { INVALID_OBJECT_CLASS = UINT16_MAX, ///< Class for the less fortunate. }; /** 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. * @note If you change this struct, adopt the initialization of diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h index 93f1629770..eb661f5d72 100644 --- a/src/newgrf_roadstop.h +++ b/src/newgrf_roadstop.h @@ -31,7 +31,7 @@ enum RoadStopClassID : uint16_t { ROADSTOP_CLASS_WAYP, ///< Waypoint class. ROADSTOP_CLASS_MAX = UINT16_MAX, ///< Maximum number of classes. }; -DECLARE_POSTFIX_INCREMENT(RoadStopClassID) +DECLARE_INCREMENT_DECREMENT_OPERATORS(RoadStopClassID) /* Some Triggers etc. */ enum RoadStopRandomTrigger { diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index ac8087d022..662fb92922 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -103,7 +103,7 @@ enum VarSpriteGroupScope : uint8_t { VSG_END }; -DECLARE_POSTFIX_INCREMENT(VarSpriteGroupScope) +DECLARE_INCREMENT_DECREMENT_OPERATORS(VarSpriteGroupScope) enum DeterministicSpriteGroupSize : uint8_t { DSG_SIZE_BYTE, diff --git a/src/newgrf_station.h b/src/newgrf_station.h index a6dae52f52..763243698c 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -91,7 +91,7 @@ enum StationClassID : uint16_t { }; /** Allow incrementing of StationClassID variables */ -DECLARE_POSTFIX_INCREMENT(StationClassID) +DECLARE_INCREMENT_DECREMENT_OPERATORS(StationClassID) enum StationSpecFlags { SSF_SEPARATE_GROUND, ///< Use different sprite set for ground sprites. diff --git a/src/palette_func.h b/src/palette_func.h index 5494203b0f..aabf92120d 100644 --- a/src/palette_func.h +++ b/src/palette_func.h @@ -81,7 +81,7 @@ enum ColourShade : uint8_t { SHADE_LIGHTEREST, SHADE_END, }; -DECLARE_POSTFIX_INCREMENT(ColourShade) +DECLARE_INCREMENT_DECREMENT_OPERATORS(ColourShade) uint8_t GetColourGradient(Colours colour, ColourShade shade); void SetColourGradient(Colours colour, ColourShade shade, uint8_t palette_colour); diff --git a/src/rail_type.h b/src/rail_type.h index c72f4583da..1d7c244d2a 100644 --- a/src/rail_type.h +++ b/src/rail_type.h @@ -35,7 +35,7 @@ enum RailType : uint8_t { }; /** 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. diff --git a/src/road_type.h b/src/road_type.h index 96be7b858e..b623e8523d 100644 --- a/src/road_type.h +++ b/src/road_type.h @@ -29,7 +29,7 @@ enum RoadType : uint8_t { ROADTYPE_END = 63, ///< Used for iterations 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. diff --git a/src/script/api/Doxyfile_AI.in b/src/script/api/Doxyfile_AI.in index 71ed743b37..4cf9f9eb85 100644 --- a/src/script/api/Doxyfile_AI.in +++ b/src/script/api/Doxyfile_AI.in @@ -137,7 +137,7 @@ EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = ai_includes.hpp EXCLUDE_SYMBOLS = GetClassName \ DECLARE_ENUM_AS_BIT_SET \ - DECLARE_POSTFIX_INCREMENT + DECLARE_INCREMENT_DECREMENT_OPERATORS EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO diff --git a/src/script/api/Doxyfile_GS.in b/src/script/api/Doxyfile_GS.in index 2a1ba5dbd9..78e1ce8ac3 100644 --- a/src/script/api/Doxyfile_GS.in +++ b/src/script/api/Doxyfile_GS.in @@ -137,7 +137,7 @@ EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = game_includes.hpp EXCLUDE_SYMBOLS = GetClassName \ DECLARE_ENUM_AS_BIT_SET \ - DECLARE_POSTFIX_INCREMENT + DECLARE_INCREMENT_DECREMENT_OPERATORS EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO diff --git a/src/script/api/script_company.hpp b/src/script/api/script_company.hpp index e5dad4c194..a56f3ba0a2 100644 --- a/src/script/api/script_company.hpp +++ b/src/script/api/script_company.hpp @@ -450,6 +450,6 @@ public: static ScriptCompany::Colours GetSecondaryLiveryColour(LiveryScheme scheme); }; -DECLARE_POSTFIX_INCREMENT(ScriptCompany::CompanyID) +DECLARE_INCREMENT_DECREMENT_OPERATORS(ScriptCompany::CompanyID) #endif /* SCRIPT_COMPANY_HPP */ diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 227aa584fa..de3628e40e 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -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_END, ///< End for iteration. }; -DECLARE_POSTFIX_INCREMENT(RestrictionMode) +DECLARE_INCREMENT_DECREMENT_OPERATORS(RestrictionMode) /** Filter for settings list. */ struct SettingFilter { diff --git a/src/textfile_type.h b/src/textfile_type.h index 8482106f12..523798e167 100644 --- a/src/textfile_type.h +++ b/src/textfile_type.h @@ -25,7 +25,7 @@ enum TextfileType { TFT_END, }; -DECLARE_POSTFIX_INCREMENT(TextfileType) +DECLARE_INCREMENT_DECREMENT_OPERATORS(TextfileType) DECLARE_ENUM_AS_ADDABLE(TextfileType) #endif /* TEXTFILE_TYPE_H */ diff --git a/src/track_type.h b/src/track_type.h index e3c3f22b67..afbb390ef5 100644 --- a/src/track_type.h +++ b/src/track_type.h @@ -29,7 +29,7 @@ enum Track : uint8_t { }; /** Allow incrementing of Track variables */ -DECLARE_POSTFIX_INCREMENT(Track) +DECLARE_INCREMENT_DECREMENT_OPERATORS(Track) /** Bitfield corresponding to Track */ enum TrackBits : uint8_t { @@ -87,7 +87,7 @@ enum Trackdir : uint8_t { }; /** Allow incrementing of Trackdir variables */ -DECLARE_POSTFIX_INCREMENT(Trackdir) +DECLARE_INCREMENT_DECREMENT_OPERATORS(Trackdir) /** * Enumeration of bitmasks for the TrackDirs diff --git a/src/vehicle_type.h b/src/vehicle_type.h index bb645f6ef2..05523acdc2 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -34,7 +34,7 @@ enum VehicleType : uint8_t { VEH_END, VEH_INVALID = 0xFF, ///< Non-existing type of vehicle. }; -DECLARE_POSTFIX_INCREMENT(VehicleType) +DECLARE_INCREMENT_DECREMENT_OPERATORS(VehicleType) DECLARE_ENUM_AS_ADDABLE(VehicleType) struct Vehicle; diff --git a/src/zoom_type.h b/src/zoom_type.h index 89c812b06a..2308ac6dd0 100644 --- a/src/zoom_type.h +++ b/src/zoom_type.h @@ -41,7 +41,7 @@ enum ZoomLevel : uint8_t { ZOOM_LVL_MIN = ZOOM_LVL_IN_4X, ///< Minimum 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) static uint const ZOOM_BASE_SHIFT = static_cast(ZOOM_LVL_NORMAL);