1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-07 13:20:25 +00:00

Savegame: Don't load/save deleted container items. This is currently pointless, and also causes new garbage being added on each load/save cycle: Container stores are first filled from ESM records, then cleared and filled from the savegame. The items from ESM records remain as deleted refs.

This commit is contained in:
scrawl 2014-06-18 21:39:17 +02:00
parent 5645c9185b
commit 4e71db7081
2 changed files with 6 additions and 0 deletions

View File

@ -92,6 +92,8 @@ void MWWorld::ContainerStore::storeStates (const CellRefList<T>& collection,
for (typename CellRefList<T>::List::const_iterator iter (collection.mList.begin()); for (typename CellRefList<T>::List::const_iterator iter (collection.mList.begin());
iter!=collection.mList.end(); ++iter) iter!=collection.mList.end(); ++iter)
{ {
if (iter->mData.getCount() == 0)
continue;
ESM::ObjectState state; ESM::ObjectState state;
storeState (*iter, state); storeState (*iter, state);
int slot = equipable ? getSlot (*iter) : -1; int slot = equipable ? getSlot (*iter) : -1;

View File

@ -37,6 +37,8 @@ void ESM::InventoryState::load (ESMReader &esm)
LightState state; LightState state;
int slot; int slot;
read (esm, state, slot); read (esm, state, slot);
if (state.mCount == 0)
continue;
mLights.push_back (std::make_pair (state, slot)); mLights.push_back (std::make_pair (state, slot));
} }
else else
@ -44,6 +46,8 @@ void ESM::InventoryState::load (ESMReader &esm)
ObjectState state; ObjectState state;
int slot; int slot;
read (esm, state, slot); read (esm, state, slot);
if (state.mCount == 0)
continue;
mItems.push_back (std::make_pair (state, std::make_pair (id, slot))); mItems.push_back (std::make_pair (state, std::make_pair (id, slot)));
} }
} }