mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 19:15:41 +00:00
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<>
|
||||
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.
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue