mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
added basic race table
This commit is contained in:
parent
18e046e628
commit
73da794d77
9 changed files with 64 additions and 1 deletions
|
@ -66,11 +66,17 @@ CSMWorld::Data::Data()
|
||||||
for (int i=0; i<6; ++i)
|
for (int i=0; i<6; ++i)
|
||||||
mFactions.addColumn (new SkillsColumn<ESM::Faction> (i));
|
mFactions.addColumn (new SkillsColumn<ESM::Faction> (i));
|
||||||
|
|
||||||
|
mRaces.addColumn (new StringIdColumn<ESM::Race>);
|
||||||
|
mRaces.addColumn (new RecordStateColumn<ESM::Race>);
|
||||||
|
mRaces.addColumn (new NameColumn<ESM::Race>);
|
||||||
|
mRaces.addColumn (new DescriptionColumn<ESM::Race>);
|
||||||
|
|
||||||
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);
|
||||||
addModel (new IdTable (&mSkills), UniversalId::Type_Skills, UniversalId::Type_Skill);
|
addModel (new IdTable (&mSkills), UniversalId::Type_Skills, UniversalId::Type_Skill);
|
||||||
addModel (new IdTable (&mClasses), UniversalId::Type_Classes, UniversalId::Type_Class);
|
addModel (new IdTable (&mClasses), UniversalId::Type_Classes, UniversalId::Type_Class);
|
||||||
addModel (new IdTable (&mFactions), UniversalId::Type_Factions, UniversalId::Type_Faction);
|
addModel (new IdTable (&mFactions), UniversalId::Type_Factions, UniversalId::Type_Faction);
|
||||||
|
addModel (new IdTable (&mRaces), UniversalId::Type_Races, UniversalId::Type_Race);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMWorld::Data::~Data()
|
CSMWorld::Data::~Data()
|
||||||
|
@ -129,6 +135,16 @@ CSMWorld::IdCollection<ESM::Faction>& CSMWorld::Data::getFactions()
|
||||||
return mFactions;
|
return mFactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CSMWorld::IdCollection<ESM::Race>& CSMWorld::Data::getRaces() const
|
||||||
|
{
|
||||||
|
return mRaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSMWorld::IdCollection<ESM::Race>& CSMWorld::Data::getRaces()
|
||||||
|
{
|
||||||
|
return mRaces;
|
||||||
|
}
|
||||||
|
|
||||||
QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id)
|
QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id)
|
||||||
{
|
{
|
||||||
std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType());
|
std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType());
|
||||||
|
@ -168,6 +184,7 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
||||||
case ESM::REC_SKIL: mSkills.load (reader, base); break;
|
case ESM::REC_SKIL: mSkills.load (reader, base); break;
|
||||||
case ESM::REC_CLAS: mClasses.load (reader, base); break;
|
case ESM::REC_CLAS: mClasses.load (reader, base); break;
|
||||||
case ESM::REC_FACT: mFactions.load (reader, base); break;
|
case ESM::REC_FACT: mFactions.load (reader, base); break;
|
||||||
|
case ESM::REC_RACE: mRaces.load (reader, base); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <components/esm/loadskil.hpp>
|
#include <components/esm/loadskil.hpp>
|
||||||
#include <components/esm/loadclas.hpp>
|
#include <components/esm/loadclas.hpp>
|
||||||
#include <components/esm/loadfact.hpp>
|
#include <components/esm/loadfact.hpp>
|
||||||
|
#include <components/esm/loadrace.hpp>
|
||||||
|
|
||||||
#include "idcollection.hpp"
|
#include "idcollection.hpp"
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
|
@ -26,6 +27,7 @@ namespace CSMWorld
|
||||||
IdCollection<ESM::Skill> mSkills;
|
IdCollection<ESM::Skill> mSkills;
|
||||||
IdCollection<ESM::Class> mClasses;
|
IdCollection<ESM::Class> mClasses;
|
||||||
IdCollection<ESM::Faction> mFactions;
|
IdCollection<ESM::Faction> mFactions;
|
||||||
|
IdCollection<ESM::Race> mRaces;
|
||||||
std::vector<QAbstractItemModel *> mModels;
|
std::vector<QAbstractItemModel *> mModels;
|
||||||
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
||||||
|
|
||||||
|
@ -62,6 +64,10 @@ namespace CSMWorld
|
||||||
|
|
||||||
IdCollection<ESM::Faction>& getFactions();
|
IdCollection<ESM::Faction>& getFactions();
|
||||||
|
|
||||||
|
const IdCollection<ESM::Race>& getRaces() const;
|
||||||
|
|
||||||
|
IdCollection<ESM::Race>& getRaces();
|
||||||
|
|
||||||
QAbstractItemModel *getTableModel (const UniversalId& id);
|
QAbstractItemModel *getTableModel (const UniversalId& id);
|
||||||
///< If no table model is available for \a id, an exception is thrown.
|
///< If no table model is available for \a id, an exception is thrown.
|
||||||
///
|
///
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace
|
||||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Skills, "Skills" },
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Skills, "Skills" },
|
||||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Classes, "Classes" },
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Classes, "Classes" },
|
||||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Factions, "Factions" },
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Factions, "Factions" },
|
||||||
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Races, "Races" },
|
||||||
|
|
||||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
||||||
};
|
};
|
||||||
|
@ -33,6 +34,7 @@ namespace
|
||||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Skill, "Skill" },
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Skill, "Skill" },
|
||||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Class, "Class" },
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Class, "Class" },
|
||||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Faction, "Faction" },
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Faction, "Faction" },
|
||||||
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Race, "Race" },
|
||||||
|
|
||||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,9 @@ namespace CSMWorld
|
||||||
Type_Classes,
|
Type_Classes,
|
||||||
Type_Class,
|
Type_Class,
|
||||||
Type_Factions,
|
Type_Factions,
|
||||||
Type_Faction
|
Type_Faction,
|
||||||
|
Type_Races,
|
||||||
|
Type_Race
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -101,6 +101,10 @@ void CSVDoc::View::setupWorldMenu()
|
||||||
QAction *factions = new QAction (tr ("Factions"), this);
|
QAction *factions = new QAction (tr ("Factions"), this);
|
||||||
connect (factions, SIGNAL (triggered()), this, SLOT (addFactionsSubView()));
|
connect (factions, SIGNAL (triggered()), this, SLOT (addFactionsSubView()));
|
||||||
world->addAction (factions);
|
world->addAction (factions);
|
||||||
|
|
||||||
|
QAction *races = new QAction (tr ("Races"), this);
|
||||||
|
connect (races, SIGNAL (triggered()), this, SLOT (addRacesSubView()));
|
||||||
|
world->addAction (races);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::View::setupUi()
|
void CSVDoc::View::setupUi()
|
||||||
|
@ -271,6 +275,11 @@ void CSVDoc::View::addFactionsSubView()
|
||||||
addSubView (CSMWorld::UniversalId::Type_Factions);
|
addSubView (CSMWorld::UniversalId::Type_Factions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::View::addRacesSubView()
|
||||||
|
{
|
||||||
|
addSubView (CSMWorld::UniversalId::Type_Races);
|
||||||
|
}
|
||||||
|
|
||||||
void CSVDoc::View::abortOperation (int type)
|
void CSVDoc::View::abortOperation (int type)
|
||||||
{
|
{
|
||||||
mDocument->abortOperation (type);
|
mDocument->abortOperation (type);
|
||||||
|
|
|
@ -121,6 +121,8 @@ namespace CSVDoc
|
||||||
void addClassesSubView();
|
void addClassesSubView();
|
||||||
|
|
||||||
void addFactionsSubView();
|
void addFactionsSubView();
|
||||||
|
|
||||||
|
void addRacesSubView();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
CSMWorld::UniversalId::Type_Globals,
|
CSMWorld::UniversalId::Type_Globals,
|
||||||
CSMWorld::UniversalId::Type_Classes,
|
CSMWorld::UniversalId::Type_Classes,
|
||||||
CSMWorld::UniversalId::Type_Factions,
|
CSMWorld::UniversalId::Type_Factions,
|
||||||
|
CSMWorld::UniversalId::Type_Races,
|
||||||
|
|
||||||
CSMWorld::UniversalId::Type_None // end marker
|
CSMWorld::UniversalId::Type_None // end marker
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,4 +30,25 @@ void Race::save(ESMWriter &esm)
|
||||||
esm.writeHNOString("DESC", mDescription);
|
esm.writeHNOString("DESC", mDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Race::blank()
|
||||||
|
{
|
||||||
|
mName.clear();
|
||||||
|
mDescription.clear();
|
||||||
|
|
||||||
|
mPowers.mList.clear();
|
||||||
|
|
||||||
|
for (int i=0; i<7; ++i)
|
||||||
|
{
|
||||||
|
mData.mBonus[i].mSkill = -1;
|
||||||
|
mData.mBonus[i].mBonus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<8; ++i)
|
||||||
|
mData.mAttributeValues[i].mMale = mData.mAttributeValues[i].mFemale = 1;
|
||||||
|
|
||||||
|
mData.mHeight.mMale = mData.mHeight.mFemale = 1;
|
||||||
|
mData.mWeight.mMale = mData.mWeight.mFemale = 1;
|
||||||
|
|
||||||
|
mData.mFlags = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,9 @@ struct Race
|
||||||
|
|
||||||
void load(ESMReader &esm);
|
void load(ESMReader &esm);
|
||||||
void save(ESMWriter &esm);
|
void save(ESMWriter &esm);
|
||||||
|
|
||||||
|
void blank();
|
||||||
|
///< Set record to default state (does not touch the ID/index).
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue