mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 12:53:51 +00:00
Load/read methods (for ESM records) accept a deleted flag in OpenMW
(cherry picked from commit 67c8f95c4e
)
Conflicts:
apps/openmw/mwworld/store.cpp
This commit is contained in:
parent
82363bf318
commit
0c002dd6de
4 changed files with 37 additions and 31 deletions
|
@ -22,7 +22,7 @@ namespace MWWorld
|
|||
/// and the build will fail with an ugly three-way cyclic header dependence
|
||||
/// so we need to pass the instantiation of the method to the linker, when
|
||||
/// all methods are known.
|
||||
void load (ESM::CellRef &ref, const MWWorld::ESMStore &esmStore);
|
||||
void load (ESM::CellRef &ref, bool deleted, const MWWorld::ESMStore &esmStore);
|
||||
|
||||
LiveRef *find (const std::string& name)
|
||||
{
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace MWWorld
|
|||
{
|
||||
|
||||
template <typename X>
|
||||
void CellRefList<X>::load(ESM::CellRef &ref, const MWWorld::ESMStore &esmStore)
|
||||
void CellRefList<X>::load(ESM::CellRef &ref, bool deleted, const MWWorld::ESMStore &esmStore)
|
||||
{
|
||||
const MWWorld::Store<X> &store = esmStore.get<X>();
|
||||
|
||||
|
@ -157,7 +157,7 @@ namespace MWWorld
|
|||
|
||||
LiveRef liveCellRef (ref, ptr);
|
||||
|
||||
if (ref.mIsDeleted)
|
||||
if (deleted)
|
||||
liveCellRef.mData.setDeleted(true);
|
||||
|
||||
if (iter != mList.end())
|
||||
|
@ -444,9 +444,10 @@ namespace MWWorld
|
|||
ESM::CellRef ref;
|
||||
|
||||
// Get each reference in turn
|
||||
while (mCell->getNextRef (esm[index], ref))
|
||||
bool deleted = false;
|
||||
while (mCell->getNextRef (esm[index], ref, deleted))
|
||||
{
|
||||
if (ref.mIsDeleted)
|
||||
if (deleted)
|
||||
continue;
|
||||
|
||||
// Don't list reference if it was moved to a different cell.
|
||||
|
@ -489,7 +490,8 @@ namespace MWWorld
|
|||
ref.mRefNum.mContentFile = ESM::RefNum::RefNum_NoContentFile;
|
||||
|
||||
// Get each reference in turn
|
||||
while(mCell->getNextRef(esm[index], ref))
|
||||
bool deleted = false;
|
||||
while(mCell->getNextRef(esm[index], ref, deleted))
|
||||
{
|
||||
// Don't load reference if it was moved to a different cell.
|
||||
ESM::MovedCellRefTracker::const_iterator iter =
|
||||
|
@ -498,7 +500,7 @@ namespace MWWorld
|
|||
continue;
|
||||
}
|
||||
|
||||
loadRef (ref, store);
|
||||
loadRef (ref, deleted, store);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +509,7 @@ namespace MWWorld
|
|||
{
|
||||
ESM::CellRef &ref = const_cast<ESM::CellRef&>(*it);
|
||||
|
||||
loadRef (ref, store);
|
||||
loadRef (ref, false, store);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,32 +538,32 @@ namespace MWWorld
|
|||
return Ptr();
|
||||
}
|
||||
|
||||
void CellStore::loadRef (ESM::CellRef& ref, const ESMStore& store)
|
||||
void CellStore::loadRef (ESM::CellRef& ref, bool deleted, const ESMStore& store)
|
||||
{
|
||||
Misc::StringUtils::toLower (ref.mRefID);
|
||||
|
||||
switch (store.find (ref.mRefID))
|
||||
{
|
||||
case ESM::REC_ACTI: mActivators.load(ref, store); break;
|
||||
case ESM::REC_ALCH: mPotions.load(ref,store); break;
|
||||
case ESM::REC_APPA: mAppas.load(ref, store); break;
|
||||
case ESM::REC_ARMO: mArmors.load(ref, store); break;
|
||||
case ESM::REC_BOOK: mBooks.load(ref, store); break;
|
||||
case ESM::REC_CLOT: mClothes.load(ref, store); break;
|
||||
case ESM::REC_CONT: mContainers.load(ref, store); break;
|
||||
case ESM::REC_CREA: mCreatures.load(ref, store); break;
|
||||
case ESM::REC_DOOR: mDoors.load(ref, store); break;
|
||||
case ESM::REC_INGR: mIngreds.load(ref, store); break;
|
||||
case ESM::REC_LEVC: mCreatureLists.load(ref, store); break;
|
||||
case ESM::REC_LEVI: mItemLists.load(ref, store); break;
|
||||
case ESM::REC_LIGH: mLights.load(ref, store); break;
|
||||
case ESM::REC_LOCK: mLockpicks.load(ref, store); break;
|
||||
case ESM::REC_MISC: mMiscItems.load(ref, store); break;
|
||||
case ESM::REC_NPC_: mNpcs.load(ref, store); break;
|
||||
case ESM::REC_PROB: mProbes.load(ref, store); break;
|
||||
case ESM::REC_REPA: mRepairs.load(ref, store); break;
|
||||
case ESM::REC_STAT: mStatics.load(ref, store); break;
|
||||
case ESM::REC_WEAP: mWeapons.load(ref, store); break;
|
||||
case ESM::REC_ACTI: mActivators.load(ref, deleted, store); break;
|
||||
case ESM::REC_ALCH: mPotions.load(ref, deleted,store); break;
|
||||
case ESM::REC_APPA: mAppas.load(ref, deleted, store); break;
|
||||
case ESM::REC_ARMO: mArmors.load(ref, deleted, store); break;
|
||||
case ESM::REC_BOOK: mBooks.load(ref, deleted, store); break;
|
||||
case ESM::REC_CLOT: mClothes.load(ref, deleted, store); break;
|
||||
case ESM::REC_CONT: mContainers.load(ref, deleted, store); break;
|
||||
case ESM::REC_CREA: mCreatures.load(ref, deleted, store); break;
|
||||
case ESM::REC_DOOR: mDoors.load(ref, deleted, store); break;
|
||||
case ESM::REC_INGR: mIngreds.load(ref, deleted, store); break;
|
||||
case ESM::REC_LEVC: mCreatureLists.load(ref, deleted, store); break;
|
||||
case ESM::REC_LEVI: mItemLists.load(ref, deleted, store); break;
|
||||
case ESM::REC_LIGH: mLights.load(ref, deleted, store); break;
|
||||
case ESM::REC_LOCK: mLockpicks.load(ref, deleted, store); break;
|
||||
case ESM::REC_MISC: mMiscItems.load(ref, deleted, store); break;
|
||||
case ESM::REC_NPC_: mNpcs.load(ref, deleted, store); break;
|
||||
case ESM::REC_PROB: mProbes.load(ref, deleted, store); break;
|
||||
case ESM::REC_REPA: mRepairs.load(ref, deleted, store); break;
|
||||
case ESM::REC_STAT: mStatics.load(ref, deleted, store); break;
|
||||
case ESM::REC_WEAP: mWeapons.load(ref, deleted, store); break;
|
||||
|
||||
case 0: std::cerr << "Cell reference " + ref.mRefID + " not found!\n"; break;
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace MWWorld
|
|||
|
||||
void loadRefs(const MWWorld::ESMStore &store, std::vector<ESM::ESMReader> &esm);
|
||||
|
||||
void loadRef (ESM::CellRef& ref, const ESMStore& store);
|
||||
void loadRef (ESM::CellRef& ref, bool deleted, const ESMStore& store);
|
||||
///< Make case-adjustments to \a ref and insert it into the respective container.
|
||||
///
|
||||
/// Invalid \a ref objects are silently dropped.
|
||||
|
|
|
@ -91,7 +91,11 @@ namespace MWWorld
|
|||
if (type==ESM::REC_GLOB)
|
||||
{
|
||||
ESM::Global global;
|
||||
global.load(reader);
|
||||
bool isDeleted = false;
|
||||
|
||||
// This readRecord() method is used when reading a saved game.
|
||||
// Deleted globals can't appear there, so isDeleted will be ignored here.
|
||||
global.load(reader, isDeleted);
|
||||
Misc::StringUtils::toLower(global.mId);
|
||||
|
||||
Collection::iterator iter = mVariables.find (global.mId);
|
||||
|
|
Loading…
Reference in a new issue