"static const" -> "static constexpr" in headers

pull/593/head
Petr Mikheev 4 years ago
parent 78894b6129
commit 7bbbe40abe

@ -34,7 +34,7 @@ namespace CSMPrefs
void storeValue(const QKeySequence& sequence);
void resetState();
static const int MaxKeys = 4;
static constexpr int MaxKeys = 4;
QPushButton* mButton;

@ -35,20 +35,20 @@ namespace MWGui
bool onDropItem(const MWWorld::Ptr &item, int count) override;
bool onTakeItem(const MWWorld::Ptr &item, int count) override;
static const int Category_Weapon = (1<<1);
static const int Category_Apparel = (1<<2);
static const int Category_Misc = (1<<3);
static const int Category_Magic = (1<<4);
static const int Category_All = 255;
static const int Filter_OnlyIngredients = (1<<0);
static const int Filter_OnlyEnchanted = (1<<1);
static const int Filter_OnlyEnchantable = (1<<2);
static const int Filter_OnlyChargedSoulstones = (1<<3);
static const int Filter_OnlyUsableItems = (1<<4); // Only items with a Use action
static const int Filter_OnlyRepairable = (1<<5);
static const int Filter_OnlyRechargable = (1<<6);
static const int Filter_OnlyRepairTools = (1<<7);
static constexpr int Category_Weapon = (1<<1);
static constexpr int Category_Apparel = (1<<2);
static constexpr int Category_Misc = (1<<3);
static constexpr int Category_Magic = (1<<4);
static constexpr int Category_All = 255;
static constexpr int Filter_OnlyIngredients = (1<<0);
static constexpr int Filter_OnlyEnchanted = (1<<1);
static constexpr int Filter_OnlyEnchantable = (1<<2);
static constexpr int Filter_OnlyChargedSoulstones = (1<<3);
static constexpr int Filter_OnlyUsableItems = (1<<4); // Only items with a Use action
static constexpr int Filter_OnlyRepairable = (1<<5);
static constexpr int Filter_OnlyRechargable = (1<<6);
static constexpr int Filter_OnlyRepairTools = (1<<7);
private:

@ -268,7 +268,7 @@ namespace MWGui
void initialiseOverride() override;
private:
static const int sIconOffset = 24;
static constexpr int sIconOffset = 24;
void updateWidgets();

@ -24,7 +24,7 @@ namespace MWMechanics
{
struct CorprusStats
{
static const int sWorseningPeriod = 24;
static constexpr int sWorseningPeriod = 24;
int mWorsenings[ESM::Attribute::Length];
MWWorld::TimeStamp mNextWorsening;

@ -12,7 +12,7 @@ namespace MWMechanics
{
struct Movement;
static const int NUM_EVADE_DIRECTIONS = 4;
static constexpr int NUM_EVADE_DIRECTIONS = 4;
/// tests actor's proximity to a closed door by default
bool proximityToDoor(const MWWorld::Ptr& actor, float minDist);

@ -3,24 +3,24 @@
namespace MWPhysics
{
static const float sStepSizeUp = 34.0f;
static const float sStepSizeDown = 62.0f;
static constexpr float sStepSizeUp = 34.0f;
static constexpr float sStepSizeDown = 62.0f;
static const float sMinStep = 10.0f; // hack to skip over tiny unwalkable slopes
static const float sMinStep2 = 20.0f; // hack to skip over shorter but longer/wider/further unwalkable slopes
static constexpr float sMinStep = 10.0f; // hack to skip over tiny unwalkable slopes
static constexpr float sMinStep2 = 20.0f; // hack to skip over shorter but longer/wider/further unwalkable slopes
// whether to do the above stairstepping logic hacks to work around bad morrowind assets - disabling causes problems but improves performance
static const bool sDoExtraStairHacks = true;
static constexpr bool sDoExtraStairHacks = true;
static const float sGroundOffset = 1.0f;
static const float sMaxSlope = 49.0f;
static constexpr float sGroundOffset = 1.0f;
static constexpr float sMaxSlope = 49.0f;
// Arbitrary number. To prevent infinite loops. They shouldn't happen but it's good to be prepared.
static const int sMaxIterations = 8;
static constexpr int sMaxIterations = 8;
// Allows for more precise movement solving without getting stuck or snagging too easily.
static const float sCollisionMargin = 0.1;
static constexpr float sCollisionMargin = 0.1;
// Allow for a small amount of penetration to prevent numerical precision issues from causing the "unstuck"ing code to run unnecessarily
// Currently set to 0 because having the "unstuck"ing code run whenever possible prevents some glitchy snagging issues
static const float sAllowedPenetration = 0.0;
static constexpr float sAllowedPenetration = 0.0;
}
#endif

@ -102,7 +102,7 @@ public:
BlendMask_All = BlendMask_LowerBody | BlendMask_UpperBody
};
/* This is the number of *discrete* blend masks. */
static const size_t sNumBlendMasks = 4;
static constexpr size_t sNumBlendMasks = 4;
/// Holds an animation priority value for each BoneGroup.
struct AnimPriority

@ -14,7 +14,7 @@ namespace MWScript
{
struct ExplicitRef
{
static const bool implicit = false;
static constexpr bool implicit = false;
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required = true,
bool activeOnly = false) const;
@ -22,7 +22,7 @@ namespace MWScript
struct ImplicitRef
{
static const bool implicit = true;
static constexpr bool implicit = true;
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required = true,
bool activeOnly = false) const;

@ -73,22 +73,22 @@ namespace MWWorld
{
public:
static const int Type_Potion = 0x0001;
static const int Type_Apparatus = 0x0002;
static const int Type_Armor = 0x0004;
static const int Type_Book = 0x0008;
static const int Type_Clothing = 0x0010;
static const int Type_Ingredient = 0x0020;
static const int Type_Light = 0x0040;
static const int Type_Lockpick = 0x0080;
static const int Type_Miscellaneous = 0x0100;
static const int Type_Probe = 0x0200;
static const int Type_Repair = 0x0400;
static const int Type_Weapon = 0x0800;
static const int Type_Last = Type_Weapon;
static const int Type_All = 0xffff;
static constexpr int Type_Potion = 0x0001;
static constexpr int Type_Apparatus = 0x0002;
static constexpr int Type_Armor = 0x0004;
static constexpr int Type_Book = 0x0008;
static constexpr int Type_Clothing = 0x0010;
static constexpr int Type_Ingredient = 0x0020;
static constexpr int Type_Light = 0x0040;
static constexpr int Type_Lockpick = 0x0080;
static constexpr int Type_Miscellaneous = 0x0100;
static constexpr int Type_Probe = 0x0200;
static constexpr int Type_Repair = 0x0400;
static constexpr int Type_Weapon = 0x0800;
static constexpr int Type_Last = Type_Weapon;
static constexpr int Type_All = 0xffff;
static const std::string sGoldId;
@ -265,13 +265,13 @@ namespace MWWorld
template<class From, class To, class Dummy>
struct IsConvertible
{
static const bool value = true;
static constexpr bool value = true;
};
template<class Dummy>
struct IsConvertible<ConstPtr, Ptr, Dummy>
{
static const bool value = false;
static constexpr bool value = false;
};
template<class T, class U>

@ -42,29 +42,29 @@ namespace MWWorld
{
public:
static const int Slot_Helmet = 0;
static const int Slot_Cuirass = 1;
static const int Slot_Greaves = 2;
static const int Slot_LeftPauldron = 3;
static const int Slot_RightPauldron = 4;
static const int Slot_LeftGauntlet = 5;
static const int Slot_RightGauntlet = 6;
static const int Slot_Boots = 7;
static const int Slot_Shirt = 8;
static const int Slot_Pants = 9;
static const int Slot_Skirt = 10;
static const int Slot_Robe = 11;
static const int Slot_LeftRing = 12;
static const int Slot_RightRing = 13;
static const int Slot_Amulet = 14;
static const int Slot_Belt = 15;
static const int Slot_CarriedRight = 16;
static const int Slot_CarriedLeft = 17;
static const int Slot_Ammunition = 18;
static const int Slots = 19;
static const int Slot_NoSlot = -1;
static constexpr int Slot_Helmet = 0;
static constexpr int Slot_Cuirass = 1;
static constexpr int Slot_Greaves = 2;
static constexpr int Slot_LeftPauldron = 3;
static constexpr int Slot_RightPauldron = 4;
static constexpr int Slot_LeftGauntlet = 5;
static constexpr int Slot_RightGauntlet = 6;
static constexpr int Slot_Boots = 7;
static constexpr int Slot_Shirt = 8;
static constexpr int Slot_Pants = 9;
static constexpr int Slot_Skirt = 10;
static constexpr int Slot_Robe = 11;
static constexpr int Slot_LeftRing = 12;
static constexpr int Slot_RightRing = 13;
static constexpr int Slot_Amulet = 14;
static constexpr int Slot_Belt = 15;
static constexpr int Slot_CarriedRight = 16;
static constexpr int Slot_CarriedLeft = 17;
static constexpr int Slot_Ammunition = 18;
static constexpr int Slots = 19;
static constexpr int Slot_NoSlot = -1;
private:

Loading…
Cancel
Save