diff options
author | Evil Eye <malusluminis@hotmail.com> | 2021-12-29 12:34:12 +0000 |
---|---|---|
committer | jvoisin <julien.voisin@dustri.org> | 2021-12-29 12:34:12 +0000 |
commit | 6f870a464be4a3b77706efcf0951510ca05c015e (patch) | |
tree | 8bbe857411234019c5aa3247436cda1ae51243e2 | |
parent | c166341ec07de023b42468edd36941f394cf07bf (diff) |
Replace magic numbers with enums
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | components/esm/loadmgef.cpp | 28 |
2 files changed, 13 insertions, 16 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d239717d0a..02d86f8802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ Bug #6493: Unlocking owned but not locked or unlocked containers is considered a crime Bug #6517: Rotations for KeyframeData in NIFs should be optional Bug #6519: Effects tooltips for ingredients work incorrectly + Bug #6523: Disintegrate Weapon is resisted by Resist Magicka instead of Sanctuary Feature #890: OpenMW-CS: Column filtering Feature #1465: "Reset" argument for AI functions Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record diff --git a/components/esm/loadmgef.cpp b/components/esm/loadmgef.cpp index badbbb2133..7aff249aeb 100644 --- a/components/esm/loadmgef.cpp +++ b/components/esm/loadmgef.cpp @@ -281,14 +281,12 @@ short MagicEffect::getResistanceEffect(short effect) effects[DisintegrateArmor] = Sanctuary; effects[DisintegrateWeapon] = Sanctuary; - for (int i=0; i<5; ++i) - effects[DrainAttribute+i] = ResistMagicka; - for (int i=0; i<5; ++i) - effects[DamageAttribute+i] = ResistMagicka; - for (int i=0; i<5; ++i) - effects[AbsorbAttribute+i] = ResistMagicka; - for (int i=0; i<10; ++i) - effects[WeaknessToFire+i] = ResistMagicka; + for (int i = DrainAttribute; i <= DamageSkill; ++i) + effects[i] = ResistMagicka; + for (int i = AbsorbAttribute; i <= AbsorbSkill; ++i) + effects[i] = ResistMagicka; + for (int i = WeaknessToFire; i <= WeaknessToNormalWeapons; ++i) + effects[i] = ResistMagicka; effects[Burden] = ResistMagicka; effects[Charm] = ResistMagicka; @@ -326,14 +324,12 @@ short MagicEffect::getWeaknessEffect(short effect) static std::map<short, short> effects; if (effects.empty()) { - for (int i=0; i<5; ++i) - effects[DrainAttribute+i] = WeaknessToMagicka; - for (int i=0; i<5; ++i) - effects[DamageAttribute+i] = WeaknessToMagicka; - for (int i=0; i<5; ++i) - effects[AbsorbAttribute+i] = WeaknessToMagicka; - for (int i=0; i<10; ++i) - effects[WeaknessToFire+i] = WeaknessToMagicka; + for (int i = DrainAttribute; i <= DamageSkill; ++i) + effects[i] = WeaknessToMagicka; + for (int i = AbsorbAttribute; i <= AbsorbSkill; ++i) + effects[i] = WeaknessToMagicka; + for (int i = WeaknessToFire; i <= WeaknessToNormalWeapons; ++i) + effects[i] = WeaknessToMagicka; effects[Burden] = WeaknessToMagicka; effects[Charm] = WeaknessToMagicka; |