Fix skills and attributes being possible to add to irrelevant effects. Should resolve bug #2980.

openmw-37
cc9cii 9 years ago
parent 9f0e059a15
commit 1a64b40725

@ -317,8 +317,34 @@ namespace CSMWorld
else else
throw std::runtime_error("Magic effects ID unexpected value"); throw std::runtime_error("Magic effects ID unexpected value");
} }
case 1: return effect.mSkill; case 1:
case 2: return effect.mAttribute; {
switch (effect.mEffectID)
{
case ESM::MagicEffect::DrainSkill:
case ESM::MagicEffect::DamageSkill:
case ESM::MagicEffect::RestoreSkill:
case ESM::MagicEffect::FortifySkill:
case ESM::MagicEffect::AbsorbSkill:
return effect.mSkill;
default:
return QVariant();
}
}
case 2:
{
switch (effect.mEffectID)
{
case ESM::MagicEffect::DrainAttribute:
case ESM::MagicEffect::DamageAttribute:
case ESM::MagicEffect::RestoreAttribute:
case ESM::MagicEffect::FortifyAttribute:
case ESM::MagicEffect::AbsorbAttribute:
return effect.mAttribute;
default:
return QVariant();
}
}
case 3: case 3:
{ {
if (effect.mRange >=0 && effect.mRange <=2) if (effect.mRange >=0 && effect.mRange <=2)

@ -139,8 +139,34 @@ QVariant CSMWorld::IngredEffectRefIdAdapter::getNestedData (const RefIdColumn *c
switch (subColIndex) switch (subColIndex)
{ {
case 0: return record.get().mData.mEffectID[subRowIndex]; case 0: return record.get().mData.mEffectID[subRowIndex];
case 1: return record.get().mData.mSkills[subRowIndex]; case 1:
case 2: return record.get().mData.mAttributes[subRowIndex]; {
switch (record.get().mData.mEffectID[subRowIndex])
{
case ESM::MagicEffect::DrainSkill:
case ESM::MagicEffect::DamageSkill:
case ESM::MagicEffect::RestoreSkill:
case ESM::MagicEffect::FortifySkill:
case ESM::MagicEffect::AbsorbSkill:
return record.get().mData.mSkills[subRowIndex];
default:
return QVariant();
}
}
case 2:
{
switch (record.get().mData.mEffectID[subRowIndex])
{
case ESM::MagicEffect::DrainAttribute:
case ESM::MagicEffect::DamageAttribute:
case ESM::MagicEffect::RestoreAttribute:
case ESM::MagicEffect::FortifyAttribute:
case ESM::MagicEffect::AbsorbAttribute:
return record.get().mData.mAttributes[subRowIndex];
default:
return QVariant();
}
}
default: default:
throw std::runtime_error("Trying to access non-existing column in the nested table!"); throw std::runtime_error("Trying to access non-existing column in the nested table!");
} }

Loading…
Cancel
Save