diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index ff3845e9a2..00be811137 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -655,13 +655,6 @@ namespace MWWorld } }; - Ptr CellStore::searchViaRefNum(const ESM::RefNum& refNum) - { - RefNumSearchVisitor searchVisitor(refNum); - forEach(searchVisitor); - return searchVisitor.mFound; - } - float CellStore::getWaterLevel() const { if (isExterior()) @@ -1046,7 +1039,7 @@ namespace MWWorld } // Search for the reference. It might no longer exist if its content file was removed. - Ptr movedRef = searchViaRefNum(refnum); + Ptr movedRef = MWBase::Environment::get().getWorldModel()->getPtr(refnum); if (movedRef.isEmpty()) { Log(Debug::Warning) << "Warning: Dropping moved ref tag for " << refnum.mIndex diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 0cc06f4d2f..47c15edfee 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -166,11 +166,6 @@ namespace MWWorld Ptr searchViaActorId(int id); ///< Will return an empty Ptr if cell is not loaded. - Ptr searchViaRefNum(const ESM::RefNum& refNum); - ///< Will return an empty Ptr if cell is not loaded. Does not check references in - /// containers. - /// @note Triggers CellStore hasState flag. - float getWaterLevel() const; bool movedHere(const MWWorld::Ptr& ptr) const; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 21ed7a6ee4..8c13a9a4c0 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1880,14 +1880,7 @@ namespace MWWorld facedObject = rayToObject.mHitObject; if (facedObject.isEmpty() && rayToObject.mHitRefnum.isSet()) - { - for (CellStore* cellstore : mWorldScene->getActiveCells()) - { - facedObject = cellstore->searchViaRefNum(rayToObject.mHitRefnum); - if (!facedObject.isEmpty()) - break; - } - } + facedObject = MWBase::Environment::get().getWorldModel()->getPtr(rayToObject.mHitRefnum); if (rayToObject.mHit) mDistanceToFacedObject = (rayToObject.mRatio * maxDistance) - camDist; else @@ -1904,14 +1897,7 @@ namespace MWWorld res.mHitNormal = rayRes.mHitNormalWorld; res.mHitObject = rayRes.mHitObject; if (res.mHitObject.isEmpty() && rayRes.mHitRefnum.isSet()) - { - for (CellStore* cellstore : mWorldScene->getActiveCells()) - { - res.mHitObject = cellstore->searchViaRefNum(rayRes.mHitRefnum); - if (!res.mHitObject.isEmpty()) - break; - } - } + res.mHitObject = MWBase::Environment::get().getWorldModel()->getPtr(rayRes.mHitRefnum); return res.mHit; }