From 737aa1e4e8886e5def0664888398e61a40a257fd Mon Sep 17 00:00:00 2001 From: Assumeru Date: Wed, 18 Dec 2019 18:42:54 +0100 Subject: [PATCH] Remove FactionID editing from OpenCS (#2636) * Remove FactionID editing * remove useless comments * rename FactionID to Unknown --- apps/esmtool/record.cpp | 9 ---- apps/opencs/model/world/columns.cpp | 4 -- apps/opencs/model/world/columns.hpp | 3 -- apps/opencs/model/world/refidadapterimp.cpp | 58 ++++++++++----------- apps/opencs/model/world/refidcollection.cpp | 2 - components/esm/loadnpc.cpp | 4 +- components/esm/loadnpc.hpp | 4 +- 7 files changed, 31 insertions(+), 53 deletions(-) diff --git a/apps/esmtool/record.cpp b/apps/esmtool/record.cpp index e8f4444894..5ffe76c4aa 100644 --- a/apps/esmtool/record.cpp +++ b/apps/esmtool/record.cpp @@ -1032,14 +1032,6 @@ void Record::print() std::cout << " Reputation: " << (int)mData.mNpdt.mReputation << std::endl; std::cout << " Disposition: " << (int)mData.mNpdt.mDisposition << std::endl; std::cout << " Rank: " << (int)mData.mNpdt.mRank << std::endl; - //Why do we want to print these fields? They are padding in the struct and contain - // nothing of real value. Now we don't deal with NPDTstruct12 in runtime either... - //std::cout << " Unknown1: " - // << (unsigned int)((unsigned char)mData.mNpdt12.mUnknown1) << std::endl; - //std::cout << " Unknown2: " - // << (unsigned int)((unsigned char)mData.mNpdt12.mUnknown2) << std::endl; - //std::cout << " Unknown3: " - // << (unsigned int)((unsigned char)mData.mNpdt12.mUnknown3) << std::endl; std::cout << " Gold: " << mData.mNpdt.mGold << std::endl; } else { @@ -1047,7 +1039,6 @@ void Record::print() std::cout << " Reputation: " << (int)mData.mNpdt.mReputation << std::endl; std::cout << " Disposition: " << (int)mData.mNpdt.mDisposition << std::endl; std::cout << " Rank: " << (int)mData.mNpdt.mRank << std::endl; - std::cout << " FactionID: " << (int)mData.mNpdt.mFactionID << std::endl; std::cout << " Attributes:" << std::endl; std::cout << " Strength: " << (int)mData.mNpdt.mStrength << std::endl; diff --git a/apps/opencs/model/world/columns.cpp b/apps/opencs/model/world/columns.cpp index 5dda789196..e2c3be789f 100644 --- a/apps/opencs/model/world/columns.cpp +++ b/apps/opencs/model/world/columns.cpp @@ -236,7 +236,6 @@ namespace CSMWorld { ColumnId_FactionReactions, "Reactions" }, { ColumnId_FactionRanks, "Ranks" }, - //{ ColumnId_FactionID, "Faction ID" }, { ColumnId_FactionReaction, "Reaction" }, { ColumnId_FactionAttrib1, "Attrib 1" }, @@ -248,7 +247,6 @@ namespace CSMWorld { ColumnId_EffectList, "Effects" }, { ColumnId_EffectId, "Effect" }, - //{ ColumnId_EffectAttribute, "Attrib" }, { ColumnId_EffectRange, "Range" }, { ColumnId_EffectArea, "Area" }, @@ -257,7 +255,6 @@ namespace CSMWorld { ColumnId_AiWanderDist, "Wander Dist" }, { ColumnId_AiDuration, "Ai Duration" }, { ColumnId_AiWanderToD, "Wander ToD" }, - //{ ColumnId_AiWanderIdle, "Wander Idle" }, { ColumnId_AiWanderRepeat, "Wander Repeat" }, { ColumnId_AiActivateName, "Activate" }, { ColumnId_AiTargetId, "Target ID" }, @@ -291,7 +288,6 @@ namespace CSMWorld { ColumnId_UChar, "Value [0..255]" }, { ColumnId_NpcMisc, "NPC Misc" }, { ColumnId_Level, "Level" }, - { ColumnId_NpcFactionID, "Faction ID" }, { ColumnId_GenderNpc, "Gender"}, { ColumnId_Mana, "Mana" }, { ColumnId_Fatigue, "Fatigue" }, diff --git a/apps/opencs/model/world/columns.hpp b/apps/opencs/model/world/columns.hpp index 3430a48376..085e6e178c 100644 --- a/apps/opencs/model/world/columns.hpp +++ b/apps/opencs/model/world/columns.hpp @@ -225,12 +225,10 @@ namespace CSMWorld ColumnId_SoundChance = 210, ColumnId_FactionReactions = 211, - //ColumnId_FactionID = 212, ColumnId_FactionReaction = 213, ColumnId_EffectList = 214, ColumnId_EffectId = 215, - //ColumnId_EffectAttribute = 216, ColumnId_EffectRange = 217, ColumnId_EffectArea = 218, @@ -275,7 +273,6 @@ namespace CSMWorld ColumnId_UChar = 250, ColumnId_NpcMisc = 251, ColumnId_Level = 252, - ColumnId_NpcFactionID = 253, ColumnId_GenderNpc = 254, ColumnId_Mana = 255, ColumnId_Fatigue = 256, diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index 3c9faa211d..d85fcc068f 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -1096,27 +1096,25 @@ QVariant CSMWorld::NpcMiscRefIdAdapter::getNestedData (const RefIdColumn *column case 1: return QVariant(QVariant::UserType); case 2: return QVariant(QVariant::UserType); case 3: return QVariant(QVariant::UserType); - case 4: return QVariant(QVariant::UserType); - case 5: return static_cast(record.get().mNpdt.mDisposition); - case 6: return static_cast(record.get().mNpdt.mReputation); - case 7: return static_cast(record.get().mNpdt.mRank); - case 8: return record.get().mNpdt.mGold; - case 9: return record.get().mPersistent == true; + case 4: return static_cast(record.get().mNpdt.mDisposition); + case 5: return static_cast(record.get().mNpdt.mReputation); + case 6: return static_cast(record.get().mNpdt.mRank); + case 7: return record.get().mNpdt.mGold; + case 8: return record.get().mPersistent == true; default: return QVariant(); // throw an exception here? } else switch (subColIndex) { case 0: return static_cast(record.get().mNpdt.mLevel); - case 1: return static_cast(record.get().mNpdt.mFactionID); - case 2: return static_cast(record.get().mNpdt.mHealth); - case 3: return static_cast(record.get().mNpdt.mMana); - case 4: return static_cast(record.get().mNpdt.mFatigue); - case 5: return static_cast(record.get().mNpdt.mDisposition); - case 6: return static_cast(record.get().mNpdt.mReputation); - case 7: return static_cast(record.get().mNpdt.mRank); - case 8: return record.get().mNpdt.mGold; - case 9: return record.get().mPersistent == true; + case 1: return static_cast(record.get().mNpdt.mHealth); + case 2: return static_cast(record.get().mNpdt.mMana); + case 3: return static_cast(record.get().mNpdt.mFatigue); + case 4: return static_cast(record.get().mNpdt.mDisposition); + case 5: return static_cast(record.get().mNpdt.mReputation); + case 6: return static_cast(record.get().mNpdt.mRank); + case 7: return record.get().mNpdt.mGold; + case 8: return record.get().mPersistent == true; default: return QVariant(); // throw an exception here? } } @@ -1137,27 +1135,25 @@ void CSMWorld::NpcMiscRefIdAdapter::setNestedData (const RefIdColumn *column, case 1: return; case 2: return; case 3: return; - case 4: return; - case 5: npc.mNpdt.mDisposition = static_cast(value.toInt()); break; - case 6: npc.mNpdt.mReputation = static_cast(value.toInt()); break; - case 7: npc.mNpdt.mRank = static_cast(value.toInt()); break; - case 8: npc.mNpdt.mGold = value.toInt(); break; - case 9: npc.mPersistent = value.toBool(); break; + case 4: npc.mNpdt.mDisposition = static_cast(value.toInt()); break; + case 5: npc.mNpdt.mReputation = static_cast(value.toInt()); break; + case 6: npc.mNpdt.mRank = static_cast(value.toInt()); break; + case 7: npc.mNpdt.mGold = value.toInt(); break; + case 8: npc.mPersistent = value.toBool(); break; default: return; // throw an exception here? } else switch(subColIndex) { case 0: npc.mNpdt.mLevel = static_cast(value.toInt()); break; - case 1: npc.mNpdt.mFactionID = static_cast(value.toInt()); break; - case 2: npc.mNpdt.mHealth = static_cast(value.toInt()); break; - case 3: npc.mNpdt.mMana = static_cast(value.toInt()); break; - case 4: npc.mNpdt.mFatigue = static_cast(value.toInt()); break; - case 5: npc.mNpdt.mDisposition = static_cast(value.toInt()); break; - case 6: npc.mNpdt.mReputation = static_cast(value.toInt()); break; - case 7: npc.mNpdt.mRank = static_cast(value.toInt()); break; - case 8: npc.mNpdt.mGold = value.toInt(); break; - case 9: npc.mPersistent = value.toBool(); break; + case 1: npc.mNpdt.mHealth = static_cast(value.toInt()); break; + case 2: npc.mNpdt.mMana = static_cast(value.toInt()); break; + case 3: npc.mNpdt.mFatigue = static_cast(value.toInt()); break; + case 4: npc.mNpdt.mDisposition = static_cast(value.toInt()); break; + case 5: npc.mNpdt.mReputation = static_cast(value.toInt()); break; + case 6: npc.mNpdt.mRank = static_cast(value.toInt()); break; + case 7: npc.mNpdt.mGold = value.toInt(); break; + case 8: npc.mPersistent = value.toBool(); break; default: return; // throw an exception here? } @@ -1166,7 +1162,7 @@ void CSMWorld::NpcMiscRefIdAdapter::setNestedData (const RefIdColumn *column, int CSMWorld::NpcMiscRefIdAdapter::getNestedColumnsCount(const RefIdColumn *column, const RefIdData& data) const { - return 10; // Level, FactionID, Health, Mana, Fatigue, Disposition, Reputation, Rank, Gold, Persist + return 9; // Level, Health, Mana, Fatigue, Disposition, Reputation, Rank, Gold, Persist } int CSMWorld::NpcMiscRefIdAdapter::getNestedRowsCount(const RefIdColumn *column, const RefIdData& data, int index) const diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp index 19d2900dad..ff146bb91a 100644 --- a/apps/opencs/model/world/refidcollection.cpp +++ b/apps/opencs/model/world/refidcollection.cpp @@ -535,8 +535,6 @@ CSMWorld::RefIdCollection::RefIdCollection() mNestedAdapters.push_back (std::make_pair(&mColumns.back(), miscMap)); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Level, CSMWorld::ColumnBase::Display_SignedInteger16)); - mColumns.back().addColumn( - new RefIdColumn (Columns::ColumnId_NpcFactionID, CSMWorld::ColumnBase::Display_SignedInteger8)); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Health, CSMWorld::ColumnBase::Display_UnsignedInteger16)); mColumns.back().addColumn( diff --git a/components/esm/loadnpc.cpp b/components/esm/loadnpc.cpp index b68aa63758..2bb0811ac9 100644 --- a/components/esm/loadnpc.cpp +++ b/components/esm/loadnpc.cpp @@ -216,9 +216,9 @@ namespace ESM mNpdt.mReputation = 0; mNpdt.mHealth = mNpdt.mMana = mNpdt.mFatigue = 0; mNpdt.mDisposition = 0; - mNpdt.mFactionID = 0; + mNpdt.mUnknown1 = 0; mNpdt.mRank = 0; - mNpdt.mUnknown = 0; + mNpdt.mUnknown2 = 0; mNpdt.mGold = 0; } diff --git a/components/esm/loadnpc.hpp b/components/esm/loadnpc.hpp index ac3f1a3437..687afeaf64 100644 --- a/components/esm/loadnpc.hpp +++ b/components/esm/loadnpc.hpp @@ -87,10 +87,10 @@ struct NPC // mSkill can grow up to 200, it must be unsigned unsigned char mSkills[Skill::Length]; - char mFactionID; + char mUnknown1; unsigned short mHealth, mMana, mFatigue; unsigned char mDisposition, mReputation, mRank; - char mUnknown; + char mUnknown2; int mGold; }; // 52 bytes