diff options
author | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
commit | cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch) | |
tree | f647b20e1823f1846af88e832cf82a4a02e96e69 /src/Defines.h | |
parent | Improve clang-format config file, remove automatically enforced code style from contrib guide. (diff) | |
download | cuberite-clang-format-codebase.tar cuberite-clang-format-codebase.tar.gz cuberite-clang-format-codebase.tar.bz2 cuberite-clang-format-codebase.tar.lz cuberite-clang-format-codebase.tar.xz cuberite-clang-format-codebase.tar.zst cuberite-clang-format-codebase.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Defines.h | 259 |
1 files changed, 130 insertions, 129 deletions
diff --git a/src/Defines.h b/src/Defines.h index ab0a639c4..e645e4660 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -27,7 +27,7 @@ enum { // Open to suggestion on naming convention here :) MAX_EXPERIENCE_ORB_SIZE = 2000 -} ; +}; @@ -37,25 +37,25 @@ enum enum eBlockFace { BLOCK_FACE_NONE = -1, // Interacting with no block face - swinging the item in the air - BLOCK_FACE_XM = 4, // Interacting with the X- face of the block - BLOCK_FACE_XP = 5, // Interacting with the X+ face of the block - BLOCK_FACE_YM = 0, // Interacting with the Y- face of the block - BLOCK_FACE_YP = 1, // Interacting with the Y+ face of the block - BLOCK_FACE_ZM = 2, // Interacting with the Z- face of the block - BLOCK_FACE_ZP = 3, // Interacting with the Z+ face of the block + BLOCK_FACE_XM = 4, // Interacting with the X- face of the block + BLOCK_FACE_XP = 5, // Interacting with the X+ face of the block + BLOCK_FACE_YM = 0, // Interacting with the Y- face of the block + BLOCK_FACE_YP = 1, // Interacting with the Y+ face of the block + BLOCK_FACE_ZM = 2, // Interacting with the Z- face of the block + BLOCK_FACE_ZP = 3, // Interacting with the Z+ face of the block // Synonyms using the (deprecated) world directions: BLOCK_FACE_BOTTOM = BLOCK_FACE_YM, // Interacting with the bottom face of the block - BLOCK_FACE_TOP = BLOCK_FACE_YP, // Interacting with the top face of the block - BLOCK_FACE_NORTH = BLOCK_FACE_ZM, // Interacting with the northern face of the block - BLOCK_FACE_SOUTH = BLOCK_FACE_ZP, // Interacting with the southern face of the block - BLOCK_FACE_WEST = BLOCK_FACE_XM, // Interacting with the western face of the block - BLOCK_FACE_EAST = BLOCK_FACE_XP, // Interacting with the eastern face of the block + BLOCK_FACE_TOP = BLOCK_FACE_YP, // Interacting with the top face of the block + BLOCK_FACE_NORTH = BLOCK_FACE_ZM, // Interacting with the northern face of the block + BLOCK_FACE_SOUTH = BLOCK_FACE_ZP, // Interacting with the southern face of the block + BLOCK_FACE_WEST = BLOCK_FACE_XM, // Interacting with the western face of the block + BLOCK_FACE_EAST = BLOCK_FACE_XP, // Interacting with the eastern face of the block // Bounds, used for range-checking: BLOCK_FACE_MIN = -1, - BLOCK_FACE_MAX = 5, -} ; + BLOCK_FACE_MAX = 5, +}; @@ -64,14 +64,14 @@ enum eBlockFace /** PlayerDigging status constants */ enum { - DIG_STATUS_STARTED = 0, - DIG_STATUS_CANCELLED = 1, - DIG_STATUS_FINISHED = 2, - DIG_STATUS_DROP_STACK = 3, - DIG_STATUS_DROP_HELD = 4, - DIG_STATUS_SHOOT_EAT = 5, + DIG_STATUS_STARTED = 0, + DIG_STATUS_CANCELLED = 1, + DIG_STATUS_FINISHED = 2, + DIG_STATUS_DROP_STACK = 3, + DIG_STATUS_DROP_HELD = 4, + DIG_STATUS_SHOOT_EAT = 5, DIG_STATUS_SWAP_ITEM_IN_HAND = 6, -} ; +}; @@ -115,7 +115,7 @@ enum eClickAction caUnknown = 255, // Keep this list in sync with ClickActionToString() function below! -} ; +}; @@ -123,23 +123,23 @@ enum eClickAction enum eGameMode { - eGameMode_NotSet = -1, - eGameMode_Survival = 0, - eGameMode_Creative = 1, + eGameMode_NotSet = -1, + eGameMode_Survival = 0, + eGameMode_Creative = 1, eGameMode_Adventure = 2, eGameMode_Spectator = 3, // Easier-to-use synonyms: - gmNotSet = eGameMode_NotSet, - gmSurvival = eGameMode_Survival, - gmCreative = eGameMode_Creative, + gmNotSet = eGameMode_NotSet, + gmSurvival = eGameMode_Survival, + gmCreative = eGameMode_Creative, gmAdventure = eGameMode_Adventure, gmSpectator = eGameMode_Spectator, // These two are used to check GameMode for validity when converting from integers. gmMax, // Gets automatically assigned gmMin = 0, -} ; +}; @@ -147,10 +147,10 @@ enum eGameMode enum eChatType { - ctChatBox = 0, - ctSystem = 1, + ctChatBox = 0, + ctSystem = 1, ctAboveActionBar = 2, -} ; +}; @@ -158,16 +158,16 @@ enum eChatType enum eWeather { - eWeather_Sunny = 0, - eWeather_Rain = 1, + eWeather_Sunny = 0, + eWeather_Rain = 1, eWeather_ThunderStorm = 2, // Easier-to-use synonyms: - wSunny = eWeather_Sunny, - wRain = eWeather_Rain, + wSunny = eWeather_Sunny, + wRain = eWeather_Rain, wThunderstorm = eWeather_ThunderStorm, - wStorm = wThunderstorm, -} ; + wStorm = wThunderstorm, +}; @@ -175,13 +175,13 @@ enum eWeather enum eMobHeadType { - SKULL_TYPE_SKELETON = 0, - SKULL_TYPE_WITHER = 1, - SKULL_TYPE_ZOMBIE = 2, - SKULL_TYPE_PLAYER = 3, - SKULL_TYPE_CREEPER = 4, - SKULL_TYPE_DRAGON = 5, -} ; + SKULL_TYPE_SKELETON = 0, + SKULL_TYPE_WITHER = 1, + SKULL_TYPE_ZOMBIE = 2, + SKULL_TYPE_PLAYER = 3, + SKULL_TYPE_CREEPER = 4, + SKULL_TYPE_DRAGON = 5, +}; @@ -205,7 +205,7 @@ enum eMobHeadRotation SKULL_ROTATION_WEST_NORTH_WEST = 13, SKULL_ROTATION_NORTH_WEST = 14, SKULL_ROTATION_NORTH_NORTH_WEST = 15, -} ; +}; @@ -229,11 +229,11 @@ enum eSkinPart /** Dimension of a world */ enum eDimension { - dimNether = -1, + dimNether = -1, dimOverworld = 0, - dimEnd = 1, - dimNotSet = 255, // For things that need an "indeterminate" state, such as cProtocol's LastSentDimension -} ; + dimEnd = 1, + dimNotSet = 255, // For things that need an "indeterminate" state, such as cProtocol's LastSentDimension +}; @@ -243,51 +243,51 @@ enum eDimension enum eDamageType { // Canonical names for the types (as documented in the plugin wiki): - dtAttack, // Being attacked by a mob - dtRangedAttack, // Being attacked by a projectile, possibly from a mob - dtLightning, // Hit by a lightning strike - dtFalling, // Falling down; dealt when hitting the ground - dtDrowning, // Drowning in water / lava - dtSuffocating, // Suffocating inside a block - dtStarving, // Hunger - dtCactusContact, // Contact with a cactus block - dtMagmaContact, // Contact with a magma block - dtLavaContact, // Contact with a lava block - dtPoisoning, // Having the poison effect - dtWithering, // Having the wither effect - dtOnFire, // Being on fire - dtFireContact, // Standing inside a fire block - dtInVoid, // Falling into the Void (Y < 0) + dtAttack, // Being attacked by a mob + dtRangedAttack, // Being attacked by a projectile, possibly from a mob + dtLightning, // Hit by a lightning strike + dtFalling, // Falling down; dealt when hitting the ground + dtDrowning, // Drowning in water / lava + dtSuffocating, // Suffocating inside a block + dtStarving, // Hunger + dtCactusContact, // Contact with a cactus block + dtMagmaContact, // Contact with a magma block + dtLavaContact, // Contact with a lava block + dtPoisoning, // Having the poison effect + dtWithering, // Having the wither effect + dtOnFire, // Being on fire + dtFireContact, // Standing inside a fire block + dtInVoid, // Falling into the Void (Y < 0) dtPotionOfHarming, - dtEnderPearl, // Thrown an ender pearl, teleported by it - dtAdmin, // Damage applied by an admin command - dtExplosion, // Damage applied by an explosion - dtEnvironment, // Damage dealt to mobs from environment: enderman in rain, snow golem in desert + dtEnderPearl, // Thrown an ender pearl, teleported by it + dtAdmin, // Damage applied by an admin command + dtExplosion, // Damage applied by an explosion + dtEnvironment, // Damage dealt to mobs from environment: enderman in rain, snow golem in desert // Some common synonyms: - dtPawnAttack = dtAttack, + dtPawnAttack = dtAttack, dtEntityAttack = dtAttack, - dtMob = dtAttack, - dtMobAttack = dtAttack, - dtArrowAttack = dtRangedAttack, - dtArrow = dtRangedAttack, - dtProjectile = dtRangedAttack, - dtFall = dtFalling, - dtDrown = dtDrowning, - dtSuffocation = dtSuffocating, - dtStarvation = dtStarving, - dtHunger = dtStarving, - dtCactus = dtCactusContact, - dtCactuses = dtCactusContact, - dtCacti = dtCactusContact, - dtMagma = dtMagmaContact, - dtLava = dtLavaContact, - dtPoison = dtPoisoning, - dtWither = dtWithering, - dtBurning = dtOnFire, - dtInFire = dtFireContact, - dtPlugin = dtAdmin, -} ; + dtMob = dtAttack, + dtMobAttack = dtAttack, + dtArrowAttack = dtRangedAttack, + dtArrow = dtRangedAttack, + dtProjectile = dtRangedAttack, + dtFall = dtFalling, + dtDrown = dtDrowning, + dtSuffocation = dtSuffocating, + dtStarvation = dtStarving, + dtHunger = dtStarving, + dtCactus = dtCactusContact, + dtCactuses = dtCactusContact, + dtCacti = dtCactusContact, + dtMagma = dtMagmaContact, + dtLava = dtLavaContact, + dtPoison = dtPoisoning, + dtWither = dtWithering, + dtBurning = dtOnFire, + dtInFire = dtFireContact, + dtPlugin = dtAdmin, +}; @@ -318,7 +318,7 @@ enum eExplosionSource esWitherBirth, esWitherSkull, esMax, -} ; +}; @@ -329,7 +329,7 @@ enum eShrapnelLevel slNone, slGravityAffectedOnly, slAll -} ; +}; @@ -342,7 +342,7 @@ enum eSpreadSource ssMushroomSpread, ssMycelSpread, ssVineSpread, -} ; +}; @@ -353,23 +353,23 @@ enum eMessageType // https://forum.cuberite.org/thread-1212.html // MessageType... - mtCustom, // Send raw data without any processing - mtFailure, // Something could not be done (i.e. command not executed due to insufficient privilege) - mtInformation, // Informational message (i.e. command usage) - mtSuccess, // Something executed successfully - mtWarning, // Something concerning (i.e. reload) is about to happen - mtFatal, // Something catastrophic occured (i.e. plugin crash) - mtDeath, // Denotes death of player + mtCustom, // Send raw data without any processing + mtFailure, // Something could not be done (i.e. command not executed due to insufficient privilege) + mtInformation, // Informational message (i.e. command usage) + mtSuccess, // Something executed successfully + mtWarning, // Something concerning (i.e. reload) is about to happen + mtFatal, // Something catastrophic occured (i.e. plugin crash) + mtDeath, // Denotes death of player mtPrivateMessage, // Player to player messaging identifier - mtJoin, // A player has joined the server - mtLeave, // A player has left the server - mtMaxPlusOne, // The first invalid type, used for checking on LuaAPI boundaries + mtJoin, // A player has joined the server + mtLeave, // A player has left the server + mtMaxPlusOne, // The first invalid type, used for checking on LuaAPI boundaries // Common aliases: - mtFail = mtFailure, + mtFail = mtFailure, mtError = mtFailure, - mtInfo = mtInformation, - mtPM = mtPrivateMessage, + mtInfo = mtInformation, + mtPM = mtPrivateMessage, }; @@ -542,7 +542,7 @@ eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace); eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace); /** Returns a blockface opposite to the one specified. */ -eBlockFace ReverseBlockFace(eBlockFace a_BlockFace); +eBlockFace ReverseBlockFace(eBlockFace a_BlockFace); /** Returns the textual representation of the BlockFace constant. */ AString BlockFaceToString(eBlockFace a_BlockFace); @@ -553,7 +553,8 @@ bool IsValidBlock(int a_BlockType); /** Returns true if the specified item type is valid (known). */ bool IsValidItem(int a_ItemType); -/** Translates a dimension string to dimension enum. Takes either a number or a dimension alias (built-in). Returns dimOverworld on failure */ +/** Translates a dimension string to dimension enum. Takes either a number or a dimension alias (built-in). Returns + * dimOverworld on failure */ extern eDimension StringToDimension(const AString & a_DimensionString); /** Translates a dimension enum to dimension string. @@ -563,11 +564,12 @@ extern AString DimensionToString(eDimension a_Dimension); /** Translates damage type constant to a string representation (built-in). */ extern AString DamageTypeToString(eDamageType a_DamageType); -/** Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure */ +/** Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 + * on failure */ extern eDamageType StringToDamageType(const AString & a_DamageString); -/** Modifies the specified coords so that they point to the block adjacent to the one specified through its specified face. -If a_Inverse is true, the opposite direction is used instead. */ +/** Modifies the specified coords so that they point to the block adjacent to the one specified through its specified +face. If a_Inverse is true, the opposite direction is used instead. */ void AddFaceDirection(int & a_BlockX, int & a_BlockY, int & a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse = false); /** Returns the coords of a block that is neighboring the specified position through its specified face. @@ -613,8 +615,7 @@ inline void VectorToEuler(double a_X, double a_Y, double a_Z, double & a_Pan, do -template <class T> -inline T Diff(T a_Val1, T a_Val2) +template <class T> inline T Diff(T a_Val1, T a_Val2) { return std::abs(a_Val1 - a_Val2); } @@ -642,33 +643,33 @@ inline double NormalizeAngleDegrees(const double a_Degrees) namespace ItemCategory { - bool IsPickaxe(short a_ItemType); +bool IsPickaxe(short a_ItemType); - bool IsAxe(short a_ItemType); +bool IsAxe(short a_ItemType); - bool IsSword(short a_ItemType); +bool IsSword(short a_ItemType); - bool IsHoe(short a_ItemType); +bool IsHoe(short a_ItemType); - bool IsShovel(short a_ItemType); +bool IsShovel(short a_ItemType); - bool IsTool(short a_ItemType); +bool IsTool(short a_ItemType); - bool IsHelmet(short a_ItemType); +bool IsHelmet(short a_ItemType); - bool IsChestPlate(short a_ItemType); +bool IsChestPlate(short a_ItemType); - bool IsLeggings(short a_ItemType); +bool IsLeggings(short a_ItemType); - bool IsBoots(short a_ItemType); +bool IsBoots(short a_ItemType); - bool IsMinecart(short a_ItemType); +bool IsMinecart(short a_ItemType); - bool IsArmor(short a_ItemType); +bool IsArmor(short a_ItemType); - bool IsHorseArmor(short a_ItemType); +bool IsHorseArmor(short a_ItemType); - bool IsVillagerFood(short a_ItemType); -} +bool IsVillagerFood(short a_ItemType); +} // namespace ItemCategory // tolua_end |