columns are now identified via an enum instead the name string

actorid
Marc Zinnschlag 12 years ago
parent 3170490a8e
commit 76b9d3dbc1

@ -24,7 +24,7 @@ opencs_units (model/world
opencs_units_noqt (model/world
universalid data record commands columnbase scriptcontext cell refidcollection
refidadapter refiddata refidadapterimp ref collectionbase refcollection
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns
)
opencs_hdrs_noqt (model/world

@ -1,8 +1,10 @@
#include "columnbase.hpp"
CSMWorld::ColumnBase::ColumnBase (const std::string& title, Display displayType, int flags)
: mTitle (title), mDisplayType (displayType), mFlags (flags)
#include "columns.hpp"
CSMWorld::ColumnBase::ColumnBase (int columnId, Display displayType, int flags)
: mColumnId (columnId), mDisplayType (displayType), mFlags (flags)
{}
CSMWorld::ColumnBase::~ColumnBase() {}
@ -10,4 +12,9 @@ CSMWorld::ColumnBase::~ColumnBase() {}
bool CSMWorld::ColumnBase::isUserEditable() const
{
return isEditable();
}
std::string CSMWorld::ColumnBase::getTitle() const
{
return Columns::getName (static_cast<Columns::ColumnId> (mColumnId));
}

@ -46,11 +46,11 @@ namespace CSMWorld
Display_RefRecordType
};
std::string mTitle;
int mColumnId;
int mFlags;
Display mDisplayType;
ColumnBase (const std::string& title, Display displayType, int flag);
ColumnBase (int columnId, Display displayType, int flag);
virtual ~ColumnBase();
@ -59,22 +59,22 @@ namespace CSMWorld
virtual bool isUserEditable() const;
///< Can this column be edited directly by the user?
virtual std::string getTitle() const;
};
template<typename ESXRecordT>
struct Column : public ColumnBase
{
std::string mTitle;
int mFlags;
Column (const std::string& title, Display displayType, int flags = Flag_Table | Flag_Dialogue)
: ColumnBase (title, displayType, flags) {}
Column (int columnId, Display displayType, int flags = Flag_Table | Flag_Dialogue)
: ColumnBase (columnId, displayType, flags) {}
virtual QVariant get (const Record<ESXRecordT>& record) const = 0;
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
throw std::logic_error ("Column " + mTitle + " is not editable");
throw std::logic_error ("Column " + getTitle() + " is not editable");
}
};
}

@ -8,13 +8,15 @@
#include <QColor>
#include "columnbase.hpp"
#include "columns.hpp"
namespace CSMWorld
{
/// \note Shares ID with VarValueColumn. A table can not have both.
template<typename ESXRecordT>
struct FloatValueColumn : public Column<ESXRecordT>
{
FloatValueColumn() : Column<ESXRecordT> ("Value", ColumnBase::Display_Float) {}
FloatValueColumn() : Column<ESXRecordT> (Columns::ColumnId_Value, ColumnBase::Display_Float) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -34,11 +36,12 @@ namespace CSMWorld
}
};
/// \note Shares ID with IdColumn. A table can not have both.
template<typename ESXRecordT>
struct StringIdColumn : public Column<ESXRecordT>
{
StringIdColumn (bool hidden = false)
: Column<ESXRecordT> ("ID", ColumnBase::Display_String,
: Column<ESXRecordT> (Columns::ColumnId_Id, ColumnBase::Display_String,
hidden ? 0 : ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue)
{}
@ -56,7 +59,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct RecordStateColumn : public Column<ESXRecordT>
{
RecordStateColumn() : Column<ESXRecordT> ("*", ColumnBase::Display_RecordState) {}
RecordStateColumn()
: Column<ESXRecordT> (Columns::ColumnId_Modification, ColumnBase::Display_RecordState)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -88,7 +93,9 @@ namespace CSMWorld
int mType;
FixedRecordTypeColumn (int type)
: Column<ESXRecordT> ("Record Type", ColumnBase::Display_Integer, 0), mType (type) {}
: Column<ESXRecordT> (Columns::ColumnId_RecordType, ColumnBase::Display_Integer, 0),
mType (type)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -105,7 +112,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct VarTypeColumn : public Column<ESXRecordT>
{
VarTypeColumn (ColumnBase::Display display) : Column<ESXRecordT> ("Type", display) {}
VarTypeColumn (ColumnBase::Display display)
: Column<ESXRecordT> (Columns::ColumnId_ValueType, display)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -125,10 +134,11 @@ namespace CSMWorld
}
};
/// \note Shares ID with FloatValueColumn. A table can not have both.
template<typename ESXRecordT>
struct VarValueColumn : public Column<ESXRecordT>
{
VarValueColumn() : Column<ESXRecordT> ("Value", ColumnBase::Display_Var) {}
VarValueColumn() : Column<ESXRecordT> (Columns::ColumnId_Value, ColumnBase::Display_Var) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -190,7 +200,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct DescriptionColumn : public Column<ESXRecordT>
{
DescriptionColumn() : Column<ESXRecordT> ("Description", ColumnBase::Display_String) {}
DescriptionColumn()
: Column<ESXRecordT> (Columns::ColumnId_Description, ColumnBase::Display_String)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -215,7 +227,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct SpecialisationColumn : public Column<ESXRecordT>
{
SpecialisationColumn() : Column<ESXRecordT> ("Specialisation", ColumnBase::Display_Specialisation) {}
SpecialisationColumn()
: Column<ESXRecordT> (Columns::ColumnId_Specialisation, ColumnBase::Display_Specialisation)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -243,8 +257,8 @@ namespace CSMWorld
int mIndex;
UseValueColumn (int index)
: Column<ESXRecordT> ("Use value #" + boost::lexical_cast<std::string> (index),
ColumnBase::Display_Float), mIndex (index)
: Column<ESXRecordT> (Columns::ColumnId_UseValue1 + index - 1, ColumnBase::Display_Float),
mIndex (index)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
@ -270,7 +284,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct AttributeColumn : public Column<ESXRecordT>
{
AttributeColumn() : Column<ESXRecordT> ("Attribute", ColumnBase::Display_Attribute) {}
AttributeColumn()
: Column<ESXRecordT> (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -295,7 +311,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct NameColumn : public Column<ESXRecordT>
{
NameColumn() : Column<ESXRecordT> ("Name", ColumnBase::Display_String) {}
NameColumn() : Column<ESXRecordT> (Columns::ColumnId_Name, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -323,8 +339,9 @@ namespace CSMWorld
int mIndex;
AttributesColumn (int index)
: Column<ESXRecordT> ("Attribute #" + boost::lexical_cast<std::string> (index),
ColumnBase::Display_Attribute), mIndex (index) {}
: Column<ESXRecordT> (Columns::ColumnId_Attribute1 + index - 1, ColumnBase::Display_Attribute),
mIndex (index)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -353,8 +370,9 @@ namespace CSMWorld
bool mMajor;
SkillsColumn (int index, bool typePrefix = false, bool major = false)
: Column<ESXRecordT> ((typePrefix ? (major ? "Major Skill #" : "Minor Skill #") : "Skill #")+
boost::lexical_cast<std::string> (index), ColumnBase::Display_String),
: Column<ESXRecordT> ((typePrefix ? (
major ? Columns::ColumnId_MajorSkill1 : Columns::ColumnId_MinorSkill1) :
Columns::ColumnId_Skill1) + index - 1, ColumnBase::Display_String),
mIndex (index), mMajor (major)
{}
@ -393,7 +411,8 @@ namespace CSMWorld
template<typename ESXRecordT>
struct PlayableColumn : public Column<ESXRecordT>
{
PlayableColumn() : Column<ESXRecordT> ("Playable", ColumnBase::Display_Boolean) {}
PlayableColumn() : Column<ESXRecordT> (Columns::ColumnId_Playable, ColumnBase::Display_Boolean)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -418,7 +437,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct HiddenColumn : public Column<ESXRecordT>
{
HiddenColumn() : Column<ESXRecordT> ("Hidden", ColumnBase::Display_Boolean) {}
HiddenColumn() : Column<ESXRecordT> (Columns::ColumnId_Hidden, ColumnBase::Display_Boolean) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -445,8 +464,8 @@ namespace CSMWorld
{
int mMask;
FlagColumn (const std::string& name, int mask)
: Column<ESXRecordT> (name, ColumnBase::Display_Boolean), mMask (mask)
FlagColumn (int columnId, int mask)
: Column<ESXRecordT> (columnId, ColumnBase::Display_Boolean), mMask (mask)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
@ -481,8 +500,10 @@ namespace CSMWorld
bool mWeight;
WeightHeightColumn (bool male, bool weight)
: Column<ESXRecordT> (male ? (weight ? "Male Weight" : "Male Height") :
(weight ? "Female Weight" : "Female Height"), ColumnBase::Display_Float),
: Column<ESXRecordT> (male ?
(weight ? Columns::ColumnId_MaleWeight : Columns::ColumnId_MaleHeight) :
(weight ? Columns::ColumnId_FemaleWeight : Columns::ColumnId_FemaleHeight),
ColumnBase::Display_Float),
mMale (male), mWeight (weight)
{}
@ -525,9 +546,9 @@ namespace CSMWorld
Type mType;
SoundParamColumn (Type type)
: Column<ESXRecordT> (
type==Type_Volume ? "Volume" : (type==Type_MinRange ? "Min Range" : "Max Range"),
ColumnBase::Display_Integer),
: Column<ESXRecordT> (type==Type_Volume ? Columns::ColumnId_Volume :
(type==Type_MinRange ? Columns::ColumnId_MinRange : Columns::ColumnId_MaxRange),
ColumnBase::Display_Integer),
mType (type)
{}
@ -575,7 +596,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct SoundFileColumn : public Column<ESXRecordT>
{
SoundFileColumn() : Column<ESXRecordT> ("Sound File", ColumnBase::Display_String) {}
SoundFileColumn()
: Column<ESXRecordT> (Columns::ColumnId_SoundFile, ColumnBase::Display_String)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -603,7 +626,9 @@ namespace CSMWorld
struct MapColourColumn : public Column<ESXRecordT>
{
/// \todo Replace Display_Integer with something that displays the colour value more directly.
MapColourColumn() : Column<ESXRecordT> ("Map Colour", ColumnBase::Display_Integer) {}
MapColourColumn()
: Column<ESXRecordT> (Columns::ColumnId_MapColour, ColumnBase::Display_Integer)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -632,7 +657,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct SleepListColumn : public Column<ESXRecordT>
{
SleepListColumn() : Column<ESXRecordT> ("Sleep Encounter", ColumnBase::Display_String) {}
SleepListColumn()
: Column<ESXRecordT> (Columns::ColumnId_SleepEncounter, ColumnBase::Display_String)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -657,7 +684,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct TextureColumn : public Column<ESXRecordT>
{
TextureColumn() : Column<ESXRecordT> ("Texture", ColumnBase::Display_String) {}
TextureColumn() : Column<ESXRecordT> (Columns::ColumnId_Texture, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -682,7 +709,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct SpellTypeColumn : public Column<ESXRecordT>
{
SpellTypeColumn() : Column<ESXRecordT> ("Type", ColumnBase::Display_SpellType) {}
SpellTypeColumn()
: Column<ESXRecordT> (Columns::ColumnId_SpellType, ColumnBase::Display_SpellType)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -707,7 +736,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct CostColumn : public Column<ESXRecordT>
{
CostColumn() : Column<ESXRecordT> ("Cost", ColumnBase::Display_Integer) {}
CostColumn() : Column<ESXRecordT> (Columns::ColumnId_Cost, ColumnBase::Display_Integer) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -730,7 +759,8 @@ namespace CSMWorld
template<typename ESXRecordT>
struct ScriptColumn : public Column<ESXRecordT>
{
ScriptColumn() : Column<ESXRecordT> ("Script", ColumnBase::Display_Script, 0) {}
ScriptColumn()
: Column<ESXRecordT> (Columns::ColumnId_ScriptText, ColumnBase::Display_Script, 0) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -755,7 +785,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct RegionColumn : public Column<ESXRecordT>
{
RegionColumn() : Column<ESXRecordT> ("Region", ColumnBase::Display_String) {}
RegionColumn() : Column<ESXRecordT> (Columns::ColumnId_Region, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -780,7 +810,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct CellColumn : public Column<ESXRecordT>
{
CellColumn() : Column<ESXRecordT> ("Cell", ColumnBase::Display_String) {}
CellColumn() : Column<ESXRecordT> (Columns::ColumnId_Cell, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -807,10 +837,11 @@ namespace CSMWorld
}
};
/// \note Shares ID with StringIdColumn. A table can not have both.
template<typename ESXRecordT>
struct IdColumn : public Column<ESXRecordT>
{
IdColumn() : Column<ESXRecordT> ("ID", ColumnBase::Display_String) {}
IdColumn() : Column<ESXRecordT> (Columns::ColumnId_Id, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -835,7 +866,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct ScaleColumn : public Column<ESXRecordT>
{
ScaleColumn() : Column<ESXRecordT> ("Scale", ColumnBase::Display_Float) {}
ScaleColumn() : Column<ESXRecordT> (Columns::ColumnId_Scale, ColumnBase::Display_Float) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -858,7 +889,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct OwnerColumn : public Column<ESXRecordT>
{
OwnerColumn() : Column<ESXRecordT> ("Owner", ColumnBase::Display_String) {}
OwnerColumn() : Column<ESXRecordT> (Columns::ColumnId_Owner, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -883,7 +914,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct SoulColumn : public Column<ESXRecordT>
{
SoulColumn() : Column<ESXRecordT> ("Soul", ColumnBase::Display_String) {}
SoulColumn() : Column<ESXRecordT> (Columns::ColumnId_Soul, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -908,7 +939,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct FactionColumn : public Column<ESXRecordT>
{
FactionColumn() : Column<ESXRecordT> ("Faction", ColumnBase::Display_String) {}
FactionColumn() : Column<ESXRecordT> (Columns::ColumnId_Faction, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -933,7 +964,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct FactionIndexColumn : public Column<ESXRecordT>
{
FactionIndexColumn() : Column<ESXRecordT> ("Faction Index", ColumnBase::Display_Integer) {}
FactionIndexColumn()
: Column<ESXRecordT> (Columns::ColumnId_FactionIndex, ColumnBase::Display_Integer)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -956,7 +989,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct ChargesColumn : public Column<ESXRecordT>
{
ChargesColumn() : Column<ESXRecordT> ("Charges", ColumnBase::Display_Integer) {}
ChargesColumn() : Column<ESXRecordT> (Columns::ColumnId_Charges, ColumnBase::Display_Integer) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -979,7 +1012,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct EnchantmentChargesColumn : public Column<ESXRecordT>
{
EnchantmentChargesColumn() : Column<ESXRecordT> ("Entchantment", ColumnBase::Display_Float) {}
EnchantmentChargesColumn()
: Column<ESXRecordT> (Columns::ColumnId_Enchantment, ColumnBase::Display_Float)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -1002,7 +1037,8 @@ namespace CSMWorld
template<typename ESXRecordT>
struct GoldValueColumn : public Column<ESXRecordT>
{
GoldValueColumn() : Column<ESXRecordT> ("Value", ColumnBase::Display_Integer) {}
GoldValueColumn()
: Column<ESXRecordT> (Columns::ColumnId_CoinValue, ColumnBase::Display_Integer) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -1025,7 +1061,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct TeleportColumn : public Column<ESXRecordT>
{
TeleportColumn() : Column<ESXRecordT> ("Teleport", ColumnBase::Display_Boolean) {}
TeleportColumn()
: Column<ESXRecordT> (Columns::ColumnId_Teleport, ColumnBase::Display_Boolean)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -1050,7 +1088,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct TeleportCellColumn : public Column<ESXRecordT>
{
TeleportCellColumn() : Column<ESXRecordT> ("Teleport Cell", ColumnBase::Display_String) {}
TeleportCellColumn()
: Column<ESXRecordT> (Columns::ColumnId_TeleportCell, ColumnBase::Display_String)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -1080,7 +1120,9 @@ namespace CSMWorld
template<typename ESXRecordT>
struct LockLevelColumn : public Column<ESXRecordT>
{
LockLevelColumn() : Column<ESXRecordT> ("Lock Level", ColumnBase::Display_Integer) {}
LockLevelColumn()
: Column<ESXRecordT> (Columns::ColumnId_LockLevel, ColumnBase::Display_Integer)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -1103,7 +1145,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct KeyColumn : public Column<ESXRecordT>
{
KeyColumn() : Column<ESXRecordT> ("Key", ColumnBase::Display_String) {}
KeyColumn() : Column<ESXRecordT> (Columns::ColumnId_Key, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
@ -1128,7 +1170,7 @@ namespace CSMWorld
template<typename ESXRecordT>
struct TrapColumn : public Column<ESXRecordT>
{
TrapColumn() : Column<ESXRecordT> ("Trap", ColumnBase::Display_String) {}
TrapColumn() : Column<ESXRecordT> (Columns::ColumnId_Trap, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{

@ -0,0 +1,197 @@
#include "columns.hpp"
#include <components/misc/stringops.hpp>
namespace CSMWorld
{
namespace Columns
{
struct ColumnDesc
{
int mId;
const char *mName;
};
const ColumnDesc sNames[] =
{
{ ColumnId_Value, "Value" },
{ ColumnId_Id, "ID" },
{ ColumnId_Modification, "Modified" },
{ ColumnId_RecordType, "Record Type" },
{ ColumnId_ValueType, "Value Type" },
{ ColumnId_Description, "Description" },
{ ColumnId_Specialisation, "Specialisation" },
{ ColumnId_Attribute, "Attribute" },
{ ColumnId_Name, "Name" },
{ ColumnId_Playable, "Playable" },
{ ColumnId_Hidden, "Hidden" },
{ ColumnId_MaleWeight, "Male Weight" },
{ ColumnId_FemaleWeight, "Female Weight" },
{ ColumnId_MaleHeight, "Male Height" },
{ ColumnId_FemaleHeight, "Female Height" },
{ ColumnId_Volume, "Volume" },
{ ColumnId_MinRange, "Min Range" },
{ ColumnId_MaxRange, "Max Range" },
{ ColumnId_SoundFile, "Sound File" },
{ ColumnId_MapColour, "Map Colour" },
{ ColumnId_SleepEncounter, "Sleep Encounter" },
{ ColumnId_Texture, "Texture" },
{ ColumnId_SpellType, "Spell Type" },
{ ColumnId_Cost, "Cost" },
{ ColumnId_ScriptText, "Script Text" },
{ ColumnId_Region, "Region" },
{ ColumnId_Cell, "Cell" },
{ ColumnId_Scale, "Scale" },
{ ColumnId_Owner, "Owner" },
{ ColumnId_Soul, "Soul" },
{ ColumnId_Faction, "Faction" },
{ ColumnId_FactionIndex, "Faction Index" },
{ ColumnId_Charges, "Charges" },
{ ColumnId_Enchantment, "Enchantment" },
{ ColumnId_Value, "Coin Value" },
{ ColumnId_Teleport, "Teleport" },
{ ColumnId_TeleportCell, "Teleport Cell" },
{ ColumnId_LockLevel, "Lock Level" },
{ ColumnId_Key, "Key" },
{ ColumnId_Trap, "Trap" },
{ ColumnId_BeastRace, "Beast Race" },
{ ColumnId_AutoCalc, "Auto Calc" },
{ ColumnId_StarterSpell, "Starter Spell" },
{ ColumnId_AlwaysSucceeds, "Always Succeeds" },
{ ColumnId_SleepForbidden, "Sleep Forbidden" },
{ ColumnId_InteriorWater, "Interior Water" },
{ ColumnId_InteriorSky, "Interior Sky" },
{ ColumnId_Model, "Model" },
{ ColumnId_Script, "Script" },
{ ColumnId_Icon, "Icon" },
{ ColumnId_Weight, "Weight" },
{ ColumnId_EnchantmentPoints, "Enchantment Points" },
{ ColumnId_Quality, "Quality" },
{ ColumnId_Ai, "AI" },
{ ColumnId_AiHello, "AI Hello" },
{ ColumnId_AiFlee, "AI Flee" },
{ ColumnId_AiFight, "AI Fight" },
{ ColumnId_AiAlarm, "AI Alarm" },
{ ColumnId_BuysWeapons, "Buys Weapons" },
{ ColumnId_BuysArmor, "Buys Armor" },
{ ColumnId_BuysClothing, "Buys Clothing" },
{ ColumnId_BuysBooks, "Buys Books" },
{ ColumnId_BuysIngredients, "Buys Ingredients" },
{ ColumnId_BuysLockpicks, "Buys Lockpicks" },
{ ColumnId_BuysProbes, "Buys Probes" },
{ ColumnId_BuysLights, "Buys Lights" },
{ ColumnId_BuysApparati, "Buys Apparati" },
{ ColumnId_BuysRepairItems, "Buys Repair Items" },
{ ColumnId_BuysMiscItems, "Buys Misc Items" },
{ ColumnId_BuysPotions, "Buys Potions" },
{ ColumnId_BuysMagicItems, "Buys Magic Items" },
{ ColumnId_SellsSpells, "Sells Spells" },
{ ColumnId_Trainer, "Trainer" },
{ ColumnId_Spellmaking, "Spellmaking" },
{ ColumnId_EnchantingService, "Enchanting Service" },
{ ColumnId_RepairService, "Repair Serivce" },
{ ColumnId_ApparatusType, "Apparatus Type" },
{ ColumnId_ArmorType, "Armor Type" },
{ ColumnId_Health, "Health" },
{ ColumnId_ArmorValue, "Armor Value" },
{ ColumnId_Scroll, "Scroll" },
{ ColumnId_ClothingType, "Clothing Type" },
{ ColumnId_WeightCapacity, "Weight Capacity" },
{ ColumnId_OrganicContainer, "Organic Container" },
{ ColumnId_Respawn, "Respawn" },
{ ColumnId_CreatureType, "Creature Type" },
{ ColumnId_SoulPoints, "Soul Points" },
{ ColumnId_OriginalCreature, "Original Creature" },
{ ColumnId_Biped, "Biped" },
{ ColumnId_HasWeapon, "Has Weapon" },
{ ColumnId_NoMovement, "No Movement" },
{ ColumnId_Swims, "Swims" },
{ ColumnId_Flies, "Flies" },
{ ColumnId_Walks, "Walks" },
{ ColumnId_Essential, "Essential" },
{ ColumnId_SkeletonBlood, "Skeleton Blood" },
{ ColumnId_MetalBlood, "Metal Blood" },
{ ColumnId_OpenSound, "Open Sound" },
{ ColumnId_CloseSound, "Close Sound" },
{ ColumnId_Duration, "Duration" },
{ ColumnId_Radius, "Radius" },
{ ColumnId_Colour, "Colour" },
{ ColumnId_Sound, "Sound" },
{ ColumnId_Dynamic, "Dynamic" },
{ ColumnId_Portable, "Portable" },
{ ColumnId_NegativeLight, "Negative Light" },
{ ColumnId_Flickering, "Flickering" },
{ ColumnId_SlowFlickering, "Slow Flickering" },
{ ColumnId_Pulsing, "Pulsing" },
{ ColumnId_SlowPulsing, "Slow Pulsing" },
{ ColumnId_Fire, "Fire" },
{ ColumnId_OffByDefault, "Off by default" },
{ ColumnId_IsKey, "Is Key" },
{ ColumnId_Race, "Race" },
{ ColumnId_Class, "Class" },
{ Columnid_Hair, "Hair" },
{ ColumnId_Head, "Head" },
{ ColumnId_Female, "Female" },
{ ColumnId_WeaponType, "Weapon Type" },
{ ColumnId_WeaponSpeed, "Weapon Speed" },
{ ColumnId_WeaponReach, "Weapon Reach" },
{ ColumnId_MinChop, "Min Chop" },
{ ColumnId_MaxChip, "Max Chop" },
{ Columnid_MinSlash, "Min Slash" },
{ ColumnId_MaxSlash, "Max Slash" },
{ ColumnId_MinThrust, "Min Thrust" },
{ ColumnId_MaxThrust, "Max Thrust" },
{ ColumnId_Magical, "Magical" },
{ ColumnId_Silver, "Silver" },
{ ColumnId_UseValue1, "Use value 1" },
{ ColumnId_UseValue2, "Use value 2" },
{ ColumnId_UseValue3, "Use value 3" },
{ ColumnId_UseValue4, "Use value 4" },
{ ColumnId_Attribute1, "Attribute 1" },
{ ColumnId_Attribute2, "Attribute 2" },
{ ColumnId_MajorSkill1, "Major Skill 1" },
{ ColumnId_MajorSkill2, "Major Skill 2" },
{ ColumnId_MajorSkill3, "Major Skill 3" },
{ ColumnId_MajorSkill4, "Major Skill 4" },
{ ColumnId_MajorSkill5, "Major Skill 5" },
{ ColumnId_MinorSkill1, "Minor Skill 1" },
{ ColumnId_MinorSkill2, "Minor Skill 2" },
{ ColumnId_MinorSkill3, "Minor Skill 3" },
{ ColumnId_MinorSkill4, "Minor Skill 4" },
{ ColumnId_MinorSkill5, "Minor Skill 5" },
{ ColumnId_Skill1, "Skill 1" },
{ ColumnId_Skill1, "Skill 2" },
{ ColumnId_Skill1, "Skill 3" },
{ ColumnId_Skill1, "Skill 4" },
{ ColumnId_Skill1, "Skill 5" },
{ -1, 0 } // end marker
};
}
}
std::string CSMWorld::Columns::getName (ColumnId column)
{
for (int i=0; sNames[i].mName; ++i)
if (column==sNames[i].mId)
return sNames[i].mName;
return "";
}
int CSMWorld::Columns::getId (const std::string& name)
{
std::string name2 = Misc::StringUtils::lowerCase (name);
for (int i=0; sNames[i].mName; ++i)
if (name2==Misc::StringUtils::lowerCase (sNames[i].mName))
return sNames[i].mId;
return -1;
}

@ -0,0 +1,184 @@
#ifndef CSM_WOLRD_COLUMNS_H
#define CSM_WOLRD_COLUMNS_H
#include <string>
namespace CSMWorld
{
namespace Columns
{
enum ColumnId
{
ColumnId_Value = 0,
ColumnId_Id = 1,
ColumnId_Modification = 2,
ColumnId_RecordType = 3,
ColumnId_ValueType = 4,
ColumnId_Description = 5,
ColumnId_Specialisation = 6,
ColumnId_Attribute = 7,
ColumnId_Name = 8,
ColumnId_Playable = 9,
ColumnId_Hidden = 10,
ColumnId_MaleWeight = 11,
ColumnId_FemaleWeight = 12,
ColumnId_MaleHeight = 13,
ColumnId_FemaleHeight = 14,
ColumnId_Volume = 15,
ColumnId_MinRange = 16,
ColumnId_MaxRange = 17,
ColumnId_SoundFile = 18,
ColumnId_MapColour = 19,
ColumnId_SleepEncounter = 20,
ColumnId_Texture = 21,
ColumnId_SpellType = 22,
ColumnId_Cost = 23,
ColumnId_ScriptText = 24,
ColumnId_Region = 25,
ColumnId_Cell = 26,
ColumnId_Scale = 27,
ColumnId_Owner = 28,
ColumnId_Soul = 29,
ColumnId_Faction = 30,
ColumnId_FactionIndex = 31,
ColumnId_Charges = 32,
ColumnId_Enchantment = 33,
ColumnId_CoinValue = 34,
ColumnId_Teleport = 25,
ColumnId_TeleportCell = 26,
ColumnId_LockLevel = 27,
ColumnId_Key = 28,
ColumnId_Trap = 29,
ColumnId_BeastRace = 30,
ColumnId_AutoCalc = 31,
ColumnId_StarterSpell = 32,
ColumnId_AlwaysSucceeds = 33,
ColumnId_SleepForbidden = 34,
ColumnId_InteriorWater = 35,
ColumnId_InteriorSky = 36,
ColumnId_Model = 37,
ColumnId_Script = 38,
ColumnId_Icon = 39,
ColumnId_Weight = 40,
ColumnId_EnchantmentPoints = 31,
ColumnId_Quality = 32,
ColumnId_Ai = 33,
ColumnId_AiHello = 34,
ColumnId_AiFlee = 35,
ColumnId_AiFight = 36,
ColumnId_AiAlarm = 37,
ColumnId_BuysWeapons = 38,
ColumnId_BuysArmor = 39,
ColumnId_BuysClothing = 40,
ColumnId_BuysBooks = 41,
ColumnId_BuysIngredients = 42,
ColumnId_BuysLockpicks = 43,
ColumnId_BuysProbes = 44,
ColumnId_BuysLights = 45,
ColumnId_BuysApparati = 46,
ColumnId_BuysRepairItems = 47,
ColumnId_BuysMiscItems = 48,
ColumnId_BuysPotions = 49,
ColumnId_BuysMagicItems = 50,
ColumnId_SellsSpells = 51,
ColumnId_Trainer = 52,
ColumnId_Spellmaking = 53,
ColumnId_EnchantingService = 54,
ColumnId_RepairService = 55,
ColumnId_ApparatusType = 56,
ColumnId_ArmorType = 57,
ColumnId_Health = 58,
ColumnId_ArmorValue = 59,
ColumnId_Scroll = 60,
ColumnId_ClothingType = 61,
ColumnId_WeightCapacity = 62,
ColumnId_OrganicContainer = 63,
ColumnId_Respawn = 64,
ColumnId_CreatureType = 65,
ColumnId_SoulPoints = 66,
ColumnId_OriginalCreature = 67,
ColumnId_Biped = 68,
ColumnId_HasWeapon = 69,
ColumnId_NoMovement = 70,
ColumnId_Swims = 71,
ColumnId_Flies = 72,
ColumnId_Walks = 73,
ColumnId_Essential = 74,
ColumnId_SkeletonBlood = 75,
ColumnId_MetalBlood = 76,
ColumnId_OpenSound = 77,
ColumnId_CloseSound = 78,
ColumnId_Duration = 79,
ColumnId_Radius = 80,
ColumnId_Colour = 81,
ColumnId_Sound = 82,
ColumnId_Dynamic = 83,
ColumnId_Portable = 84,
ColumnId_NegativeLight = 85,
ColumnId_Flickering = 86,
ColumnId_SlowFlickering = 87,
ColumnId_Pulsing = 88,
ColumnId_SlowPulsing = 89,
ColumnId_Fire = 90,
ColumnId_OffByDefault = 91,
ColumnId_IsKey = 92,
ColumnId_Race = 93,
ColumnId_Class = 94,
Columnid_Hair = 95,
ColumnId_Head = 96,
ColumnId_Female = 97,
ColumnId_WeaponType = 98,
ColumnId_WeaponSpeed = 99,
ColumnId_WeaponReach = 100,
ColumnId_MinChop = 101,
ColumnId_MaxChip = 102,
Columnid_MinSlash = 103,
ColumnId_MaxSlash = 104,
ColumnId_MinThrust = 105,
ColumnId_MaxThrust = 106,
ColumnId_Magical = 107,
ColumnId_Silver = 108,
// Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of use values.
ColumnId_UseValue1 = 0x10000,
ColumnId_UseValue2 = 0x10001,
ColumnId_UseValue3 = 0x10002,
ColumnId_UseValue4 = 0x10003,
// Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of attributes. Note that this is not the number of different
// attributes, but the number of attributes that can be references from a record.
ColumnId_Attribute1 = 0x20000,
ColumnId_Attribute2 = 0x20001,
// Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of skills. Note that this is not the number of different
// skills, but the number of skills that can be references from a record.
ColumnId_MajorSkill1 = 0x30000,
ColumnId_MajorSkill2 = 0x30001,
ColumnId_MajorSkill3 = 0x30002,
ColumnId_MajorSkill4 = 0x30003,
ColumnId_MajorSkill5 = 0x30004,
ColumnId_MinorSkill1 = 0x40000,
ColumnId_MinorSkill2 = 0x40001,
ColumnId_MinorSkill3 = 0x40002,
ColumnId_MinorSkill4 = 0x40003,
ColumnId_MinorSkill5 = 0x40004,
ColumnId_Skill1 = 0x50000,
ColumnId_Skill2 = 0x50001,
ColumnId_Skill3 = 0x50002,
ColumnId_Skill4 = 0x50003,
ColumnId_Skill5 = 0x50004
};
std::string getName (ColumnId column);
int getId (const std::string& name);
///< Will return -1 for an invalid name.
}
}
#endif

@ -12,6 +12,7 @@
#include "idtable.hpp"
#include "columnimp.hpp"
#include "regionmap.hpp"
#include "columns.hpp"
void CSMWorld::Data::addModel (QAbstractItemModel *model, UniversalId::Type type1,
UniversalId::Type type2)
@ -76,8 +77,8 @@ CSMWorld::Data::Data() : mRefs (mCells)
mRaces.addColumn (new FixedRecordTypeColumn<ESM::Race> (UniversalId::Type_Race));
mRaces.addColumn (new NameColumn<ESM::Race>);
mRaces.addColumn (new DescriptionColumn<ESM::Race>);
mRaces.addColumn (new FlagColumn<ESM::Race> ("Playable", 0x1));
mRaces.addColumn (new FlagColumn<ESM::Race> ("Beast Race", 0x2));
mRaces.addColumn (new FlagColumn<ESM::Race> (Columns::ColumnId_Playable, 0x1));
mRaces.addColumn (new FlagColumn<ESM::Race> (Columns::ColumnId_BeastRace, 0x2));
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (true, true));
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (true, false));
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (false, true));
@ -116,17 +117,17 @@ CSMWorld::Data::Data() : mRefs (mCells)
mSpells.addColumn (new NameColumn<ESM::Spell>);
mSpells.addColumn (new SpellTypeColumn<ESM::Spell>);
mSpells.addColumn (new CostColumn<ESM::Spell>);
mSpells.addColumn (new FlagColumn<ESM::Spell> ("Autocalc", 0x1));
mSpells.addColumn (new FlagColumn<ESM::Spell> ("Starter Spell", 0x2));
mSpells.addColumn (new FlagColumn<ESM::Spell> ("Always Succeeds", 0x4));
mSpells.addColumn (new FlagColumn<ESM::Spell> (Columns::ColumnId_AutoCalc, 0x1));
mSpells.addColumn (new FlagColumn<ESM::Spell> (Columns::ColumnId_StarterSpell, 0x2));
mSpells.addColumn (new FlagColumn<ESM::Spell> (Columns::ColumnId_AlwaysSucceeds, 0x4));
mCells.addColumn (new StringIdColumn<Cell>);
mCells.addColumn (new RecordStateColumn<Cell>);
mCells.addColumn (new FixedRecordTypeColumn<Cell> (UniversalId::Type_Cell));
mCells.addColumn (new NameColumn<Cell>);
mCells.addColumn (new FlagColumn<Cell> ("Sleep forbidden", ESM::Cell::NoSleep));
mCells.addColumn (new FlagColumn<Cell> ("Interior Water", ESM::Cell::HasWater));
mCells.addColumn (new FlagColumn<Cell> ("Interior Sky", ESM::Cell::QuasiEx));
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_SleepForbidden, ESM::Cell::NoSleep));
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorWater, ESM::Cell::HasWater));
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorSky, ESM::Cell::QuasiEx));
mCells.addColumn (new RegionColumn<Cell>);
mRefs.addColumn (new StringIdColumn<CellRef> (true));

@ -47,7 +47,7 @@ QVariant CSMWorld::IdTable::headerData (int section, Qt::Orientation orientation
return QVariant();
if (role==Qt::DisplayRole)
return tr (mIdCollection->getColumn (section).mTitle.c_str());
return tr (mIdCollection->getColumn (section).getTitle().c_str());
if (role==ColumnBase::Role_Flags)
return mIdCollection->getColumn (section).mFlags;

@ -7,10 +7,11 @@
#include "refidadapter.hpp"
#include "refidadapterimp.hpp"
#include "columns.hpp"
CSMWorld::RefIdColumn::RefIdColumn (const std::string& title, Display displayType, int flag,
CSMWorld::RefIdColumn::RefIdColumn (int columnId, Display displayType, int flag,
bool editable, bool userEditable)
: ColumnBase (title, displayType, flag), mEditable (editable), mUserEditable (userEditable)
: ColumnBase (columnId, displayType, flag), mEditable (editable), mUserEditable (userEditable)
{}
bool CSMWorld::RefIdColumn::isEditable() const
@ -38,157 +39,158 @@ CSMWorld::RefIdCollection::RefIdCollection()
{
BaseColumns baseColumns;
mColumns.push_back (RefIdColumn ("ID", ColumnBase::Display_String,
mColumns.push_back (RefIdColumn (Columns::ColumnId_Id, ColumnBase::Display_String,
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false));
baseColumns.mId = &mColumns.back();
mColumns.push_back (RefIdColumn ("*", ColumnBase::Display_RecordState,
mColumns.push_back (RefIdColumn (Columns::ColumnId_Modification, ColumnBase::Display_RecordState,
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false));
baseColumns.mModified = &mColumns.back();
mColumns.push_back (RefIdColumn ("Type", ColumnBase::Display_RefRecordType,
mColumns.push_back (RefIdColumn (Columns::ColumnId_RecordType, ColumnBase::Display_RefRecordType,
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false));
baseColumns.mType = &mColumns.back();
ModelColumns modelColumns (baseColumns);
mColumns.push_back (RefIdColumn ("Model", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Model, ColumnBase::Display_String));
modelColumns.mModel = &mColumns.back();
NameColumns nameColumns (modelColumns);
mColumns.push_back (RefIdColumn ("Name", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Name, ColumnBase::Display_String));
nameColumns.mName = &mColumns.back();
mColumns.push_back (RefIdColumn ("Script", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Script, ColumnBase::Display_String));
nameColumns.mScript = &mColumns.back();
InventoryColumns inventoryColumns (nameColumns);
mColumns.push_back (RefIdColumn ("Icon", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Icon, ColumnBase::Display_String));
inventoryColumns.mIcon = &mColumns.back();
mColumns.push_back (RefIdColumn ("Weight", ColumnBase::Display_Float));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Weight, ColumnBase::Display_Float));
inventoryColumns.mWeight = &mColumns.back();
mColumns.push_back (RefIdColumn ("Value", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_CoinValue, ColumnBase::Display_Integer));
inventoryColumns.mValue = &mColumns.back();
EnchantableColumns enchantableColumns (inventoryColumns);
mColumns.push_back (RefIdColumn ("Enchantment", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Enchantment, ColumnBase::Display_String));
enchantableColumns.mEnchantment = &mColumns.back();
mColumns.push_back (RefIdColumn ("Enchantment Points", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_EnchantmentPoints, ColumnBase::Display_Integer));
enchantableColumns.mEnchantmentPoints = &mColumns.back();
ToolColumns toolsColumns (inventoryColumns);
mColumns.push_back (RefIdColumn ("Quality", ColumnBase::Display_Float));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Quality, ColumnBase::Display_Float));
toolsColumns.mQuality = &mColumns.back();
mColumns.push_back (RefIdColumn ("Uses", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Charges, ColumnBase::Display_Integer));
toolsColumns.mUses = &mColumns.back();
ActorColumns actorsColumns (nameColumns);
mColumns.push_back (RefIdColumn ("AI", ColumnBase::Display_Boolean));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Ai, ColumnBase::Display_Boolean));
actorsColumns.mHasAi = &mColumns.back();
mColumns.push_back (RefIdColumn ("AI Hello", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_AiHello, ColumnBase::Display_Integer));
actorsColumns.mHello = &mColumns.back();
mColumns.push_back (RefIdColumn ("AI Flee", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_AiFlee, ColumnBase::Display_Integer));
actorsColumns.mFlee = &mColumns.back();
mColumns.push_back (RefIdColumn ("AI Fight", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_AiFight, ColumnBase::Display_Integer));
actorsColumns.mFight = &mColumns.back();
mColumns.push_back (RefIdColumn ("AI Alarm", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_AiAlarm, ColumnBase::Display_Integer));
actorsColumns.mAlarm = &mColumns.back();
static const struct
{
const char *mName;
int mName;
unsigned int mFlag;
} sServiceTable[] =
{
{ "Buys Weapons", ESM::NPC::Weapon},
{ "Buys Armor", ESM::NPC::Armor},
{ "Buys Clothing", ESM::NPC::Clothing},
{ "Buys Books", ESM::NPC::Books},
{ "Buys Ingredients", ESM::NPC::Ingredients},
{ "Buys Lockpicks", ESM::NPC::Picks},
{ "Buys Probes", ESM::NPC::Probes},
{ "Buys Lights", ESM::NPC::Lights},
{ "Buys Apparati", ESM::NPC::Apparatus},
{ "Buys Repair Items", ESM::NPC::RepairItem},
{ "Buys Misc Items", ESM::NPC::Misc},
{ "Buys Potions", ESM::NPC::Potions},
{ "Buys Magic Items", ESM::NPC::MagicItems},
{ "Sells Spells", ESM::NPC::Spells},
{ "Trainer", ESM::NPC::Training},
{ "Spellmaking", ESM::NPC::Spellmaking},
{ "Enchanting Service", ESM::NPC::Enchanting},
{ "Repair Serivce", ESM::NPC::Repair},
{ 0, 0 }
{ Columns::ColumnId_BuysWeapons, ESM::NPC::Weapon},
{ Columns::ColumnId_BuysArmor, ESM::NPC::Armor},
{ Columns::ColumnId_BuysClothing, ESM::NPC::Clothing},
{ Columns::ColumnId_BuysBooks, ESM::NPC::Books},
{ Columns::ColumnId_BuysIngredients, ESM::NPC::Ingredients},
{ Columns::ColumnId_BuysLockpicks, ESM::NPC::Picks},
{ Columns::ColumnId_BuysProbes, ESM::NPC::Probes},
{ Columns::ColumnId_BuysLights, ESM::NPC::Lights},
{ Columns::ColumnId_BuysApparati, ESM::NPC::Apparatus},
{ Columns::ColumnId_BuysRepairItems, ESM::NPC::RepairItem},
{ Columns::ColumnId_BuysMiscItems, ESM::NPC::Misc},
{ Columns::ColumnId_BuysPotions, ESM::NPC::Potions},
{ Columns::ColumnId_BuysMagicItems, ESM::NPC::MagicItems},
{ Columns::ColumnId_SellsSpells, ESM::NPC::Spells},
{ Columns::ColumnId_Trainer, ESM::NPC::Training},
{ Columns::ColumnId_Spellmaking, ESM::NPC::Spellmaking},
{ Columns::ColumnId_EnchantingService, ESM::NPC::Enchanting},
{ Columns::ColumnId_RepairService, ESM::NPC::Repair},
{ -1, 0 }
};
for (int i=0; sServiceTable[i].mName; ++i)
for (int i=0; sServiceTable[i].mName!=-1; ++i)
{
mColumns.push_back (RefIdColumn (sServiceTable[i].mName, ColumnBase::Display_Boolean));
actorsColumns.mServices.insert (std::make_pair (&mColumns.back(), sServiceTable[i].mFlag));
}
mColumns.push_back (RefIdColumn ("Auto Calc", ColumnBase::Display_Boolean));
mColumns.push_back (RefIdColumn (Columns::ColumnId_AutoCalc, ColumnBase::Display_Boolean));
const RefIdColumn *autoCalc = &mColumns.back();
mColumns.push_back (RefIdColumn ("Apparatus Type", ColumnBase::Display_ApparatusType));
mColumns.push_back (RefIdColumn (Columns::ColumnId_ApparatusType,
ColumnBase::Display_ApparatusType));
const RefIdColumn *apparatusType = &mColumns.back();
mColumns.push_back (RefIdColumn ("Armor Type", ColumnBase::Display_ArmorType));
mColumns.push_back (RefIdColumn (Columns::ColumnId_ArmorType, ColumnBase::Display_ArmorType));
const RefIdColumn *armorType = &mColumns.back();
mColumns.push_back (RefIdColumn ("Health", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Health, ColumnBase::Display_Integer));
const RefIdColumn *health = &mColumns.back();
mColumns.push_back (RefIdColumn ("Armor Value", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_ArmorValue, ColumnBase::Display_Integer));
const RefIdColumn *armor = &mColumns.back();
mColumns.push_back (RefIdColumn ("Scroll", ColumnBase::Display_Boolean));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Scroll, ColumnBase::Display_Boolean));
const RefIdColumn *scroll = &mColumns.back();
mColumns.push_back (RefIdColumn ("Attribute", ColumnBase::Display_Attribute));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute));
const RefIdColumn *attribute = &mColumns.back();
mColumns.push_back (RefIdColumn ("Clothing Type", ColumnBase::Display_ClothingType));
mColumns.push_back (RefIdColumn (Columns::ColumnId_ClothingType, ColumnBase::Display_ClothingType));
const RefIdColumn *clothingType = &mColumns.back();
mColumns.push_back (RefIdColumn ("Weight Capacity", ColumnBase::Display_Float));
mColumns.push_back (RefIdColumn (Columns::ColumnId_WeightCapacity, ColumnBase::Display_Float));
const RefIdColumn *weightCapacity = &mColumns.back();
mColumns.push_back (RefIdColumn ("Organic Container", ColumnBase::Display_Boolean));
mColumns.push_back (RefIdColumn (Columns::ColumnId_OrganicContainer, ColumnBase::Display_Boolean));
const RefIdColumn *organic = &mColumns.back();
mColumns.push_back (RefIdColumn ("Respawn", ColumnBase::Display_Boolean));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Respawn, ColumnBase::Display_Boolean));
const RefIdColumn *respawn = &mColumns.back();
CreatureColumns creatureColumns (actorsColumns);
mColumns.push_back (RefIdColumn ("Creature Type", ColumnBase::Display_CreatureType));
mColumns.push_back (RefIdColumn (Columns::ColumnId_CreatureType, ColumnBase::Display_CreatureType));
creatureColumns.mType = &mColumns.back();
mColumns.push_back (RefIdColumn ("Soul Points", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_SoulPoints, ColumnBase::Display_Integer));
creatureColumns.mSoul = &mColumns.back();
mColumns.push_back (RefIdColumn ("Scale", ColumnBase::Display_Float));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Scale, ColumnBase::Display_Float));
creatureColumns.mScale = &mColumns.back();
mColumns.push_back (RefIdColumn ("Original Creature", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_OriginalCreature, ColumnBase::Display_String));
creatureColumns.mOriginal = &mColumns.back();
static const struct
{
const char *mName;
int mName;
unsigned int mFlag;
} sCreatureFlagTable[] =
{
{ "Biped", ESM::Creature::Biped },
{ "Has Weapon", ESM::Creature::Weapon },
{ "No Movement", ESM::Creature::None },
{ "Swims", ESM::Creature::Swims },
{ "Flies", ESM::Creature::Flies },
{ "Walks", ESM::Creature::Walks },
{ "Essential", ESM::Creature::Essential },
{ "Skeleton Blood", ESM::Creature::Skeleton },
{ "Metal Blood", ESM::Creature::Metal },
{ 0, 0 }
{ Columns::ColumnId_Biped, ESM::Creature::Biped },
{ Columns::ColumnId_HasWeapon, ESM::Creature::Weapon },
{ Columns::ColumnId_NoMovement, ESM::Creature::None },
{ Columns::ColumnId_Swims, ESM::Creature::Swims },
{ Columns::ColumnId_Flies, ESM::Creature::Flies },
{ Columns::ColumnId_Walks, ESM::Creature::Walks },
{ Columns::ColumnId_Essential, ESM::Creature::Essential },
{ Columns::ColumnId_SkeletonBlood, ESM::Creature::Skeleton },
{ Columns::ColumnId_MetalBlood, ESM::Creature::Metal },
{ -1, 0 }
};
// for re-use in NPC records
@ -196,7 +198,7 @@ CSMWorld::RefIdCollection::RefIdCollection()
const RefIdColumn *skeletonBlood = 0;
const RefIdColumn *metalBlood = 0;
for (int i=0; sCreatureFlagTable[i].mName; ++i)
for (int i=0; sCreatureFlagTable[i].mName!=-1; ++i)
{
mColumns.push_back (RefIdColumn (sCreatureFlagTable[i].mName, ColumnBase::Display_Boolean));
creatureColumns.mFlags.insert (std::make_pair (&mColumns.back(), sCreatureFlagTable[i].mFlag));
@ -211,71 +213,71 @@ CSMWorld::RefIdCollection::RefIdCollection()
creatureColumns.mFlags.insert (std::make_pair (respawn, ESM::Creature::Respawn));
mColumns.push_back (RefIdColumn ("Open Sound", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_OpenSound, ColumnBase::Display_String));
const RefIdColumn *openSound = &mColumns.back();
mColumns.push_back (RefIdColumn ("Close Sound", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_CloseSound, ColumnBase::Display_String));
const RefIdColumn *closeSound = &mColumns.back();
LightColumns lightColumns (inventoryColumns);
mColumns.push_back (RefIdColumn ("Duration", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Duration, ColumnBase::Display_Integer));
lightColumns.mTime = &mColumns.back();
mColumns.push_back (RefIdColumn ("Radius", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Radius, ColumnBase::Display_Integer));
lightColumns.mRadius = &mColumns.back();
mColumns.push_back (RefIdColumn ("Colour", ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Colour, ColumnBase::Display_Integer));
lightColumns.mColor = &mColumns.back();
mColumns.push_back (RefIdColumn ("Sound", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Sound, ColumnBase::Display_String));
lightColumns.mSound = &mColumns.back();
static const struct
{
const char *mName;
int mName;
unsigned int mFlag;
} sLightFlagTable[] =
{
{ "Dynamic", ESM::Light::Dynamic },
{ "Portable", ESM::Light::Carry },
{ "Negative Light", ESM::Light::Negative },
{ "Flickering", ESM::Light::Flicker },
{ "Slow Flickering", ESM::Light::Flicker },
{ "Pulsing", ESM::Light::Pulse },
{ "Slow Pulsing", ESM::Light::PulseSlow },
{ "Fire", ESM::Light::Fire },
{ "Off by default", ESM::Light::OffDefault },
{ 0, 0 }
{ Columns::ColumnId_Dynamic, ESM::Light::Dynamic },
{ Columns::ColumnId_Portable, ESM::Light::Carry },
{ Columns::ColumnId_NegativeLight, ESM::Light::Negative },
{ Columns::ColumnId_Flickering, ESM::Light::Flicker },
{ Columns::ColumnId_SlowFlickering, ESM::Light::Flicker },
{ Columns::ColumnId_Pulsing, ESM::Light::Pulse },
{ Columns::ColumnId_SlowPulsing, ESM::Light::PulseSlow },
{ Columns::ColumnId_Fire, ESM::Light::Fire },
{ Columns::ColumnId_OffByDefault, ESM::Light::OffDefault },
{ -1, 0 }
};
for (int i=0; sLightFlagTable[i].mName; ++i)
for (int i=0; sLightFlagTable[i].mName!=-1; ++i)
{
mColumns.push_back (RefIdColumn (sLightFlagTable[i].mName, ColumnBase::Display_Boolean));
lightColumns.mFlags.insert (std::make_pair (&mColumns.back(), sLightFlagTable[i].mFlag));
}
mColumns.push_back (RefIdColumn ("Key", ColumnBase::Display_Boolean));
mColumns.push_back (RefIdColumn (Columns::ColumnId_IsKey, ColumnBase::Display_Boolean));
const RefIdColumn *key = &mColumns.back();
NpcColumns npcColumns (actorsColumns);
mColumns.push_back (RefIdColumn ("Race", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Race, ColumnBase::Display_String));
npcColumns.mRace = &mColumns.back();
mColumns.push_back (RefIdColumn ("Class", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Class, ColumnBase::Display_String));
npcColumns.mClass = &mColumns.back();
mColumns.push_back (RefIdColumn ("Faction", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Faction, ColumnBase::Display_String));
npcColumns.mFaction = &mColumns.back();
mColumns.push_back (RefIdColumn ("Hair", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::Columnid_Hair, ColumnBase::Display_String));
npcColumns.mHair = &mColumns.back();
mColumns.push_back (RefIdColumn ("Head", ColumnBase::Display_String));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Head, ColumnBase::Display_String));
npcColumns.mHead = &mColumns.back();
mColumns.push_back (RefIdColumn ("Female", ColumnBase::Display_Boolean));
mColumns.push_back (RefIdColumn (Columns::ColumnId_Female, ColumnBase::Display_Boolean));
npcColumns.mFlags.insert (std::make_pair (&mColumns.back(), ESM::NPC::Female));
npcColumns.mFlags.insert (std::make_pair (essential, ESM::NPC::Essential));
@ -290,43 +292,35 @@ CSMWorld::RefIdCollection::RefIdCollection()
WeaponColumns weaponColumns (enchantableColumns);
mColumns.push_back (RefIdColumn ("Weapon Type", ColumnBase::Display_WeaponType));
mColumns.push_back (RefIdColumn (Columns::ColumnId_WeaponType, ColumnBase::Display_WeaponType));
weaponColumns.mType = &mColumns.back();
weaponColumns.mHealth = health;
mColumns.push_back (RefIdColumn ("Weapon Speed", ColumnBase::Display_Float));
mColumns.push_back (RefIdColumn (Columns::ColumnId_WeaponSpeed, ColumnBase::Display_Float));
weaponColumns.mSpeed = &mColumns.back();
mColumns.push_back (RefIdColumn ("Weapon Reach", ColumnBase::Display_Float));
mColumns.push_back (RefIdColumn (Columns::ColumnId_WeaponReach, ColumnBase::Display_Float));
weaponColumns.mReach = &mColumns.back();
for (int i=0; i<2; ++i)
for (int i=0; i<6; ++i)
{
std::string suffix = i==0 ? "Min " : "Max ";
mColumns.push_back (RefIdColumn ("Chop" + suffix, ColumnBase::Display_Integer));
mColumns.push_back (RefIdColumn (Columns::ColumnId_MinChop + i, ColumnBase::Display_Integer));
weaponColumns.mChop[i] = &mColumns.back();
mColumns.push_back (RefIdColumn ("Slash" + suffix, ColumnBase::Display_Integer));
weaponColumns.mSlash[i] = &mColumns.back();
mColumns.push_back (RefIdColumn ("Thrust" + suffix, ColumnBase::Display_Integer));
weaponColumns.mThrust[i] = &mColumns.back();
}
static const struct
{
const char *mName;
int mName;
unsigned int mFlag;
} sWeaponFlagTable[] =
{
{ "Magical", ESM::Weapon::Magical },
{ "Silver", ESM::Weapon::Silver },
{ 0, 0 }
{ Columns::ColumnId_Magical, ESM::Weapon::Magical },
{ Columns::ColumnId_Silver, ESM::Weapon::Silver },
{ -1, 0 }
};
for (int i=0; sWeaponFlagTable[i].mName; ++i)
for (int i=0; sWeaponFlagTable[i].mName!=-1; ++i)
{
mColumns.push_back (RefIdColumn (sWeaponFlagTable[i].mName, ColumnBase::Display_Boolean));
weaponColumns.mFlags.insert (std::make_pair (&mColumns.back(), sWeaponFlagTable[i].mFlag));

@ -20,7 +20,7 @@ namespace CSMWorld
public:
RefIdColumn (const std::string& title, Display displayType,
RefIdColumn (int columnId, Display displayType,
int flag = Flag_Table | Flag_Dialogue, bool editable = true,
bool userEditable = true);

Loading…
Cancel
Save