mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
added use value columns to skills
This commit is contained in:
parent
0ce962e815
commit
4208d52b1a
2 changed files with 34 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
|||
#ifndef CSM_WOLRD_COLUMNS_H
|
||||
#define CSM_WOLRD_COLUMNS_H
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "columnbase.hpp"
|
||||
|
||||
namespace CSMWorld
|
||||
|
@ -227,6 +229,36 @@ namespace CSMWorld
|
|||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct UseValueColumn : public Column<ESXRecordT>
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
UseValueColumn (int index)
|
||||
: Column<ESXRecordT> ("Use value #" + boost::lexical_cast<std::string> (index),
|
||||
ColumnBase::Display_Float), mIndex (index)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return record.get().mData.mUseValue[mIndex];
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mData.mUseValue[mIndex] = data.toInt();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -39,7 +39,8 @@ CSMWorld::Data::Data()
|
|||
mSkills.addColumn (new StringIdColumn<ESM::Skill>);
|
||||
mSkills.addColumn (new RecordStateColumn<ESM::Skill>);
|
||||
mSkills.addColumn (new SpecialisationColumn<ESM::Skill>);
|
||||
|
||||
for (int i=0; i<4; ++i)
|
||||
mSkills.addColumn (new UseValueColumn<ESM::Skill> (i));
|
||||
mSkills.addColumn (new DescriptionColumn<ESM::Skill>);
|
||||
|
||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
||||
|
|
Loading…
Reference in a new issue