forked from mirror/openmw-tes3mp
added flag columns to race table
This commit is contained in:
parent
73da794d77
commit
076831c9cc
2 changed files with 36 additions and 0 deletions
|
@ -434,6 +434,40 @@ namespace CSMWorld
|
|||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct FlagColumn : public Column<ESXRecordT>
|
||||
{
|
||||
int mMask;
|
||||
|
||||
FlagColumn (const std::string& name, int mask)
|
||||
: Column<ESXRecordT> (name, ColumnBase::Display_Boolean), mMask (mask)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return (record.get().mData.mFlags & mMask)!=0;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
int flags = record.get().mData.mFlags & ~mMask;
|
||||
|
||||
if (data.toInt())
|
||||
flags |= mMask;
|
||||
|
||||
record2.mData.mFlags = flags;
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -70,6 +70,8 @@ CSMWorld::Data::Data()
|
|||
mRaces.addColumn (new RecordStateColumn<ESM::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));
|
||||
|
||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
||||
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);
|
||||
|
|
Loading…
Reference in a new issue