Convert magic effects Attribute column in the nested tables to use enum delegates.

test
cc9cii 10 years ago
parent c41b4b84a6
commit d6c2cff381

@ -197,7 +197,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mSpells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_Skill, ColumnBase::Display_String));
mSpells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_String)); // reuse attribute
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
mSpells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_Integer));
mSpells.getNestableColumn(index)->addColumn(
@ -271,7 +271,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mEnchantments.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_Skill, ColumnBase::Display_String));
mEnchantments.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_String)); // reuse attribute
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
mEnchantments.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_Integer));
mEnchantments.getNestableColumn(index)->addColumn(

@ -354,23 +354,7 @@ namespace CSMWorld
}
case 2:
{
switch (effect.mAttribute)
{
// see ESM::Attribute::AttributeID in <component/esm/attr.hpp>
case ESM::Attribute::Strength:
case ESM::Attribute::Intelligence:
case ESM::Attribute::Willpower:
case ESM::Attribute::Agility:
case ESM::Attribute::Speed:
case ESM::Attribute::Endurance:
case ESM::Attribute::Personality:
case ESM::Attribute::Luck:
{
return QString(ESM::Attribute::sAttributeNames[effect.mAttribute].c_str());
}
case -1: return QString("N/A");
default: return QVariant();
}
return effect.mAttribute;
}
case 3:
{
@ -431,21 +415,7 @@ namespace CSMWorld
}
case 2:
{
std::string attr = value.toString().toStdString();
if ("N/A" == attr)
{
effect.mAttribute = -1;
break;
}
for (unsigned int i = 0; i < ESM::Attribute::Length; ++i)
{
if (ESM::Attribute::sAttributeNames[i] == attr)
{
effect.mAttribute = static_cast<signed char>(i);
break;
}
}
effect.mAttribute = static_cast<signed char>(value.toInt());
break;
}
case 3:

@ -85,7 +85,7 @@ CSMWorld::RefIdCollection::RefIdCollection()
mColumns.back().addColumn(
new NestedChildColumn (Columns::ColumnId_Skill, ColumnBase::Display_String));
mColumns.back().addColumn(
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_String)); // reuse attribute
new NestedChildColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)); // reuse attribute
mColumns.back().addColumn(
new NestedChildColumn (Columns::ColumnId_EffectRange, ColumnBase::Display_Integer));
mColumns.back().addColumn(

Loading…
Cancel
Save