mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 05:53:50 +00:00
added flag columns to debug profile table
This commit is contained in:
parent
2b9395333a
commit
fd3842d726
4 changed files with 53 additions and 0 deletions
|
@ -500,6 +500,47 @@ namespace CSMWorld
|
|||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct FlagColumn2 : public Column<ESXRecordT>
|
||||
{
|
||||
int mMask;
|
||||
bool mInverted;
|
||||
|
||||
FlagColumn2 (int columnId, int mask, bool inverted = false)
|
||||
: Column<ESXRecordT> (columnId, ColumnBase::Display_Boolean), mMask (mask),
|
||||
mInverted (inverted)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
bool flag = (record.get().mFlags & mMask)!=0;
|
||||
|
||||
if (mInverted)
|
||||
flag = !flag;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
int flags = record2.mFlags & ~mMask;
|
||||
|
||||
if ((data.toInt()!=0)!=mInverted)
|
||||
flags |= mMask;
|
||||
|
||||
record2.mFlags = flags;
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct WeightHeightColumn : public Column<ESXRecordT>
|
||||
{
|
||||
|
|
|
@ -180,6 +180,9 @@ namespace CSMWorld
|
|||
{ ColumnId_Vampire, "Vampire" },
|
||||
{ ColumnId_BodyPartType, "Bodypart Type" },
|
||||
{ ColumnId_MeshType, "Mesh Type" },
|
||||
{ ColumnId_DefaultProfile, "Default Profile" },
|
||||
{ ColumnId_BypassNewGame, "Bypass New Game" },
|
||||
{ ColumnId_GlobalProfile, "Global Profile" },
|
||||
|
||||
{ ColumnId_UseValue1, "Use value 1" },
|
||||
{ ColumnId_UseValue2, "Use value 2" },
|
||||
|
|
|
@ -173,6 +173,9 @@ namespace CSMWorld
|
|||
ColumnId_Vampire = 161,
|
||||
ColumnId_BodyPartType = 162,
|
||||
ColumnId_MeshType = 163,
|
||||
ColumnId_DefaultProfile = 164,
|
||||
ColumnId_BypassNewGame = 165,
|
||||
ColumnId_GlobalProfile = 166,
|
||||
|
||||
// Allocated to a separate value range, so we don't get a collision should we ever need
|
||||
// to extend the number of use values.
|
||||
|
|
|
@ -260,6 +260,12 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
|||
mDebugProfiles.addColumn (new StringIdColumn<ESM::DebugProfile>);
|
||||
mDebugProfiles.addColumn (new RecordStateColumn<ESM::DebugProfile>);
|
||||
mDebugProfiles.addColumn (new FixedRecordTypeColumn<ESM::DebugProfile> (UniversalId::Type_DebugProfile));
|
||||
mDebugProfiles.addColumn (new FlagColumn2<ESM::DebugProfile> (
|
||||
Columns::ColumnId_DefaultProfile, ESM::DebugProfile::Flag_Default));
|
||||
mDebugProfiles.addColumn (new FlagColumn2<ESM::DebugProfile> (
|
||||
Columns::ColumnId_BypassNewGame, ESM::DebugProfile::Flag_BypassNewGame));
|
||||
mDebugProfiles.addColumn (new FlagColumn2<ESM::DebugProfile> (
|
||||
Columns::ColumnId_GlobalProfile, ESM::DebugProfile::Flag_Global));
|
||||
mDebugProfiles.addColumn (new DescriptionColumn<ESM::DebugProfile>);
|
||||
|
||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Global);
|
||||
|
|
Loading…
Reference in a new issue