mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Merge branch 'countteleportula' into 'master'
Some checks failed
Build and test / Ubuntu (push) Has been cancelled
Build and test / MacOS (push) Has been cancelled
Build and test / Read .env file and expose it as output (push) Has been cancelled
Build and test / Windows (2019) (push) Has been cancelled
Build and test / Windows (2022) (push) Has been cancelled
Some checks failed
Build and test / Ubuntu (push) Has been cancelled
Build and test / MacOS (push) Has been cancelled
Build and test / Read .env file and expose it as output (push) Has been cancelled
Build and test / Windows (2019) (push) Has been cancelled
Build and test / Windows (2022) (push) Has been cancelled
Include Ptrs with a count of 0 in cell unloading Closes #8311 See merge request OpenMW/openmw!4536
This commit is contained in:
commit
3b05ec0ab1
2 changed files with 10 additions and 13 deletions
|
@ -213,7 +213,7 @@ namespace MWWorld
|
|||
/// unintended behaviour. \attention This function also lists deleted (count 0) objects!
|
||||
/// \return Iteration completed?
|
||||
template <class Visitor>
|
||||
bool forEach(Visitor&& visitor)
|
||||
bool forEach(Visitor&& visitor, bool includeDeleted = false)
|
||||
{
|
||||
if (mState != State_Loaded)
|
||||
return false;
|
||||
|
@ -227,7 +227,7 @@ namespace MWWorld
|
|||
|
||||
for (LiveCellRefBase* mergedRef : mMergedRefs)
|
||||
{
|
||||
if (!isAccessible(mergedRef->mData, mergedRef->mRef))
|
||||
if (!includeDeleted && !isAccessible(mergedRef->mData, mergedRef->mRef))
|
||||
continue;
|
||||
|
||||
if (!visitor(MWWorld::Ptr(mergedRef, this)))
|
||||
|
@ -242,7 +242,7 @@ namespace MWWorld
|
|||
/// unintended behaviour. \attention This function also lists deleted (count 0) objects!
|
||||
/// \return Iteration completed?
|
||||
template <class Visitor>
|
||||
bool forEachConst(Visitor&& visitor) const
|
||||
bool forEachConst(Visitor&& visitor, bool includeDeleted = false) const
|
||||
{
|
||||
if (mState != State_Loaded)
|
||||
return false;
|
||||
|
@ -252,7 +252,7 @@ namespace MWWorld
|
|||
|
||||
for (const LiveCellRefBase* mergedRef : mMergedRefs)
|
||||
{
|
||||
if (!isAccessible(mergedRef->mData, mergedRef->mRef))
|
||||
if (!includeDeleted && !isAccessible(mergedRef->mData, mergedRef->mRef))
|
||||
continue;
|
||||
|
||||
if (!visitor(MWWorld::ConstPtr(mergedRef, this)))
|
||||
|
@ -267,7 +267,7 @@ namespace MWWorld
|
|||
/// unintended behaviour. \attention This function also lists deleted (count 0) objects!
|
||||
/// \return Iteration completed?
|
||||
template <class T, class Visitor>
|
||||
bool forEachType(Visitor&& visitor)
|
||||
bool forEachType(Visitor&& visitor, bool includeDeleted = false)
|
||||
{
|
||||
if (mState != State_Loaded)
|
||||
return false;
|
||||
|
@ -279,16 +279,13 @@ namespace MWWorld
|
|||
|
||||
mHasState = true;
|
||||
|
||||
CellRefList<T>& list = get<T>();
|
||||
|
||||
for (typename CellRefList<T>::List::iterator it(list.mList.begin()); it != list.mList.end(); ++it)
|
||||
for (LiveCellRefBase& base : get<T>().mList)
|
||||
{
|
||||
LiveCellRefBase* base = &*it;
|
||||
if (mMovedToAnotherCell.find(base) != mMovedToAnotherCell.end())
|
||||
if (mMovedToAnotherCell.contains(&base))
|
||||
continue;
|
||||
if (!isAccessible(base->mData, base->mRef))
|
||||
if (!includeDeleted && !isAccessible(base.mData, base.mRef))
|
||||
continue;
|
||||
if (!visitor(MWWorld::Ptr(base, this)))
|
||||
if (!visitor(MWWorld::Ptr(&base, this)))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ namespace MWWorld
|
|||
|
||||
ListAndResetObjectsVisitor visitor;
|
||||
|
||||
cell->forEach(visitor);
|
||||
cell->forEach(visitor, true); // Include objects being teleported by Lua
|
||||
for (const auto& ptr : visitor.mObjects)
|
||||
{
|
||||
if (const auto object = mPhysics->getObject(ptr))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue