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
throw std::runtime_error("Magic effects ID unexpected value");
}
case 1: return effect.mSkill;
case 2: return effect.mAttribute;
case 1:
{
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:
{
if (effect.mRange >=0 && effect.mRange <=2)

@ -139,8 +139,34 @@ QVariant CSMWorld::IngredEffectRefIdAdapter::getNestedData (const RefIdColumn *c
switch (subColIndex)
{
case 0: return record.get().mData.mEffectID[subRowIndex];
case 1: return record.get().mData.mSkills[subRowIndex];
case 2: return record.get().mData.mAttributes[subRowIndex];
case 1:
{
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:
throw std::runtime_error("Trying to access non-existing column in the nested table!");
}

Loading…
Cancel
Save