mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 06:15:32 +00:00
Fix skills and attributes being possible to add to irrelevant effects. Should resolve bug #2980.
This commit is contained in:
parent
9f0e059a15
commit
1a64b40725
2 changed files with 56 additions and 4 deletions
|
@ -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…
Reference in a new issue