1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-29 02:40:57 +00:00

- Removed SpellEffectParams equality operator.

- Improved logic for handling skill and attribute association.
This commit is contained in:
Telvanni 4Life 2026-01-21 18:07:08 -05:00
parent 43c9424ebd
commit 7b85802957
4 changed files with 5 additions and 36 deletions

View file

@ -375,12 +375,11 @@ namespace CSMWorld
throw std::runtime_error("index out of range");
ESM::ENAMstruct effect = effectsList[subRowIndex].mData;
bool targetSkill = false, targetAttribute = false;
switch (subColIndex)
{
case 0:
{
bool targetSkill = false, targetAttribute = false;
effect.mEffectID = ESM::MagicEffect::indexToRefId(value.toInt());
int recordIndex = mMagicEffects.searchId(effect.mEffectID);
if (recordIndex != -1)
@ -389,15 +388,10 @@ namespace CSMWorld
targetSkill = mgef.mData.mFlags & ESM::MagicEffect::TargetSkill;
targetAttribute = mgef.mData.mFlags & ESM::MagicEffect::TargetAttribute;
}
if (targetSkill)
effect.mAttribute = -1;
else if (targetAttribute)
effect.mSkill = -1;
else
{
if (!targetSkill)
effect.mSkill = -1;
if (!targetAttribute)
effect.mAttribute = -1;
}
break;
}
case 1:

View file

@ -204,15 +204,10 @@ void CSMWorld::IngredEffectRefIdAdapter::setNestedData(
}
}
if (targetSkill)
ingredient.mData.mAttributes[subRowIndex] = -1;
else if (targetAttribute)
ingredient.mData.mSkills[subRowIndex] = -1;
else
{
if (!targetSkill)
ingredient.mData.mSkills[subRowIndex] = -1;
if (!targetAttribute)
ingredient.mData.mAttributes[subRowIndex] = -1;
}
break;
case 1:
ingredient.mData.mSkills[subRowIndex] = value.toInt();

View file

@ -25,24 +25,6 @@
namespace MWGui::Widgets
{
/* SpellEffectParams */
bool SpellEffectParams::operator==(const SpellEffectParams& other) const
{
if (mEffectID != other.mEffectID)
return false;
if (mEffectID.empty())
return true;
const ESM::MagicEffect* mgef
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(mEffectID);
bool involvesSkill = mgef->mData.mFlags & ESM::MagicEffect::TargetSkill;
bool involvesAttribute = mgef->mData.mFlags & ESM::MagicEffect::TargetAttribute;
return ((other.mSkill == mSkill) || !involvesSkill) && ((other.mAttribute == mAttribute) && !involvesAttribute)
&& (other.mArea == mArea);
}
/* MWSkill */
MWSkill::MWSkill()

View file

@ -63,8 +63,6 @@ namespace MWGui
// value of 0 -> no area effect
int mArea;
bool operator==(const SpellEffectParams& other) const;
};
typedef std::vector<SpellEffectParams> SpellEffectList;