1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

added skill columns to faction table

This commit is contained in:
Marc Zinnschlag 2013-04-02 14:04:13 +02:00
parent f9f520df34
commit ec6bdbeb40
2 changed files with 8 additions and 6 deletions

View File

@ -347,15 +347,15 @@ namespace CSMWorld
int mIndex; int mIndex;
bool mMajor; bool mMajor;
SkillsColumn (int index, bool major) SkillsColumn (int index, bool typePrefix = false, bool major = false)
: Column<ESXRecordT> ((major ? "Major Skill #" : "Minor Skill #")+ : Column<ESXRecordT> ((typePrefix ? (major ? "Major Skill #" : "Minor Skill #") : "Skill #")+
boost::lexical_cast<std::string> (index), ColumnBase::Display_String), boost::lexical_cast<std::string> (index), ColumnBase::Display_String),
mIndex (index), mMajor (major) mIndex (index), mMajor (major)
{} {}
virtual QVariant get (const Record<ESXRecordT>& record) const virtual QVariant get (const Record<ESXRecordT>& record) const
{ {
int skill = record.get().mData.mSkills[mIndex][mMajor ? 1 : 0]; int skill = record.get().mData.getSkill (mIndex, mMajor);
return QString::fromUtf8 (ESM::Skill::indexToId (skill).c_str()); return QString::fromUtf8 (ESM::Skill::indexToId (skill).c_str());
} }
@ -373,7 +373,7 @@ namespace CSMWorld
{ {
ESXRecordT record2 = record.get(); ESXRecordT record2 = record.get();
record2.mData.mSkills[mIndex][mMajor ? 1 : 0] = index; record2.mData.getSkill (mIndex, mMajor) = index;
record.setModified (record2); record.setModified (record2);
} }

View File

@ -51,15 +51,17 @@ CSMWorld::Data::Data()
mClasses.addColumn (new AttributesColumn<ESM::Class> (1)); mClasses.addColumn (new AttributesColumn<ESM::Class> (1));
mClasses.addColumn (new SpecialisationColumn<ESM::Class>); mClasses.addColumn (new SpecialisationColumn<ESM::Class>);
for (int i=0; i<5; ++i) for (int i=0; i<5; ++i)
mClasses.addColumn (new SkillsColumn<ESM::Class> (i, true)); mClasses.addColumn (new SkillsColumn<ESM::Class> (i, true, true));
for (int i=0; i<5; ++i) for (int i=0; i<5; ++i)
mClasses.addColumn (new SkillsColumn<ESM::Class> (i, false)); mClasses.addColumn (new SkillsColumn<ESM::Class> (i, true, false));
mClasses.addColumn (new PlayableColumn<ESM::Class>); mClasses.addColumn (new PlayableColumn<ESM::Class>);
mClasses.addColumn (new DescriptionColumn<ESM::Class>); mClasses.addColumn (new DescriptionColumn<ESM::Class>);
mFactions.addColumn (new StringIdColumn<ESM::Faction>); mFactions.addColumn (new StringIdColumn<ESM::Faction>);
mFactions.addColumn (new RecordStateColumn<ESM::Faction>); mFactions.addColumn (new RecordStateColumn<ESM::Faction>);
mFactions.addColumn (new NameColumn<ESM::Faction>); mFactions.addColumn (new NameColumn<ESM::Faction>);
for (int i=0; i<6; ++i)
mFactions.addColumn (new SkillsColumn<ESM::Faction> (i));
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global); addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst); addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);