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.

deque
scrawl 11 years ago
parent 5645c9185b
commit 4e71db7081

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

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

Loading…
Cancel
Save