added missing sound gen table columns

deque
Marc Zinnschlag 10 years ago
parent 7ab4881661
commit 33cd04b37d

@ -101,7 +101,8 @@ namespace CSMWorld
Display_Texture,
Display_Video,
Display_Colour,
Display_ScriptLines // console context
Display_ScriptLines, // console context
Display_SoundGeneratorType
};
int mColumnId;

@ -1982,6 +1982,88 @@ namespace CSMWorld
return false;
}
};
template<typename ESXRecordT>
struct SoundColumn : public Column<ESXRecordT>
{
SoundColumn()
: Column<ESXRecordT> (Columns::ColumnId_Sound, ColumnBase::Display_Sound)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mSound.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mSound = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct CreatureColumn : public Column<ESXRecordT>
{
CreatureColumn()
: Column<ESXRecordT> (Columns::ColumnId_Creature, ColumnBase::Display_Creature)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mCreature.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mCreature = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct SoundGeneratorTypeColumn : public Column<ESXRecordT>
{
SoundGeneratorTypeColumn()
: Column<ESXRecordT> (Columns::ColumnId_SoundGeneratorType, ColumnBase::Display_SoundGeneratorType)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return static_cast<int> (record.get().mType);
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mType = data.toInt();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
}
#endif

@ -186,6 +186,8 @@ namespace CSMWorld
{ ColumnId_GlobalProfile, "Global Profile" },
{ ColumnId_RefNumCounter, "RefNum Counter" },
{ ColumnId_RefNum, "RefNum" },
{ ColumnId_Creature, "Creature" },
{ ColumnId_SoundGeneratorType, "Sound Generator Type" },
{ ColumnId_UseValue1, "Use value 1" },
{ ColumnId_UseValue2, "Use value 2" },
@ -327,6 +329,12 @@ namespace
"Skin", "Clothing", "Armour", 0
};
static const char *sSoundGeneratorType[] =
{
"Left Foot", "Right Foot", "Swim Left", "Swim Right", "Moan", "Roar", "Scream",
"Land", 0
};
const char **getEnumNames (CSMWorld::Columns::ColumnId column)
{
switch (column)
@ -347,6 +355,7 @@ namespace
case CSMWorld::Columns::ColumnId_EnchantmentType: return sEnchantmentTypes;
case CSMWorld::Columns::ColumnId_BodyPartType: return sBodyPartTypes;
case CSMWorld::Columns::ColumnId_MeshType: return sMeshTypes;
case CSMWorld::Columns::ColumnId_SoundGeneratorType: return sSoundGeneratorType;
default: return 0;
}

@ -179,6 +179,8 @@ namespace CSMWorld
ColumnId_GlobalProfile = 167,
ColumnId_RefNumCounter = 168,
ColumnId_RefNum = 169,
ColumnId_Creature = 170,
ColumnId_SoundGeneratorType = 171,
// Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of use values.

@ -224,6 +224,9 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mSoundGens.addColumn (new StringIdColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new RecordStateColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new FixedRecordTypeColumn<ESM::SoundGenerator> (UniversalId::Type_SoundGen));
mSoundGens.addColumn (new CreatureColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new SoundColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new SoundGeneratorTypeColumn<ESM::SoundGenerator>);
mRefs.addColumn (new StringIdColumn<CellRef> (true));
mRefs.addColumn (new RecordStateColumn<CellRef>);

@ -81,7 +81,8 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
{ CSMWorld::ColumnBase::Display_EnchantmentType, CSMWorld::Columns::ColumnId_EnchantmentType, false },
{ CSMWorld::ColumnBase::Display_BodyPartType, CSMWorld::Columns::ColumnId_BodyPartType, false },
{ CSMWorld::ColumnBase::Display_MeshType, CSMWorld::Columns::ColumnId_MeshType, false },
{ 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 }
};
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)

Loading…
Cancel
Save