mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Convert magic effects ID and Range columns in the nested tables to use enum delegate
This commit is contained in:
parent
befd6fe658
commit
e00d7f72ac
7 changed files with 69 additions and 38 deletions
|
@ -76,6 +76,8 @@ bool CSMWorld::ColumnBase::isId (Display display)
|
||||||
|
|
||||||
Display_Id,
|
Display_Id,
|
||||||
Display_SkillImpact,
|
Display_SkillImpact,
|
||||||
|
Display_EffectRange,
|
||||||
|
Display_EffectId,
|
||||||
|
|
||||||
Display_None
|
Display_None
|
||||||
};
|
};
|
||||||
|
|
|
@ -110,6 +110,8 @@ namespace CSMWorld
|
||||||
Display_School,
|
Display_School,
|
||||||
Display_Id,
|
Display_Id,
|
||||||
Display_SkillImpact,
|
Display_SkillImpact,
|
||||||
|
Display_EffectRange,
|
||||||
|
Display_EffectId,
|
||||||
|
|
||||||
//top level columns that nest other columns
|
//top level columns that nest other columns
|
||||||
Display_NestedHeader
|
Display_NestedHeader
|
||||||
|
|
|
@ -332,6 +332,7 @@ namespace
|
||||||
"Combat", "Magic", "Stealth", 0
|
"Combat", "Magic", "Stealth", 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// see ESM::Attribute::AttributeID in <component/esm/attr.hpp>
|
||||||
static const char *sAttributes[] =
|
static const char *sAttributes[] =
|
||||||
{
|
{
|
||||||
"Strength", "Intelligence", "Willpower", "Agility", "Speed", "Endurance", "Personality",
|
"Strength", "Intelligence", "Willpower", "Agility", "Speed", "Endurance", "Personality",
|
||||||
|
@ -424,7 +425,7 @@ namespace
|
||||||
"Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration", 0
|
"Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration", 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// impact from magic effects
|
// impact from magic effects, see ESM::Skill::SkillEnum in <component/esm/loadskil.hpp>
|
||||||
static const char *sSkills[] =
|
static const char *sSkills[] =
|
||||||
{
|
{
|
||||||
"Block", "Armorer", "MediumArmor", "HeavyArmor", "BluntWeapon",
|
"Block", "Armorer", "MediumArmor", "HeavyArmor", "BluntWeapon",
|
||||||
|
@ -435,6 +436,46 @@ namespace
|
||||||
"Speechcraft", "HandToHand", 0
|
"Speechcraft", "HandToHand", 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// range of magic effects, see ESM::RangeType in <component/esm/defs.hpp>
|
||||||
|
static const char *sEffectRange[] =
|
||||||
|
{
|
||||||
|
"Self", "Touch", "Target", 0
|
||||||
|
};
|
||||||
|
|
||||||
|
// magic effect names, see ESM::MagicEffect::Effects in <component/esm/loadmgef.hpp>
|
||||||
|
static const char *sEffectId[] =
|
||||||
|
{
|
||||||
|
"WaterBreathing", "SwiftSwim", "WaterWalking", "Shield", "FireShield",
|
||||||
|
"LightningShield", "FrostShield", "Burden", "Feather", "Jump",
|
||||||
|
"Levitate", "SlowFall", "Lock", "Open", "FireDamage",
|
||||||
|
"ShockDamage", "FrostDamage", "DrainAttribute", "DrainHealth", "DrainMagicka",
|
||||||
|
"DrainFatigue", "DrainSkill", "DamageAttribute", "DamageHealth", "DamageMagicka",
|
||||||
|
"DamageFatigue", "DamageSkill", "Poison", "WeaknessToFire", "WeaknessToFrost",
|
||||||
|
"WeaknessToShock", "WeaknessToMagicka", "WeaknessToCommonDisease", "WeaknessToBlightDisease", "WeaknessToCorprusDisease",
|
||||||
|
"WeaknessToPoison", "WeaknessToNormalWeapons", "DisintegrateWeapon", "DisintegrateArmor", "Invisibility",
|
||||||
|
"Chameleon", "Light", "Sanctuary", "NightEye", "Charm",
|
||||||
|
"Paralyze", "Silence", "Blind", "Sound", "CalmHumanoid",
|
||||||
|
"CalmCreature", "FrenzyHumanoid", "FrenzyCreature", "DemoralizeHumanoid", "DemoralizeCreature",
|
||||||
|
"RallyHumanoid", "RallyCreature", "Dispel", "Soultrap", "Telekinesis",
|
||||||
|
"Mark", "Recall", "DivineIntervention", "AlmsiviIntervention", "DetectAnimal",
|
||||||
|
"DetectEnchantment", "DetectKey", "SpellAbsorption", "Reflect", "CureCommonDisease",
|
||||||
|
"CureBlightDisease", "CureCorprusDisease", "CurePoison", "CureParalyzation", "RestoreAttribute",
|
||||||
|
"RestoreHealth", "RestoreMagicka", "RestoreFatigue", "RestoreSkill", "FortifyAttribute",
|
||||||
|
"FortifyHealth", "FortifyMagicka", "FortifyFatigue", "FortifySkill", "FortifyMaximumMagicka",
|
||||||
|
"AbsorbAttribute", "AbsorbHealth", "AbsorbMagicka", "AbsorbFatigue", "AbsorbSkill",
|
||||||
|
"ResistFire", "ResistFrost", "ResistShock", "ResistMagicka", "ResistCommonDisease",
|
||||||
|
"ResistBlightDisease", "ResistCorprusDisease", "ResistPoison", "ResistNormalWeapons", "ResistParalysis",
|
||||||
|
"RemoveCurse", "TurnUndead", "SummonScamp", "SummonClannfear", "SummonDaedroth",
|
||||||
|
"SummonDremora", "SummonAncestralGhost", "SummonSkeletalMinion", "SummonBonewalker", "SummonGreaterBonewalker",
|
||||||
|
"SummonBonelord", "SummonWingedTwilight", "SummonHunger", "SummonGoldenSaint", "SummonFlameAtronach",
|
||||||
|
"SummonFrostAtronach", "SummonStormAtronach", "FortifyAttack", "CommandCreature", "CommandHumanoid",
|
||||||
|
"BoundDagger", "BoundLongsword", "BoundMace", "BoundBattleAxe", "BoundSpear",
|
||||||
|
"BoundLongbow", "ExtraSpell", "BoundCuirass", "BoundHelm", "BoundBoots",
|
||||||
|
"BoundShield", "BoundGloves", "Corprus", "Vampirism", "SummonCenturionSphere",
|
||||||
|
"SunDamage", "StuntedMagicka", "SummonFabricant", "SummonWolf", "SummonBear",
|
||||||
|
"SummonBonewolf", "SummonCreature04", "SummonCreature05", 0
|
||||||
|
};
|
||||||
|
|
||||||
const char **getEnumNames (CSMWorld::Columns::ColumnId column)
|
const char **getEnumNames (CSMWorld::Columns::ColumnId column)
|
||||||
{
|
{
|
||||||
switch (column)
|
switch (column)
|
||||||
|
@ -458,6 +499,8 @@ namespace
|
||||||
case CSMWorld::Columns::ColumnId_SoundGeneratorType: return sSoundGeneratorType;
|
case CSMWorld::Columns::ColumnId_SoundGeneratorType: return sSoundGeneratorType;
|
||||||
case CSMWorld::Columns::ColumnId_School: return sSchools;
|
case CSMWorld::Columns::ColumnId_School: return sSchools;
|
||||||
case CSMWorld::Columns::ColumnId_SkillImpact: return sSkills;
|
case CSMWorld::Columns::ColumnId_SkillImpact: return sSkills;
|
||||||
|
case CSMWorld::Columns::ColumnId_EffectRange: return sEffectRange;
|
||||||
|
case CSMWorld::Columns::ColumnId_EffectId: return sEffectId;
|
||||||
|
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,13 +193,13 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
index = mSpells.getColumns()-1;
|
index = mSpells.getColumns()-1;
|
||||||
mSpells.addAdapter (std::make_pair(&mSpells.getColumn(index), new EffectsListAdapter<ESM::Spell> ()));
|
mSpells.addAdapter (std::make_pair(&mSpells.getColumn(index), new EffectsListAdapter<ESM::Spell> ()));
|
||||||
mSpells.getNestableColumn(index)->addColumn(
|
mSpells.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_String/*, false*/)); // false means no edit
|
new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_EffectId)); // false means no edit
|
||||||
mSpells.getNestableColumn(index)->addColumn(
|
mSpells.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_SkillImpact, ColumnBase::Display_SkillImpact));
|
new NestedChildColumn (Columns::ColumnId_SkillImpact, ColumnBase::Display_SkillImpact));
|
||||||
mSpells.getNestableColumn(index)->addColumn(
|
mSpells.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
|
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
|
||||||
mSpells.getNestableColumn(index)->addColumn(
|
mSpells.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_Integer));
|
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_EffectRange));
|
||||||
mSpells.getNestableColumn(index)->addColumn(
|
mSpells.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectArea, ColumnBase::Display_String));
|
new NestedChildColumn (Columns::ColumnId_EffectArea, ColumnBase::Display_String));
|
||||||
mSpells.getNestableColumn(index)->addColumn(
|
mSpells.getNestableColumn(index)->addColumn(
|
||||||
|
@ -267,13 +267,13 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
mEnchantments.addAdapter (std::make_pair(&mEnchantments.getColumn(index),
|
mEnchantments.addAdapter (std::make_pair(&mEnchantments.getColumn(index),
|
||||||
new EffectsListAdapter<ESM::Enchantment> ()));
|
new EffectsListAdapter<ESM::Enchantment> ()));
|
||||||
mEnchantments.getNestableColumn(index)->addColumn(
|
mEnchantments.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_String/*, false*/));
|
new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_EffectId));
|
||||||
mEnchantments.getNestableColumn(index)->addColumn(
|
mEnchantments.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_SkillImpact, ColumnBase::Display_SkillImpact));
|
new NestedChildColumn (Columns::ColumnId_SkillImpact, ColumnBase::Display_SkillImpact));
|
||||||
mEnchantments.getNestableColumn(index)->addColumn(
|
mEnchantments.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
|
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
|
||||||
mEnchantments.getNestableColumn(index)->addColumn(
|
mEnchantments.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_Integer));
|
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_EffectRange));
|
||||||
mEnchantments.getNestableColumn(index)->addColumn(
|
mEnchantments.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectArea, ColumnBase::Display_String));
|
new NestedChildColumn (Columns::ColumnId_EffectArea, ColumnBase::Display_String));
|
||||||
mEnchantments.getNestableColumn(index)->addColumn(
|
mEnchantments.getNestableColumn(index)->addColumn(
|
||||||
|
|
|
@ -309,28 +309,19 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// indexToId() prepends "#d+" hence not so user friendly
|
if (effect.mEffectID >=0 && effect.mEffectID < ESM::MagicEffect::Length)
|
||||||
QString effectId(ESM::MagicEffect::effectIdToString(effect.mEffectID).c_str());
|
return effect.mRange;
|
||||||
return effectId.remove(0, 7); // 7 == sizeof("sEffect") - 1
|
else
|
||||||
}
|
throw std::runtime_error("Magic effects ID unexpected value");
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
return effect.mSkill;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
return effect.mAttribute;
|
|
||||||
}
|
}
|
||||||
|
case 1: return effect.mSkill;
|
||||||
|
case 2: return effect.mAttribute;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
switch (effect.mRange)
|
if (effect.mRange >=0 && effect.mRange <=2)
|
||||||
{
|
return effect.mRange;
|
||||||
// see ESM::RangeType in <component/esm/defs.hpp>
|
else
|
||||||
case ESM::RT_Self: return QString("Self");
|
throw std::runtime_error("Magic effects range unexpected value");
|
||||||
case ESM::RT_Touch: return QString("Touch");
|
|
||||||
case ESM::RT_Target: return QString("Target");
|
|
||||||
default: return QVariant();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case 4: return effect.mArea;
|
case 4: return effect.mArea;
|
||||||
case 5: return effect.mDuration;
|
case 5: return effect.mDuration;
|
||||||
|
@ -355,8 +346,7 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
effect.mEffectID =
|
effect.mEffectID = static_cast<short>(value.toInt());
|
||||||
ESM::MagicEffect::effectStringToId("sEffect"+value.toString().toStdString());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -371,15 +361,7 @@ namespace CSMWorld
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
std::string effectId = value.toString().toStdString();
|
effect.mRange = value.toInt();
|
||||||
if (effectId == "Self")
|
|
||||||
effect.mRange = ESM::RT_Self;
|
|
||||||
else if (effectId == "Touch")
|
|
||||||
effect.mRange = ESM::RT_Touch;
|
|
||||||
else if (effectId == "Target")
|
|
||||||
effect.mRange = ESM::RT_Target;
|
|
||||||
else
|
|
||||||
return; // leave unchanged
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: effect.mArea = value.toInt(); break;
|
case 4: effect.mArea = value.toInt(); break;
|
||||||
|
|
|
@ -81,13 +81,13 @@ CSMWorld::RefIdCollection::RefIdCollection()
|
||||||
new EffectsRefIdAdapter<ESM::Potion> (UniversalId::Type_Potion)));
|
new EffectsRefIdAdapter<ESM::Potion> (UniversalId::Type_Potion)));
|
||||||
mNestedAdapters.push_back (std::make_pair(&mColumns.back(), effectsMap));
|
mNestedAdapters.push_back (std::make_pair(&mColumns.back(), effectsMap));
|
||||||
mColumns.back().addColumn(
|
mColumns.back().addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_String/*, false*/));
|
new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_EffectId));
|
||||||
mColumns.back().addColumn(
|
mColumns.back().addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_SkillImpact, ColumnBase::Display_SkillImpact));
|
new NestedChildColumn (Columns::ColumnId_SkillImpact, ColumnBase::Display_SkillImpact));
|
||||||
mColumns.back().addColumn(
|
mColumns.back().addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
|
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
|
||||||
mColumns.back().addColumn(
|
mColumns.back().addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_Integer));
|
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_EffectRange));
|
||||||
mColumns.back().addColumn(
|
mColumns.back().addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_EffectArea, ColumnBase::Display_String));
|
new NestedChildColumn (Columns::ColumnId_EffectArea, ColumnBase::Display_String));
|
||||||
mColumns.back().addColumn(
|
mColumns.back().addColumn(
|
||||||
|
|
|
@ -85,7 +85,9 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
||||||
{ CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true },
|
{ CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true },
|
||||||
{ CSMWorld::ColumnBase::Display_SoundGeneratorType, CSMWorld::Columns::ColumnId_SoundGeneratorType, false },
|
{ CSMWorld::ColumnBase::Display_SoundGeneratorType, CSMWorld::Columns::ColumnId_SoundGeneratorType, false },
|
||||||
{ CSMWorld::ColumnBase::Display_School, CSMWorld::Columns::ColumnId_School, true },
|
{ CSMWorld::ColumnBase::Display_School, CSMWorld::Columns::ColumnId_School, true },
|
||||||
{ CSMWorld::ColumnBase::Display_SkillImpact, CSMWorld::Columns::ColumnId_SkillImpact, true }
|
{ CSMWorld::ColumnBase::Display_SkillImpact, CSMWorld::Columns::ColumnId_SkillImpact, true },
|
||||||
|
{ CSMWorld::ColumnBase::Display_EffectRange, CSMWorld::Columns::ColumnId_EffectRange, false },
|
||||||
|
{ CSMWorld::ColumnBase::Display_EffectId, CSMWorld::Columns::ColumnId_EffectId, false }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)
|
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)
|
||||||
|
|
Loading…
Reference in a new issue