forked from teamnwah/openmw-tes3coop
cleaned up race record struct
This commit is contained in:
parent
62d70f17c8
commit
18e046e628
4 changed files with 34 additions and 64 deletions
|
@ -1099,53 +1099,29 @@ void Record<ESM::Pathgrid>::print()
|
||||||
template<>
|
template<>
|
||||||
void Record<ESM::Race>::print()
|
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 << " Name: " << mData.mName << std::endl;
|
||||||
std::cout << " Description: " << mData.mDescription << std::endl;
|
std::cout << " Description: " << mData.mDescription << std::endl;
|
||||||
std::cout << " Flags: " << raceFlags(mData.mData.mFlags) << std::endl;
|
std::cout << " Flags: " << raceFlags(mData.mData.mFlags) << std::endl;
|
||||||
|
|
||||||
std::cout << " Male:" << std::endl;
|
for (int i=0; i<2; ++i)
|
||||||
std::cout << " Strength: "
|
{
|
||||||
<< mData.mData.mStrength.mMale << std::endl;
|
bool male = i==0;
|
||||||
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;
|
|
||||||
|
|
||||||
std::cout << " Female:" << std::endl;
|
std::cout << (male ? " Male:" : " Female:") << std::endl;
|
||||||
std::cout << " Strength: "
|
|
||||||
<< mData.mData.mStrength.mFemale << std::endl;
|
for (int i=0; i<8; ++i)
|
||||||
std::cout << " Intelligence: "
|
std::cout << " " << sAttributeNames[i] << ": "
|
||||||
<< mData.mData.mIntelligence.mFemale << std::endl;
|
<< mData.mData.mAttributeValues[i].getValue (male) << std::endl;
|
||||||
std::cout << " Willpower: "
|
|
||||||
<< mData.mData.mWillpower.mFemale << std::endl;
|
std::cout << " Height: " << mData.mData.mHeight.getValue (male) << std::endl;
|
||||||
std::cout << " Agility: "
|
std::cout << " Weight: " << mData.mData.mWeight.getValue (male) << std::endl;
|
||||||
<< 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;
|
|
||||||
|
|
||||||
for (int i = 0; i != 7; i++)
|
for (int i = 0; i != 7; i++)
|
||||||
// Not all races have 7 skills.
|
// Not all races have 7 skills.
|
||||||
|
|
|
@ -53,21 +53,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
for (int i=0; i<8; ++i)
|
for (int i=0; i<8; ++i)
|
||||||
{
|
{
|
||||||
const ESM::Race::MaleFemale *attribute = 0;
|
const ESM::Race::MaleFemale& attribute = race->mData.mAttributeValues[i];
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
creatureStats.getAttribute(i).setBase (
|
creatureStats.getAttribute(i).setBase (male ? attribute.mMale : attribute.mFemale);
|
||||||
static_cast<int> (male ? attribute->mMale : attribute->mFemale));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<27; ++i)
|
for (int i=0; i<27; ++i)
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
|
|
||||||
namespace ESM
|
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)
|
void Race::load(ESMReader &esm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,11 +26,15 @@ struct Race
|
||||||
struct MaleFemale
|
struct MaleFemale
|
||||||
{
|
{
|
||||||
int mMale, mFemale;
|
int mMale, mFemale;
|
||||||
|
|
||||||
|
int getValue (bool male) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MaleFemaleF
|
struct MaleFemaleF
|
||||||
{
|
{
|
||||||
float mMale, mFemale;
|
float mMale, mFemale;
|
||||||
|
|
||||||
|
int getValue (bool male) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Flags
|
enum Flags
|
||||||
|
@ -45,14 +49,7 @@ struct Race
|
||||||
SkillBonus mBonus[7];
|
SkillBonus mBonus[7];
|
||||||
|
|
||||||
// Attribute values for male/female
|
// Attribute values for male/female
|
||||||
MaleFemale mStrength,
|
MaleFemale mAttributeValues[8];
|
||||||
mIntelligence,
|
|
||||||
mWillpower,
|
|
||||||
mAgility,
|
|
||||||
mSpeed,
|
|
||||||
mEndurance,
|
|
||||||
mPersonality,
|
|
||||||
mLuck;
|
|
||||||
|
|
||||||
// The actual eye level height (in game units) is (probably) given
|
// The actual eye level height (in game units) is (probably) given
|
||||||
// as 'height' times 128. This has not been tested yet.
|
// as 'height' times 128. This has not been tested yet.
|
||||||
|
|
Loading…
Reference in a new issue