From 7b85802957e47bf30defb48fcec63591f5e00ecd Mon Sep 17 00:00:00 2001 From: Telvanni 4Life Date: Wed, 21 Jan 2026 18:07:08 -0500 Subject: [PATCH] - Removed SpellEffectParams equality operator. - Improved logic for handling skill and attribute association. --- .../opencs/model/world/nestedcoladapterimp.hpp | 12 +++--------- apps/opencs/model/world/refidadapterimp.cpp | 9 ++------- apps/openmw/mwgui/widgets.cpp | 18 ------------------ apps/openmw/mwgui/widgets.hpp | 2 -- 4 files changed, 5 insertions(+), 36 deletions(-) diff --git a/apps/opencs/model/world/nestedcoladapterimp.hpp b/apps/opencs/model/world/nestedcoladapterimp.hpp index 4dff59f53e..2d5247f106 100644 --- a/apps/opencs/model/world/nestedcoladapterimp.hpp +++ b/apps/opencs/model/world/nestedcoladapterimp.hpp @@ -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: diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index e395fe81d8..cd03c9236d 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -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(); diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index 34a56adcc5..a4ca75d21d 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -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().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() diff --git a/apps/openmw/mwgui/widgets.hpp b/apps/openmw/mwgui/widgets.hpp index e63e46ee2b..ffcfa6b207 100644 --- a/apps/openmw/mwgui/widgets.hpp +++ b/apps/openmw/mwgui/widgets.hpp @@ -63,8 +63,6 @@ namespace MWGui // value of 0 -> no area effect int mArea; - - bool operator==(const SpellEffectParams& other) const; }; typedef std::vector SpellEffectList;