Use default initializers for ESM::RefNum members

Instead of unset function that is removed now and assignments all over the code.
7220-lua-add-a-general-purpose-lexical-parser
elsid 2 years ago
parent 42a3b3ca49
commit c173348cbe
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -11,7 +11,7 @@ namespace ESSImport
{
out.mId = ESM::RefId::stringRefId(scpt.mSCHD.mName.toString());
out.mRunning = scpt.mRunning;
out.mTargetRef.unset(); // TODO: convert target reference of global script
out.mTargetRef = ESM::RefNum{}; // TODO: convert target reference of global script
convertSCRI(scpt.mSCRI, out.mLocals);
}

@ -19,7 +19,6 @@ namespace ESSImport
item.mCount = contItem.mCount;
item.mRelativeEquipmentSlot = -1;
item.mLockLevel = 0;
item.mRefNum.unset();
unsigned int itemCount = std::abs(item.mCount);
bool separateStacks = false;

@ -56,7 +56,6 @@ void CSMWorld::RefCollection::load(ESM::ESMReader& reader, int cellIndex, bool b
CellRef ref;
ref.mNew = false;
ESM::MovedCellRef mref;
mref.mRefNum.mIndex = 0;
bool isDeleted = false;
bool isMoved = false;

@ -52,8 +52,8 @@ namespace MWLua
void saveEvents(ESM::ESMWriter& esm, const GlobalEventQueue& globalEvents, const LocalEventQueue& localEvents)
{
ObjectId globalId;
globalId.unset(); // Used as a marker of a global event.
// Used as a marker of a global event.
constexpr ObjectId globalId;
for (const GlobalEvent& e : globalEvents)
saveEvent(esm, globalId, e);

@ -149,7 +149,6 @@ namespace MWMechanics
params.mEffects = mEffects;
params.mDisplayName = mDisplayName;
params.mCasterActorId = mCasterActorId;
params.mItem.unset();
if (mSlot)
{
// Note that we're storing the inventory slot as a RefNum instead of an int as a matter of future proofing

@ -211,7 +211,6 @@ namespace MWRender
const ESM::ReadersCache::BusyItem reader = readers.get(index);
cell.restore(*reader, i);
ESM::CellRef ref;
ref.mRefNum.unset();
bool deleted = false;
while (cell.getNextRef(*reader, ref, deleted))
{

@ -494,9 +494,7 @@ namespace MWRender
const ESM::ReadersCache::BusyItem reader = readers.get(index);
cell->restore(*reader, i);
ESM::CellRef ref;
ref.mRefNum.unset();
ESM::MovedCellRef cMRef;
cMRef.mRefNum.mIndex = 0;
bool deleted = false;
bool moved = false;
while (ESM::Cell::getNextRef(

@ -94,7 +94,6 @@ namespace MWRender
RefnumMarker()
: mNumVertices(0)
{
mRefnum.unset();
}
RefnumMarker(const RefnumMarker& copy, osg::CopyOp co)
: mRefnum(copy.mRefnum)

@ -1078,7 +1078,6 @@ namespace MWRender
{
RenderingManager::RayResult result;
result.mHit = false;
result.mHitRefnum.unset();
result.mRatio = 0;
if (intersector->containsIntersections())
{

@ -22,7 +22,6 @@ namespace
ESM::GlobalScript operator()(const MWWorld::Ptr& ptr) const
{
ESM::GlobalScript script;
script.mTargetRef.unset();
script.mRunning = false;
if (!ptr.isEmpty())
{

@ -30,7 +30,7 @@ namespace MWWorld
void CellRef::unsetRefNum()
{
mCellRef.mRefNum.unset();
mCellRef.mRefNum = ESM::RefNum{};
}
void CellRef::setScale(float scale)

@ -693,7 +693,6 @@ namespace MWWorld
// Get each reference in turn
ESM::MovedCellRef cMRef;
cMRef.mRefNum.mIndex = 0;
bool deleted = false;
bool moved = false;
while (ESM::Cell::getNextRef(
@ -750,11 +749,8 @@ namespace MWWorld
mCell->restore(*reader, i);
ESM::CellRef ref;
ref.mRefNum.unset();
// Get each reference in turn
ESM::MovedCellRef cMRef;
cMRef.mRefNum.mIndex = 0;
bool deleted = false;
bool moved = false;
while (ESM::Cell::getNextRef(

@ -49,7 +49,6 @@ namespace
const ESM::ReadersCache::BusyItem reader = readers.get(index);
cell.restore(*reader, i);
ESM::CellRef ref;
ref.mRefNum.unset();
bool deleted = false;
while (cell.getNextRef(*reader, ref, deleted))
{

@ -62,7 +62,6 @@ namespace MWWorld
ESM::ActiveSpells::ActiveSpellParams params;
params.mId = id;
params.mDisplayName = spell->mName;
params.mItem.unset();
params.mCasterActorId = creatureStats.mActorId;
if (spell->mData.mType == ESM::Spell::ST_Ability)
params.mType = ESM::ActiveSpells::Type_Ability;

@ -89,7 +89,7 @@ void MWWorld::WorldModel::clear()
{
mPtrIndex.clear();
mPtrIndexUpdateCounter = 0;
mLastGeneratedRefnum.unset();
mLastGeneratedRefnum = ESM::RefNum{};
mInteriors.clear();
mExteriors.clear();
std::fill(mIdCache.begin(), mIdCache.end(), std::make_pair(ESM::RefId::sEmpty, (MWWorld::CellStore*)nullptr));
@ -155,7 +155,6 @@ MWWorld::WorldModel::WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCach
, mIdCacheIndex(0)
, mPtrIndexUpdateCounter(0)
{
mLastGeneratedRefnum.unset();
int cacheSize = std::clamp(Settings::Manager::getInt("pointers cache size", "Cells"), 40, 1000);
mIdCache = IdCache(cacheSize, std::pair<ESM::RefId, CellStore*>(ESM::RefId::sEmpty, (CellStore*)nullptr));
}

@ -50,7 +50,6 @@ namespace ESM
params.mId = esm.getRefId();
esm.getHNT(params.mCasterActorId, "CAST");
params.mDisplayName = esm.getHNString("DISP");
params.mItem.unset();
if (format < 17)
params.mType = ActiveSpells::Type_Temporary;
else

@ -258,7 +258,7 @@ namespace ESM
void CellRef::blank()
{
mRefNum.unset();
mRefNum = RefNum{};
mRefID = ESM::RefId::sEmpty;
mScale = 1;
mOwner = ESM::RefId::sEmpty;

@ -17,8 +17,8 @@ namespace ESM
struct RefNum
{
unsigned int mIndex;
int mContentFile;
unsigned int mIndex = 0;
int mContentFile = -1;
void load(ESMReader& esm, bool wide = false, NAME tag = "FRMR");
@ -27,7 +27,6 @@ namespace ESM
inline bool hasContentFile() const { return mContentFile >= 0; }
inline bool isSet() const { return mIndex != 0 || mContentFile != -1; }
inline void unset() { *this = { 0, -1 }; }
};
/* Cell reference. This represents ONE object (of many) inside the

@ -15,7 +15,7 @@ namespace ESM
mRunning = 0;
esm.getHNOT(mRunning, "RUN_");
mTargetRef.unset();
mTargetRef = RefNum{};
mTargetId = ESM::RefId::stringRefId(esm.getHNOString("TARG"));
if (esm.peekNextSub("FRMR"))
mTargetRef.load(esm, true, "FRMR");

Loading…
Cancel
Save