added enchantment type column to enchantment table

pull/178/head
Marc Zinnschlag 11 years ago
parent 395c45c88b
commit ab8bee4d1a

@ -89,6 +89,7 @@ namespace CSMWorld
Display_RefRecordType,
Display_DialogueType,
Display_QuestStatusType,
Display_EnchantmentType,
Display_Gender
};

@ -1682,6 +1682,33 @@ namespace CSMWorld
return true;
}
};
template<typename ESXRecordT>
struct EnchantmentTypeColumn : public Column<ESXRecordT>
{
EnchantmentTypeColumn()
: Column<ESXRecordT> (Columns::ColumnId_EnchantmentType, ColumnBase::Display_EnchantmentType)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return static_cast<int> (record.get().mData.mType);
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mData.mType = data.toInt();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
}
#endif

@ -177,6 +177,7 @@ namespace CSMWorld
{ ColumnId_CombatState, "Combat" },
{ ColumnId_MagicState, "Magic" },
{ ColumnId_StealthState, "Stealth" },
{ ColumnId_EnchantmentType, "Enchantment Type" },
{ ColumnId_UseValue1, "Use value 1" },
{ ColumnId_UseValue2, "Use value 2" },
@ -302,6 +303,11 @@ namespace
"Male", "Female", 0
};
static const char *sEnchantmentTypes[] =
{
"Cast Once", "When Strikes", "When Used", "Constant Effect", 0
};
const char **getEnumNames (CSMWorld::Columns::ColumnId column)
{
switch (column)
@ -319,6 +325,7 @@ namespace
case CSMWorld::Columns::ColumnId_DialogueType: return sDialogueTypeEnums;
case CSMWorld::Columns::ColumnId_QuestStatusType: return sQuestStatusTypes;
case CSMWorld::Columns::ColumnId_Gender: return sGenderEnums;
case CSMWorld::Columns::ColumnId_EnchantmentType: return sEnchantmentTypes;
default: return 0;
}

@ -170,6 +170,7 @@ namespace CSMWorld
ColumnId_CombatState = 157,
ColumnId_MagicState = 158,
ColumnId_StealthState = 159,
ColumnId_EnchantmentType = 160,
// Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of use values.

@ -201,6 +201,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding)
mEnchantments.addColumn (new StringIdColumn<ESM::Enchantment>);
mEnchantments.addColumn (new RecordStateColumn<ESM::Enchantment>);
mEnchantments.addColumn (new FixedRecordTypeColumn<ESM::Enchantment> (UniversalId::Type_Enchantment));
mEnchantments.addColumn (new EnchantmentTypeColumn<ESM::Enchantment>);
mEnchantments.addColumn (new CostColumn<ESM::Enchantment>);

@ -78,6 +78,7 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
{ CSMWorld::ColumnBase::Display_WeaponType, CSMWorld::Columns::ColumnId_WeaponType, false },
{ CSMWorld::ColumnBase::Display_DialogueType, CSMWorld::Columns::ColumnId_DialogueType, false },
{ CSMWorld::ColumnBase::Display_QuestStatusType, CSMWorld::Columns::ColumnId_QuestStatusType, false },
{ CSMWorld::ColumnBase::Display_EnchantmentType, CSMWorld::Columns::ColumnId_EnchantmentType, false },
{ CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true }
};

Loading…
Cancel
Save