mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 08:15:37 +00:00
Remove redundant mPersistent member from ESM::NPC and ESM::Creature, replaced by mRecordFlags. Fixed the editing of the persistence flag value.
This commit is contained in:
parent
2a76634f5f
commit
f2a301653c
11 changed files with 8 additions and 30 deletions
|
@ -294,7 +294,6 @@ namespace CSMWorld
|
|||
{ ColumnId_NpcReputation, "Reputation" },
|
||||
{ ColumnId_NpcRank, "NPC Rank" },
|
||||
{ ColumnId_Gold, "Gold" },
|
||||
{ ColumnId_NpcPersistence, "Persistent" },
|
||||
|
||||
{ ColumnId_RaceAttributes, "Race Attributes" },
|
||||
{ ColumnId_Male, "Male" },
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace CSMWorld
|
|||
ColumnId_NpcReputation = 258,
|
||||
ColumnId_NpcRank = 259,
|
||||
ColumnId_Gold = 260,
|
||||
ColumnId_NpcPersistence = 261,
|
||||
// unused
|
||||
|
||||
ColumnId_RaceAttributes = 262,
|
||||
ColumnId_Male = 263,
|
||||
|
|
|
@ -1108,7 +1108,6 @@ QVariant CSMWorld::NpcMiscRefIdAdapter::getNestedData (const RefIdColumn *column
|
|||
case 5: return static_cast<int>(record.get().mNpdt.mReputation);
|
||||
case 6: return static_cast<int>(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
|
||||
|
@ -1122,7 +1121,6 @@ QVariant CSMWorld::NpcMiscRefIdAdapter::getNestedData (const RefIdColumn *column
|
|||
case 5: return static_cast<int>(record.get().mNpdt.mReputation);
|
||||
case 6: return static_cast<int>(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?
|
||||
}
|
||||
}
|
||||
|
@ -1147,7 +1145,6 @@ void CSMWorld::NpcMiscRefIdAdapter::setNestedData (const RefIdColumn *column,
|
|||
case 5: npc.mNpdt.mReputation = static_cast<signed char>(value.toInt()); break;
|
||||
case 6: npc.mNpdt.mRank = static_cast<signed char>(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
|
||||
|
@ -1161,7 +1158,6 @@ void CSMWorld::NpcMiscRefIdAdapter::setNestedData (const RefIdColumn *column,
|
|||
case 5: npc.mNpdt.mReputation = static_cast<signed char>(value.toInt()); break;
|
||||
case 6: npc.mNpdt.mRank = static_cast<signed char>(value.toInt()); break;
|
||||
case 7: npc.mNpdt.mGold = value.toInt(); break;
|
||||
case 8: npc.mPersistent = value.toBool(); break;
|
||||
default: return; // throw an exception here?
|
||||
}
|
||||
|
||||
|
|
|
@ -153,10 +153,7 @@ namespace CSMWorld
|
|||
return QString::fromUtf8 (record.get().mModel.c_str());
|
||||
|
||||
if (column==mModel.mPersistence)
|
||||
{
|
||||
bool isPersistent = (record.get().mRecordFlags & 0x00000400) != 0;
|
||||
return QString::fromUtf8 (isPersistent ? "Yes" : "No");
|
||||
}
|
||||
return (record.get().mRecordFlags & 0x00000400) != 0;
|
||||
|
||||
return BaseRefIdAdapter<RecordT>::getData (column, data, index);
|
||||
}
|
||||
|
@ -173,14 +170,10 @@ namespace CSMWorld
|
|||
record2.mModel = value.toString().toUtf8().constData();
|
||||
else if (column==mModel.mPersistence)
|
||||
{
|
||||
unsigned int flag = record2.mRecordFlags;
|
||||
std::string val = value.toString().toUtf8().constData();
|
||||
if (val == "Yes")
|
||||
flag |= 0x00000400;
|
||||
else if (val == "No")
|
||||
flag &= ~0x00000400;
|
||||
|
||||
record2.mRecordFlags = flag;
|
||||
if (value.toInt() != 0)
|
||||
record2.mRecordFlags |= 0x00000400;
|
||||
else
|
||||
record2.mRecordFlags &= ~0x00000400;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -551,8 +551,6 @@ CSMWorld::RefIdCollection::RefIdCollection()
|
|||
new RefIdColumn (Columns::ColumnId_NpcRank, CSMWorld::ColumnBase::Display_UnsignedInteger8));
|
||||
mColumns.back().addColumn(
|
||||
new RefIdColumn (Columns::ColumnId_Gold, CSMWorld::ColumnBase::Display_Integer));
|
||||
mColumns.back().addColumn(
|
||||
new RefIdColumn (Columns::ColumnId_NpcPersistence, CSMWorld::ColumnBase::Display_Boolean));
|
||||
|
||||
WeaponColumns weaponColumns (enchantableColumns);
|
||||
|
||||
|
|
|
@ -588,7 +588,7 @@ namespace MWClass
|
|||
bool Creature::isPersistent(const MWWorld::ConstPtr &actor) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Creature>* ref = actor.get<ESM::Creature>();
|
||||
return ref->mBase->mPersistent;
|
||||
return (ref->mBase->mRecordFlags & 0x0400) != 0;
|
||||
}
|
||||
|
||||
std::string Creature::getSoundIdFromSndGen(const MWWorld::Ptr &ptr, const std::string &name) const
|
||||
|
|
|
@ -403,7 +403,7 @@ namespace MWClass
|
|||
bool Npc::isPersistent(const MWWorld::ConstPtr &actor) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::NPC>* ref = actor.get<ESM::NPC>();
|
||||
return ref->mBase->mPersistent;
|
||||
return (ref->mBase->mRecordFlags & 0x0400) != 0;
|
||||
}
|
||||
|
||||
std::string Npc::getModel(const MWWorld::ConstPtr &ptr) const
|
||||
|
|
|
@ -15,8 +15,6 @@ namespace ESM {
|
|||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mPersistent = (mRecordFlags & 0x0400) != 0;
|
||||
|
||||
mAiPackage.mList.clear();
|
||||
mInventory.mList.clear();
|
||||
mSpells.mList.clear();
|
||||
|
|
|
@ -76,8 +76,6 @@ struct Creature
|
|||
int mBloodType;
|
||||
unsigned char mFlags;
|
||||
|
||||
bool mPersistent;
|
||||
|
||||
float mScale;
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
|
|
|
@ -13,8 +13,6 @@ namespace ESM
|
|||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mPersistent = (mRecordFlags & 0x0400) != 0;
|
||||
|
||||
mSpells.mList.clear();
|
||||
mInventory.mList.clear();
|
||||
mTransport.mList.clear();
|
||||
|
|
|
@ -116,8 +116,6 @@ struct NPC
|
|||
int mBloodType;
|
||||
unsigned char mFlags;
|
||||
|
||||
bool mPersistent;
|
||||
|
||||
InventoryList mInventory;
|
||||
SpellList mSpells;
|
||||
|
||||
|
|
Loading…
Reference in a new issue