diff --git a/apps/esmtool/record.cpp b/apps/esmtool/record.cpp index bcf16091f..e4ada7d18 100644 --- a/apps/esmtool/record.cpp +++ b/apps/esmtool/record.cpp @@ -682,13 +682,11 @@ void Record::print() { std::cout << " Name: " << mData.mName << std::endl; 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.mAttribute[0]) << " (" << mData.mData.mAttribute[0] << ")" << std::endl; std::cout << " Attribute2: " << attributeLabel(mData.mData.mAttribute[1]) << " (" << mData.mData.mAttribute[1] << ")" << std::endl; - for (int i = 0; i != 6; i++) + for (int i = 0; i < 7; i++) if (mData.mData.mSkills[i] != -1) std::cout << " Skill: " << skillLabel(mData.mData.mSkills[i]) << " (" << mData.mData.mSkills[i] << ")" << std::endl; diff --git a/apps/opencs/model/tools/factioncheck.cpp b/apps/opencs/model/tools/factioncheck.cpp index 42d577163..ba8cfe1f9 100644 --- a/apps/opencs/model/tools/factioncheck.cpp +++ b/apps/opencs/model/tools/factioncheck.cpp @@ -42,7 +42,7 @@ void CSMTools::FactionCheckStage::perform (int stage, Messages& messages) // test for non-unique skill std::map skills; // ID, number of occurrences - for (int i=0; i<6; ++i) + for (int i=0; i<7; ++i) if (faction.mData.mSkills[i]!=-1) ++skills[faction.mData.mSkills[i]]; @@ -54,4 +54,4 @@ void CSMTools::FactionCheckStage::perform (int stage, Messages& messages) } /// \todo check data members that can't be edited in the table view -} \ No newline at end of file +} diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 7f2eac20d..0319d71ac 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -102,7 +102,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding) mFactions.addColumn (new AttributesColumn (0)); mFactions.addColumn (new AttributesColumn (1)); mFactions.addColumn (new HiddenColumn); - for (int i=0; i<6; ++i) + for (int i=0; i<7; ++i) mFactions.addColumn (new SkillsColumn (i)); mRaces.addColumn (new StringIdColumn); @@ -742,4 +742,4 @@ void CSMWorld::Data::dataChanged (const QModelIndex& topLeft, const QModelIndex& void CSMWorld::Data::rowsChanged (const QModelIndex& parent, int start, int end) { emit idListChanged(); -} \ No newline at end of file +} diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index 246ade7bf..b4bd0d738 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -504,11 +504,18 @@ namespace MWGui text += "\n\n#DDC79E#{sFavoriteSkills}"; text += "\n#BF9959"; - for (int i=0; i<6; ++i) + bool firstSkill = true; + for (int i=0; i<7; ++i) { - text += "#{"+ESM::Skill::sSkillNameIds[faction->mData.mSkills[i]]+"}"; - if (i<5) - text += ", "; + if (faction->mData.mSkills[i] != -1) + { + if (!firstSkill) + text += ", "; + + firstSkill = false; + + text += "#{"+ESM::Skill::sSkillNameIds[faction->mData.mSkills[i]]+"}"; + } } text += "\n"; diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index d50f2c5ae..642e1cfe1 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -361,8 +361,14 @@ bool MWMechanics::NpcStats::hasSkillsForRank (const std::string& factionId, int std::vector skills; - for (int i=0; i<6; ++i) - skills.push_back (static_cast (getSkill (faction.mData.mSkills[i]).getModified())); + for (int i=0; i<7; ++i) + { + if (faction.mData.mSkills[i] != -1) + skills.push_back (static_cast (getSkill (faction.mData.mSkills[i]).getModified())); + } + + if (skills.empty()) + return true; std::sort (skills.begin(), skills.end()); @@ -373,6 +379,9 @@ bool MWMechanics::NpcStats::hasSkillsForRank (const std::string& factionId, int if (*iter=rankData.mSkill2; } diff --git a/components/esm/loadfact.cpp b/components/esm/loadfact.cpp index 0924efb17..db7e5b7b4 100644 --- a/components/esm/loadfact.cpp +++ b/components/esm/loadfact.cpp @@ -12,7 +12,7 @@ namespace ESM int& Faction::FADTstruct::getSkill (int index, bool ignored) { - if (index<0 || index>=6) + if (index<0 || index>=7) throw std::logic_error ("skill index out of range"); return mSkills[index]; @@ -20,7 +20,7 @@ namespace ESM int Faction::FADTstruct::getSkill (int index, bool ignored) const { - if (index<0 || index>=6) + if (index<0 || index>=7) throw std::logic_error ("skill index out of range"); return mSkills[index]; @@ -75,7 +75,6 @@ void Faction::save(ESMWriter &esm) const { mName.clear(); mData.mAttribute[0] = mData.mAttribute[1] = 0; - mData.mUnknown = -1; mData.mIsHidden = 0; for (int i=0; i<10; ++i) @@ -87,7 +86,7 @@ void Faction::save(ESMWriter &esm) const mRanks[i].clear(); } - for (int i=0; i<6; ++i) + for (int i=0; i<7; ++i) mData.mSkills[i] = 0; mReactions.clear(); diff --git a/components/esm/loadfact.hpp b/components/esm/loadfact.hpp index 75e30a5bf..d31670fe2 100644 --- a/components/esm/loadfact.hpp +++ b/components/esm/loadfact.hpp @@ -40,8 +40,9 @@ struct Faction RankData mRankData[10]; - int mSkills[6]; // IDs of skills this faction require - int mUnknown; // Always -1? + int mSkills[7]; // IDs of skills this faction require + // Each element will either contain an ESM::Skill index, or -1. + int mIsHidden; // 1 - hidden from player int& getSkill (int index, bool ignored = false);