forked from mirror/openmw-tes3mp
Merge branch 'race'
This commit is contained in:
commit
0f34c79d0a
16 changed files with 315 additions and 102 deletions
|
@ -1099,53 +1099,29 @@ void Record<ESM::Pathgrid>::print()
|
|||
template<>
|
||||
void Record<ESM::Race>::print()
|
||||
{
|
||||
static const char *sAttributeNames[8] =
|
||||
{
|
||||
"Strength", "Intelligence", "Willpower", "Agility",
|
||||
"Speed", "Endurance", "Personality", "Luck"
|
||||
};
|
||||
|
||||
std::cout << " Name: " << mData.mName << std::endl;
|
||||
std::cout << " Description: " << mData.mDescription << std::endl;
|
||||
std::cout << " Flags: " << raceFlags(mData.mData.mFlags) << std::endl;
|
||||
|
||||
std::cout << " Male:" << std::endl;
|
||||
std::cout << " Strength: "
|
||||
<< mData.mData.mStrength.mMale << std::endl;
|
||||
std::cout << " Intelligence: "
|
||||
<< mData.mData.mIntelligence.mMale << std::endl;
|
||||
std::cout << " Willpower: "
|
||||
<< mData.mData.mWillpower.mMale << std::endl;
|
||||
std::cout << " Agility: "
|
||||
<< mData.mData.mAgility.mMale << std::endl;
|
||||
std::cout << " Speed: "
|
||||
<< mData.mData.mSpeed.mMale << std::endl;
|
||||
std::cout << " Endurance: "
|
||||
<< mData.mData.mEndurance.mMale << std::endl;
|
||||
std::cout << " Personality: "
|
||||
<< mData.mData.mPersonality.mMale << std::endl;
|
||||
std::cout << " Luck: "
|
||||
<< mData.mData.mLuck.mMale << std::endl;
|
||||
std::cout << " Height: "
|
||||
<< mData.mData.mHeight.mMale << std::endl;
|
||||
std::cout << " Weight: "
|
||||
<< mData.mData.mWeight.mMale << std::endl;
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
bool male = i==0;
|
||||
|
||||
std::cout << " Female:" << std::endl;
|
||||
std::cout << " Strength: "
|
||||
<< mData.mData.mStrength.mFemale << std::endl;
|
||||
std::cout << " Intelligence: "
|
||||
<< mData.mData.mIntelligence.mFemale << std::endl;
|
||||
std::cout << " Willpower: "
|
||||
<< mData.mData.mWillpower.mFemale << std::endl;
|
||||
std::cout << " Agility: "
|
||||
<< mData.mData.mAgility.mFemale << std::endl;
|
||||
std::cout << " Speed: "
|
||||
<< mData.mData.mSpeed.mFemale << std::endl;
|
||||
std::cout << " Endurance: "
|
||||
<< mData.mData.mEndurance.mFemale << std::endl;
|
||||
std::cout << " Personality: "
|
||||
<< mData.mData.mPersonality.mFemale << std::endl;
|
||||
std::cout << " Luck: "
|
||||
<< mData.mData.mLuck.mFemale << std::endl;
|
||||
std::cout << " Height: "
|
||||
<< mData.mData.mHeight.mFemale << std::endl;
|
||||
std::cout << " Weight: "
|
||||
<< mData.mData.mWeight.mFemale << std::endl;
|
||||
std::cout << (male ? " Male:" : " Female:") << std::endl;
|
||||
|
||||
for (int i=0; i<8; ++i)
|
||||
std::cout << " " << sAttributeNames[i] << ": "
|
||||
<< mData.mData.mAttributeValues[i].getValue (male) << std::endl;
|
||||
|
||||
std::cout << " Height: " << mData.mData.mHeight.getValue (male) << std::endl;
|
||||
std::cout << " Weight: " << mData.mData.mWeight.getValue (male) << std::endl;
|
||||
}
|
||||
|
||||
for (int i = 0; i != 7; i++)
|
||||
// Not all races have 7 skills.
|
||||
|
|
|
@ -35,7 +35,7 @@ opencs_units (model/tools
|
|||
)
|
||||
|
||||
opencs_units_noqt (model/tools
|
||||
stage verifier mandatoryid skillcheck classcheck factioncheck
|
||||
stage verifier mandatoryid skillcheck classcheck factioncheck racecheck
|
||||
)
|
||||
|
||||
|
||||
|
|
68
apps/opencs/model/tools/racecheck.cpp
Normal file
68
apps/opencs/model/tools/racecheck.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
|
||||
#include "racecheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <components/esm/loadrace.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
void CSMTools::RaceCheckStage::performPerRecord (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::Race& race = mRaces.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Race, race.mId);
|
||||
|
||||
// test for empty name and description
|
||||
if (race.mName.empty())
|
||||
messages.push_back (id.toString() + "|" + race.mId + " has an empty name");
|
||||
|
||||
if (race.mDescription.empty())
|
||||
messages.push_back (id.toString() + "|" + race.mId + " has an empty description");
|
||||
|
||||
// test for positive height
|
||||
if (race.mData.mHeight.mMale<=0)
|
||||
messages.push_back (id.toString() + "|male " + race.mId + " has non-positive height");
|
||||
|
||||
if (race.mData.mHeight.mFemale<=0)
|
||||
messages.push_back (id.toString() + "|female " + race.mId + " has non-positive height");
|
||||
|
||||
// test for non-negative weight
|
||||
if (race.mData.mWeight.mMale<0)
|
||||
messages.push_back (id.toString() + "|male " + race.mId + " has negative weight");
|
||||
|
||||
if (race.mData.mWeight.mFemale<0)
|
||||
messages.push_back (id.toString() + "|female " + race.mId + " has negative weight");
|
||||
|
||||
// remember playable flag
|
||||
if (race.mData.mFlags & 0x1)
|
||||
mPlayable = true;
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
}
|
||||
|
||||
void CSMTools::RaceCheckStage::performFinal (std::vector<std::string>& messages)
|
||||
{
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Races);
|
||||
|
||||
if (!mPlayable)
|
||||
messages.push_back (id.toString() + "|No playable race");
|
||||
}
|
||||
|
||||
CSMTools::RaceCheckStage::RaceCheckStage (const CSMWorld::IdCollection<ESM::Race>& races)
|
||||
: mRaces (races), mPlayable (false)
|
||||
{}
|
||||
|
||||
int CSMTools::RaceCheckStage::setup()
|
||||
{
|
||||
mPlayable = false;
|
||||
return mRaces.getSize()+1;
|
||||
}
|
||||
|
||||
void CSMTools::RaceCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
if (stage==mRaces.getSize())
|
||||
performFinal (messages);
|
||||
else
|
||||
performPerRecord (stage, messages);
|
||||
}
|
34
apps/opencs/model/tools/racecheck.hpp
Normal file
34
apps/opencs/model/tools/racecheck.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef CSM_TOOLS_RACECHECK_H
|
||||
#define CSM_TOOLS_RACECHECK_H
|
||||
|
||||
#include <components/esm/loadrace.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that race records are internally consistent
|
||||
class RaceCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Race>& mRaces;
|
||||
bool mPlayable;
|
||||
|
||||
void performPerRecord (int stage, std::vector<std::string>& messages);
|
||||
|
||||
void performFinal (std::vector<std::string>& messages);
|
||||
|
||||
public:
|
||||
|
||||
RaceCheckStage (const CSMWorld::IdCollection<ESM::Race>& races);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -15,6 +15,7 @@
|
|||
#include "skillcheck.hpp"
|
||||
#include "classcheck.hpp"
|
||||
#include "factioncheck.hpp"
|
||||
#include "racecheck.hpp"
|
||||
|
||||
CSMTools::Operation *CSMTools::Tools::get (int type)
|
||||
{
|
||||
|
@ -60,6 +61,8 @@ CSMTools::Verifier *CSMTools::Tools::getVerifier()
|
|||
mVerifier->appendStage (new ClassCheckStage (mData.getClasses()));
|
||||
|
||||
mVerifier->appendStage (new FactionCheckStage (mData.getFactions()));
|
||||
|
||||
mVerifier->appendStage (new RaceCheckStage (mData.getRaces()));
|
||||
}
|
||||
|
||||
return mVerifier;
|
||||
|
|
|
@ -434,6 +434,78 @@ 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 = record2.mData.mFlags & ~mMask;
|
||||
|
||||
if (data.toInt())
|
||||
flags |= mMask;
|
||||
|
||||
record2.mData.mFlags = flags;
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct WeightHeightColumn : public Column<ESXRecordT>
|
||||
{
|
||||
bool mMale;
|
||||
bool mWeight;
|
||||
|
||||
WeightHeightColumn (bool male, bool weight)
|
||||
: Column<ESXRecordT> (male ? (weight ? "Male Weight" : "Male Height") :
|
||||
(weight ? "Female Weight" : "Female Height"), ColumnBase::Display_Float),
|
||||
mMale (male), mWeight (weight)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
const ESM::Race::MaleFemaleF& value =
|
||||
mWeight ? record.get().mData.mWeight : record.get().mData.mHeight;
|
||||
|
||||
return mMale ? value.mMale : value.mFemale;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
ESM::Race::MaleFemaleF& value =
|
||||
mWeight ? record2.mData.mWeight : record2.mData.mHeight;
|
||||
|
||||
(mMale ? value.mMale : value.mFemale) = data.toFloat();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -66,11 +66,23 @@ CSMWorld::Data::Data()
|
|||
for (int i=0; i<6; ++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>);
|
||||
mRaces.addColumn (new FlagColumn<ESM::Race> ("Playable", 0x1));
|
||||
mRaces.addColumn (new FlagColumn<ESM::Race> ("Beast Race", 0x2));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (true, true));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (true, false));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (false, true));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (false, false));
|
||||
|
||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
||||
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);
|
||||
addModel (new IdTable (&mSkills), UniversalId::Type_Skills, UniversalId::Type_Skill);
|
||||
addModel (new IdTable (&mClasses), UniversalId::Type_Classes, UniversalId::Type_Class);
|
||||
addModel (new IdTable (&mFactions), UniversalId::Type_Factions, UniversalId::Type_Faction);
|
||||
addModel (new IdTable (&mRaces), UniversalId::Type_Races, UniversalId::Type_Race);
|
||||
}
|
||||
|
||||
CSMWorld::Data::~Data()
|
||||
|
@ -129,6 +141,16 @@ CSMWorld::IdCollection<ESM::Faction>& CSMWorld::Data::getFactions()
|
|||
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)
|
||||
{
|
||||
std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType());
|
||||
|
@ -168,6 +190,7 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
|||
case ESM::REC_SKIL: mSkills.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_RACE: mRaces.load (reader, base); break;
|
||||
|
||||
default:
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <components/esm/loadskil.hpp>
|
||||
#include <components/esm/loadclas.hpp>
|
||||
#include <components/esm/loadfact.hpp>
|
||||
#include <components/esm/loadrace.hpp>
|
||||
|
||||
#include "idcollection.hpp"
|
||||
#include "universalid.hpp"
|
||||
|
@ -26,6 +27,7 @@ namespace CSMWorld
|
|||
IdCollection<ESM::Skill> mSkills;
|
||||
IdCollection<ESM::Class> mClasses;
|
||||
IdCollection<ESM::Faction> mFactions;
|
||||
IdCollection<ESM::Race> mRaces;
|
||||
std::vector<QAbstractItemModel *> mModels;
|
||||
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
||||
|
||||
|
@ -62,6 +64,10 @@ namespace CSMWorld
|
|||
|
||||
IdCollection<ESM::Faction>& getFactions();
|
||||
|
||||
const IdCollection<ESM::Race>& getRaces() const;
|
||||
|
||||
IdCollection<ESM::Race>& getRaces();
|
||||
|
||||
QAbstractItemModel *getTableModel (const UniversalId& id);
|
||||
///< 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_Classes, "Classes" },
|
||||
{ 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
|
||||
};
|
||||
|
@ -33,6 +34,7 @@ namespace
|
|||
{ 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_Faction, "Faction" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Race, "Race" },
|
||||
|
||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
||||
};
|
||||
|
@ -53,44 +55,41 @@ CSMWorld::UniversalId::UniversalId (const std::string& universalId)
|
|||
{
|
||||
std::string type = universalId.substr (0, index);
|
||||
|
||||
if (index==std::string::npos)
|
||||
{
|
||||
for (int i=0; sNoArg[i].mName; ++i)
|
||||
if (type==sNoArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_None;
|
||||
mType = sNoArg[i].mType;
|
||||
mClass = sNoArg[i].mClass;
|
||||
for (int i=0; sIdArg[i].mName; ++i)
|
||||
if (type==sIdArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Id;
|
||||
mType = sIdArg[i].mType;
|
||||
mClass = sIdArg[i].mClass;
|
||||
mId = universalId.substr (index+2);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i=0; sIndexArg[i].mName; ++i)
|
||||
if (type==sIndexArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Index;
|
||||
mType = sIndexArg[i].mType;
|
||||
mClass = sIndexArg[i].mClass;
|
||||
|
||||
std::istringstream stream (universalId.substr (index+2));
|
||||
|
||||
if (stream >> mIndex)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; sIdArg[i].mName; ++i)
|
||||
if (type==sIdArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Id;
|
||||
mType = sIdArg[i].mType;
|
||||
mClass = sIdArg[i].mClass;
|
||||
mId = universalId.substr (0, index);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i=0; sIndexArg[i].mName; ++i)
|
||||
if (type==sIndexArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Index;
|
||||
mType = sIndexArg[i].mType;
|
||||
mClass = sIndexArg[i].mClass;
|
||||
|
||||
std::istringstream stream (universalId.substr (0, index));
|
||||
|
||||
if (stream >> mIndex)
|
||||
return;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; sNoArg[i].mName; ++i)
|
||||
if (universalId==sNoArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_None;
|
||||
mType = sNoArg[i].mType;
|
||||
mClass = sNoArg[i].mClass;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error ("invalid UniversalId: " + universalId);
|
||||
|
|
|
@ -43,7 +43,9 @@ namespace CSMWorld
|
|||
Type_Classes,
|
||||
Type_Class,
|
||||
Type_Factions,
|
||||
Type_Faction
|
||||
Type_Faction,
|
||||
Type_Races,
|
||||
Type_Race
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -101,6 +101,10 @@ void CSVDoc::View::setupWorldMenu()
|
|||
QAction *factions = new QAction (tr ("Factions"), this);
|
||||
connect (factions, SIGNAL (triggered()), this, SLOT (addFactionsSubView()));
|
||||
world->addAction (factions);
|
||||
|
||||
QAction *races = new QAction (tr ("Races"), this);
|
||||
connect (races, SIGNAL (triggered()), this, SLOT (addRacesSubView()));
|
||||
world->addAction (races);
|
||||
}
|
||||
|
||||
void CSVDoc::View::setupUi()
|
||||
|
@ -271,6 +275,11 @@ void CSVDoc::View::addFactionsSubView()
|
|||
addSubView (CSMWorld::UniversalId::Type_Factions);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addRacesSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Races);
|
||||
}
|
||||
|
||||
void CSVDoc::View::abortOperation (int type)
|
||||
{
|
||||
mDocument->abortOperation (type);
|
||||
|
|
|
@ -121,6 +121,8 @@ namespace CSVDoc
|
|||
void addClassesSubView();
|
||||
|
||||
void addFactionsSubView();
|
||||
|
||||
void addRacesSubView();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
CSMWorld::UniversalId::Type_Globals,
|
||||
CSMWorld::UniversalId::Type_Classes,
|
||||
CSMWorld::UniversalId::Type_Factions,
|
||||
CSMWorld::UniversalId::Type_Races,
|
||||
|
||||
CSMWorld::UniversalId::Type_None // end marker
|
||||
};
|
||||
|
|
|
@ -53,21 +53,9 @@ namespace MWMechanics
|
|||
|
||||
for (int i=0; i<8; ++i)
|
||||
{
|
||||
const ESM::Race::MaleFemale *attribute = 0;
|
||||
switch (i)
|
||||
{
|
||||
case 0: attribute = &race->mData.mStrength; break;
|
||||
case 1: attribute = &race->mData.mIntelligence; break;
|
||||
case 2: attribute = &race->mData.mWillpower; break;
|
||||
case 3: attribute = &race->mData.mAgility; break;
|
||||
case 4: attribute = &race->mData.mSpeed; break;
|
||||
case 5: attribute = &race->mData.mEndurance; break;
|
||||
case 6: attribute = &race->mData.mPersonality; break;
|
||||
case 7: attribute = &race->mData.mLuck; break;
|
||||
}
|
||||
const ESM::Race::MaleFemale& attribute = race->mData.mAttributeValues[i];
|
||||
|
||||
creatureStats.getAttribute(i).setBase (
|
||||
static_cast<int> (male ? attribute->mMale : attribute->mFemale));
|
||||
creatureStats.getAttribute(i).setBase (male ? attribute.mMale : attribute.mFemale);
|
||||
}
|
||||
|
||||
for (int i=0; i<27; ++i)
|
||||
|
|
|
@ -5,6 +5,15 @@
|
|||
|
||||
namespace ESM
|
||||
{
|
||||
int Race::MaleFemale::getValue (bool male) const
|
||||
{
|
||||
return male ? mMale : mFemale;
|
||||
}
|
||||
|
||||
int Race::MaleFemaleF::getValue (bool male) const
|
||||
{
|
||||
return male ? mMale : mFemale;
|
||||
}
|
||||
|
||||
void Race::load(ESMReader &esm)
|
||||
{
|
||||
|
@ -21,4 +30,25 @@ void Race::save(ESMWriter &esm)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,15 @@ struct Race
|
|||
struct MaleFemale
|
||||
{
|
||||
int mMale, mFemale;
|
||||
|
||||
int getValue (bool male) const;
|
||||
};
|
||||
|
||||
struct MaleFemaleF
|
||||
{
|
||||
float mMale, mFemale;
|
||||
|
||||
int getValue (bool male) const;
|
||||
};
|
||||
|
||||
enum Flags
|
||||
|
@ -45,14 +49,7 @@ struct Race
|
|||
SkillBonus mBonus[7];
|
||||
|
||||
// Attribute values for male/female
|
||||
MaleFemale mStrength,
|
||||
mIntelligence,
|
||||
mWillpower,
|
||||
mAgility,
|
||||
mSpeed,
|
||||
mEndurance,
|
||||
mPersonality,
|
||||
mLuck;
|
||||
MaleFemale mAttributeValues[8];
|
||||
|
||||
// The actual eye level height (in game units) is (probably) given
|
||||
// as 'height' times 128. This has not been tested yet.
|
||||
|
@ -69,6 +66,9 @@ struct Race
|
|||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID/index).
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue