@@ -337,13 +337,13 @@ namespace
337337
338338 // helper function for forEachInternal
339339 template <class Visitor , class List >
340- bool forEachImp (Visitor& visitor, List& list, MWWorld::CellStore* cellStore)
340+ bool forEachImp (Visitor& visitor, List& list, MWWorld::CellStore& cellStore, bool includeDeleted )
341341 {
342- for (typename List::List::iterator iter ( list.mList . begin ()); iter != list. mList . end (); ++iter )
342+ for (auto & v : list.mList )
343343 {
344- if (!MWWorld::CellStore::isAccessible (iter-> mData , iter-> mRef ))
344+ if (!includeDeleted && ! MWWorld::CellStore::isAccessible (v. mData , v. mRef ))
345345 continue ;
346- if (!visitor (MWWorld::Ptr (&*iter, cellStore)))
346+ if (!visitor (MWWorld::Ptr (&v, & cellStore)))
347347 return false ;
348348 }
349349 return true ;
@@ -399,12 +399,12 @@ namespace MWWorld
399399 // listing only objects owned by this cell. Internal use only, you probably want to use forEach() so that moved
400400 // objects are accounted for.
401401 template <class Visitor >
402- static bool forEachInternal (Visitor& visitor, MWWorld::CellStore& cellStore)
402+ static bool forEachInternal (Visitor& visitor, MWWorld::CellStore& cellStore, bool includeDeleted )
403403 {
404404 bool returnValue = true ;
405405
406- Misc::tupleForEach (cellStore.mCellStoreImp ->mRefLists , [&visitor, &returnValue, &cellStore ](auto & store) {
407- returnValue = returnValue && forEachImp (visitor, store, & cellStore);
406+ Misc::tupleForEach (cellStore.mCellStoreImp ->mRefLists , [&](auto & store) {
407+ returnValue = returnValue && forEachImp (visitor, store, cellStore, includeDeleted );
408408 });
409409
410410 return returnValue;
@@ -583,11 +583,11 @@ namespace MWWorld
583583 mMergedRefsNeedsUpdate = true ;
584584 }
585585
586- void CellStore::updateMergedRefs () const
586+ void CellStore::updateMergedRefs (bool includeDeleted ) const
587587 {
588588 mMergedRefs .clear ();
589589 MergeVisitor visitor (mMergedRefs , mMovedHere , mMovedToAnotherCell );
590- CellStoreImp::forEachInternal (visitor, const_cast <CellStore&>(*this ));
590+ CellStoreImp::forEachInternal (visitor, const_cast <CellStore&>(*this ), includeDeleted );
591591 visitor.merge ();
592592 mMergedRefsNeedsUpdate = false ;
593593 }
0 commit comments