mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 18:29:55 +00:00
adjusted faction record to increase consistency with other records
This commit is contained in:
parent
c71edb613d
commit
f9f520df34
8 changed files with 65 additions and 17 deletions
|
@ -679,14 +679,14 @@ void Record<ESM::Faction>::print()
|
|||
std::cout << " Hidden: " << mData.mData.mIsHidden << std::endl;
|
||||
if (mData.mData.mUnknown != -1)
|
||||
std::cout << " Unknown: " << mData.mData.mUnknown << std::endl;
|
||||
std::cout << " Attribute1: " << attributeLabel(mData.mData.mAttribute1)
|
||||
<< " (" << mData.mData.mAttribute1 << ")" << std::endl;
|
||||
std::cout << " Attribute2: " << attributeLabel(mData.mData.mAttribute2)
|
||||
<< " (" << mData.mData.mAttribute2 << ")" << std::endl;
|
||||
std::cout << " Attribute1: " << attributeLabel(mData.mData.mAttributes[0])
|
||||
<< " (" << mData.mData.mAttributes[0] << ")" << std::endl;
|
||||
std::cout << " Attribute2: " << attributeLabel(mData.mData.mAttributes[1])
|
||||
<< " (" << mData.mData.mAttributes[1] << ")" << std::endl;
|
||||
for (int i = 0; i != 6; i++)
|
||||
if (mData.mData.mSkillID[i] != -1)
|
||||
std::cout << " Skill: " << skillLabel(mData.mData.mSkillID[i])
|
||||
<< " (" << mData.mData.mSkillID[i] << ")" << std::endl;
|
||||
if (mData.mData.mSkills[i] != -1)
|
||||
std::cout << " Skill: " << skillLabel(mData.mData.mSkills[i])
|
||||
<< " (" << mData.mData.mSkills[i] << ")" << std::endl;
|
||||
for (int i = 0; i != 10; i++)
|
||||
if (mData.mRanks[i] != "")
|
||||
{
|
||||
|
|
|
@ -569,8 +569,8 @@ bool MWDialogue::Filter::hasFactionRankSkillRequirements (const MWWorld::Ptr& ac
|
|||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get (actor).getCreatureStats (actor);
|
||||
|
||||
return stats.getAttribute (faction.mData.mAttribute1).getBase()>=faction.mData.mRankData[rank].mAttribute1 &&
|
||||
stats.getAttribute (faction.mData.mAttribute2).getBase()>=faction.mData.mRankData[rank].mAttribute2;
|
||||
return stats.getAttribute (faction.mData.mAttributes[0]).getBase()>=faction.mData.mRankData[rank].mAttribute1 &&
|
||||
stats.getAttribute (faction.mData.mAttributes[1]).getBase()>=faction.mData.mRankData[rank].mAttribute2;
|
||||
}
|
||||
|
||||
bool MWDialogue::Filter::hasFactionRankReputationRequirements (const MWWorld::Ptr& actor,
|
||||
|
|
|
@ -500,8 +500,8 @@ void StatsWindow::updateSkillArea()
|
|||
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->mRanks[it->second+1];
|
||||
|
||||
ESM::RankData rankData = faction->mData.mRankData[it->second+1];
|
||||
const ESM::Attribute* attr1 = store.get<ESM::Attribute>().find(faction->mData.mAttribute1);
|
||||
const ESM::Attribute* attr2 = store.get<ESM::Attribute>().find(faction->mData.mAttribute2);
|
||||
const ESM::Attribute* attr1 = store.get<ESM::Attribute>().find(faction->mData.mAttributes[0]);
|
||||
const ESM::Attribute* attr2 = store.get<ESM::Attribute>().find(faction->mData.mAttributes[1]);
|
||||
assert(attr1 && attr2);
|
||||
|
||||
text += "\n#BF9959#{" + attr1->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute1)
|
||||
|
@ -511,7 +511,7 @@ void StatsWindow::updateSkillArea()
|
|||
text += "\n#BF9959";
|
||||
for (int i=0; i<6; ++i)
|
||||
{
|
||||
text += "#{"+ESM::Skill::sSkillNameIds[faction->mData.mSkillID[i]]+"}";
|
||||
text += "#{"+ESM::Skill::sSkillNameIds[faction->mData.mSkills[i]]+"}";
|
||||
if (i<5)
|
||||
text += ", ";
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ bool MWMechanics::NpcStats::hasSkillsForRank (const std::string& factionId, int
|
|||
std::vector<int> skills;
|
||||
|
||||
for (int i=0; i<6; ++i)
|
||||
skills.push_back (static_cast<int> (getSkill (faction.mData.mSkillID[i]).getModified()));
|
||||
skills.push_back (static_cast<int> (getSkill (faction.mData.mSkills[i]).getModified()));
|
||||
|
||||
std::sort (skills.begin(), skills.end());
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "loadclas.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
|
||||
|
@ -18,6 +20,23 @@ const char *Class::sGmstSpecializationIds[3] = {
|
|||
"sSpecializationStealth"
|
||||
};
|
||||
|
||||
|
||||
int& Class::CLDTstruct::getSkill (int index, bool major)
|
||||
{
|
||||
if (index<0 || index>=5)
|
||||
throw std::logic_error ("skill index out of range");
|
||||
|
||||
return mSkills[index][major ? 1 : 0];
|
||||
}
|
||||
|
||||
int Class::CLDTstruct::getSkill (int index, bool major) const
|
||||
{
|
||||
if (index<0 || index>=5)
|
||||
throw std::logic_error ("skill index out of range");
|
||||
|
||||
return mSkills[index][major ? 1 : 0];
|
||||
}
|
||||
|
||||
void Class::load(ESMReader &esm)
|
||||
{
|
||||
mName = esm.getHNString("FNAM");
|
||||
|
|
|
@ -58,6 +58,12 @@ struct Class
|
|||
|
||||
// I have no idea how to autocalculate these items...
|
||||
int mCalc;
|
||||
|
||||
int& getSkill (int index, bool major);
|
||||
///< Throws an exception for invalid values of \a index.
|
||||
|
||||
int getSkill (int index, bool major) const;
|
||||
///< Throws an exception for invalid values of \a index.
|
||||
}; // 60 bytes
|
||||
|
||||
std::string mId, mName, mDescription;
|
||||
|
|
|
@ -1,10 +1,27 @@
|
|||
#include "loadfact.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
int& Faction::FADTstruct::getSkill (int index, bool ignored)
|
||||
{
|
||||
if (index<0 || index>=6)
|
||||
throw std::logic_error ("skill index out of range");
|
||||
|
||||
return mSkills[index];
|
||||
}
|
||||
|
||||
int Faction::FADTstruct::getSkill (int index, bool ignored) const
|
||||
{
|
||||
if (index<0 || index>=6)
|
||||
throw std::logic_error ("skill index out of range");
|
||||
|
||||
return mSkills[index];
|
||||
}
|
||||
|
||||
void Faction::load(ESMReader &esm)
|
||||
{
|
||||
|
@ -54,7 +71,7 @@ void Faction::save(ESMWriter &esm)
|
|||
void Faction::blank()
|
||||
{
|
||||
mName.clear();
|
||||
mData.mAttribute1 = mData.mAttribute2 = 0;
|
||||
mData.mAttributes[0] = mData.mAttributes[1] = 0;
|
||||
mData.mUnknown = -1;
|
||||
mData.mIsHidden = 0;
|
||||
|
||||
|
@ -68,7 +85,7 @@ void Faction::save(ESMWriter &esm)
|
|||
}
|
||||
|
||||
for (int i=0; i<6; ++i)
|
||||
mData.mSkillID[i] = 0;
|
||||
mData.mSkills[i] = 0;
|
||||
|
||||
mReactions.clear();
|
||||
}
|
||||
|
|
|
@ -34,13 +34,19 @@ struct Faction
|
|||
struct FADTstruct
|
||||
{
|
||||
// Which attributes we like
|
||||
int mAttribute1, mAttribute2;
|
||||
int mAttributes[2];
|
||||
|
||||
RankData mRankData[10];
|
||||
|
||||
int mSkillID[6]; // IDs of skills this faction require
|
||||
int mSkills[6]; // IDs of skills this faction require
|
||||
int mUnknown; // Always -1?
|
||||
int mIsHidden; // 1 - hidden from player
|
||||
|
||||
int& getSkill (int index, bool ignored = false);
|
||||
///< Throws an exception for invalid values of \a index.
|
||||
|
||||
int getSkill (int index, bool ignored = false) const;
|
||||
///< Throws an exception for invalid values of \a index.
|
||||
}; // 240 bytes
|
||||
|
||||
FADTstruct mData;
|
||||
|
|
Loading…
Reference in a new issue