diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 7cc0a6e5e..008d64aaf 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -189,12 +189,6 @@ namespace MWBase ///< Return a pointer to a liveCellRef with the given name. /// \param activeOnly do non search inactive cells. - virtual MWWorld::Ptr getPtrViaHandle (const std::string& handle) = 0; - ///< Return a pointer to a liveCellRef with the given Ogre handle. - - virtual MWWorld::Ptr searchPtrViaHandle (const std::string& handle) = 0; - ///< Return a pointer to a liveCellRef with the given Ogre handle or Ptr() if not found - virtual MWWorld::Ptr searchPtrViaActorId (int actorId) = 0; ///< Search is limited to the active cells. diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 6d429f3e5..9b56a46b8 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -966,6 +966,7 @@ namespace MWPhysics bool PhysicsSystem::isActorStandingOn(const MWWorld::Ptr &actor, const MWWorld::Ptr &object) const { + /* const std::string& actorHandle = actor.getRefData().getHandle(); const std::string& objectHandle = object.getRefData().getHandle(); @@ -975,11 +976,13 @@ namespace MWPhysics if (it->first == actorHandle && it->second == objectHandle) return true; } + */ return false; } void PhysicsSystem::getActorsStandingOn(const MWWorld::Ptr &object, std::vector &out) const { + /* const std::string& objectHandle = object.getRefData().getHandle(); for (std::map::const_iterator it = mStandingCollisions.begin(); @@ -988,10 +991,12 @@ namespace MWPhysics if (it->second == objectHandle) out.push_back(it->first); } + */ } bool PhysicsSystem::isActorCollidingWith(const MWWorld::Ptr &actor, const MWWorld::Ptr &object) const { + /* const std::string& actorHandle = actor.getRefData().getHandle(); const std::string& objectHandle = object.getRefData().getHandle(); @@ -1001,11 +1006,13 @@ namespace MWPhysics if (it->first == actorHandle && it->second == objectHandle) return true; } + */ return false; } void PhysicsSystem::getActorsCollidingWith(const MWWorld::Ptr &object, std::vector &out) const { + /* const std::string& objectHandle = object.getRefData().getHandle(); for (std::map::const_iterator it = mCollisions.begin(); @@ -1014,6 +1021,7 @@ namespace MWPhysics if (it->second == objectHandle) out.push_back(it->first); } + */ } void PhysicsSystem::disableWater() diff --git a/apps/openmw/mwworld/cellreflist.hpp b/apps/openmw/mwworld/cellreflist.hpp index 2c5e01aaa..49197d167 100644 --- a/apps/openmw/mwworld/cellreflist.hpp +++ b/apps/openmw/mwworld/cellreflist.hpp @@ -40,16 +40,6 @@ namespace MWWorld mList.push_back(item); return mList.back(); } - - LiveCellRef *searchViaHandle (const std::string& handle) - { - for (typename List::iterator iter (mList.begin()); iter!=mList.end(); ++iter) - if (iter->mData.getBaseNode() && - iter->mData.getHandle()==handle) - return &*iter; - - return 0; - } }; } diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 7da7c187d..4e6c6f116 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -282,77 +282,6 @@ namespace MWWorld return Ptr(); } - Ptr CellStore::searchViaHandle (const std::string& handle) - { - bool oldState = mHasState; - - mHasState = true; - - if (LiveCellRef *ref = mActivators.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mPotions.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mAppas.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mArmors.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mBooks.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mClothes.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mContainers.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mCreatures.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mDoors.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mIngreds.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mCreatureLists.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mItemLists.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mLights.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mLockpicks.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mMiscItems.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mNpcs.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mProbes.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mRepairs.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mStatics.searchViaHandle (handle)) - return Ptr (ref, this); - - if (LiveCellRef *ref = mWeapons.searchViaHandle (handle)) - return Ptr (ref, this); - - mHasState = oldState; - - return Ptr(); - } - Ptr CellStore::searchViaActorId (int id) { if (Ptr ptr = ::searchViaActorId (mNpcs, id, this)) diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index d7036d6b1..d3c6d0735 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -94,9 +94,6 @@ namespace MWWorld ///< Will return an empty Ptr if cell is not loaded. Does not check references in /// containers. - Ptr searchViaHandle (const std::string& handle); - ///< Will return an empty Ptr if cell is not loaded. - Ptr searchViaActorId (int id); ///< Will return an empty Ptr if cell is not loaded. diff --git a/apps/openmw/mwworld/refdata.cpp b/apps/openmw/mwworld/refdata.cpp index 82bb06b8d..a95a66f7e 100644 --- a/apps/openmw/mwworld/refdata.cpp +++ b/apps/openmw/mwworld/refdata.cpp @@ -123,17 +123,6 @@ namespace MWWorld {} } - const std::string &RefData::getHandle() - { - if(!mBaseNode) - { - static const std::string empty; - return empty; - } - - return mBaseNode->getName(); - } - Ogre::SceneNode* RefData::getBaseNodeOld() { return mBaseNode; diff --git a/apps/openmw/mwworld/refdata.hpp b/apps/openmw/mwworld/refdata.hpp index 955913d9c..5951cb101 100644 --- a/apps/openmw/mwworld/refdata.hpp +++ b/apps/openmw/mwworld/refdata.hpp @@ -81,9 +81,6 @@ namespace MWWorld RefData& operator= (const RefData& refData); - /// Return OGRE handle (may be empty). - const std::string &getHandle(); - /// Return OGRE base node (can be a null pointer). /// obsolete Ogre::SceneNode* getBaseNodeOld(); diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 81e240698..20f1f7ebc 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -563,7 +563,7 @@ namespace MWWorld MWBase::Environment::get().getMechanicsManager()->remove (ptr); MWBase::Environment::get().getSoundManager()->stopSound3D (ptr); mPhysics->remove(ptr); - //Rendering.removeObject (ptr); + //mRendering.removeObject (ptr); } bool Scene::isCellActive(const CellStore &cell) @@ -578,16 +578,6 @@ namespace MWWorld return false; } - Ptr Scene::searchPtrViaHandle (const std::string& handle) - { - for (CellStoreCollection::const_iterator iter (mActiveCells.begin()); - iter!=mActiveCells.end(); ++iter) - if (Ptr ptr = (*iter)->searchViaHandle (handle)) - return ptr; - - return Ptr(); - } - Ptr Scene::searchPtrViaActorId (int actorId) { for (CellStoreCollection::const_iterator iter (mActiveCells.begin()); diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 24ffdf07b..af0b82fc3 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -117,8 +117,6 @@ namespace MWWorld bool isCellActive(const CellStore &cell); - Ptr searchPtrViaHandle (const std::string& handle); - Ptr searchPtrViaActorId (int actorId); }; } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index add8d0373..094098a91 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -676,22 +676,6 @@ namespace MWWorld throw std::runtime_error ("unknown ID: " + name); } - Ptr World::getPtrViaHandle (const std::string& handle) - { - Ptr res = searchPtrViaHandle (handle); - if (res.isEmpty ()) - throw std::runtime_error ("unknown Ogre handle: " + handle); - return res; - } - - Ptr World::searchPtrViaHandle (const std::string& handle) - { - if (mPlayer->getPlayer().getRefData().getHandle()==handle) - return mPlayer->getPlayer(); - - return mWorldScene->searchPtrViaHandle (handle); - } - Ptr World::searchPtrViaActorId (int actorId) { // The player is not registered in any CellStore so must be checked manually @@ -1060,10 +1044,10 @@ namespace MWWorld getFacedHandle(facedHandle, activationDistance); } - if (facedHandle.empty()) + //if (facedHandle.empty()) return MWWorld::Ptr(); - return getPtrViaHandle(facedHandle); + //return getPtrViaHandle(facedHandle); } std::pair World::getHitContact(const MWWorld::Ptr &ptr, float distance) @@ -1083,7 +1067,6 @@ namespace MWWorld if(node != NULL) pos += node->_getDerivedPosition(); } - */ std::pair result;// = mPhysics->getHitContact(ptr.getRefData().getHandle(), // pos, rot, distance); @@ -1091,6 +1074,8 @@ namespace MWWorld return std::make_pair(MWWorld::Ptr(), Ogre::Vector3(0.0f)); return std::make_pair(searchPtrViaHandle(result.first), result.second); + */ + return std::make_pair(MWWorld::Ptr(), Ogre::Vector3(0.0f)); } void World::deleteObject (const Ptr& ptr) @@ -1875,10 +1860,11 @@ namespace MWWorld if (normal.angleBetween(Ogre::Vector3(0.f,0.f,1.f)).valueDegrees() >= 30) return false; + /* MWWorld::Ptr hitObject = searchPtrViaHandle(handle); if (!hitObject.isEmpty() && hitObject.getClass().isActor()) return false; - + */ return true; } else @@ -2239,8 +2225,9 @@ namespace MWWorld if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return; + /* std::vector actors; - //mPhysics->getActorsStandingOn(object, actors); + mPhysics->getActorsStandingOn(object, actors); for (std::vector::iterator it = actors.begin(); it != actors.end(); ++it) { MWWorld::Ptr actor = searchPtrViaHandle(*it); // Collision events are from the last frame, actor might no longer exist @@ -2263,6 +2250,7 @@ namespace MWWorld MWBase::Environment::get().getSoundManager()->playSound3D(actor, "Health Damage", 1.0f, 1.0f); } } + */ } void World::hurtCollidingActors(const Ptr &object, float healthPerSecond) @@ -2270,8 +2258,9 @@ namespace MWWorld if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return; + /* std::vector actors; - //mPhysics->getActorsCollidingWith(object, actors); + mPhysics->getActorsCollidingWith(object, actors); for (std::vector::iterator it = actors.begin(); it != actors.end(); ++it) { MWWorld::Ptr actor = searchPtrViaHandle(*it); // Collision events are from the last frame, actor might no longer exist @@ -2294,6 +2283,7 @@ namespace MWWorld MWBase::Environment::get().getSoundManager()->playSound3D(actor, "Health Damage", 1.0f, 1.0f); } } + */ } float World::getWindSpeed() @@ -2338,15 +2328,14 @@ namespace MWWorld } } - struct ListHandlesFunctor + struct ListObjectsFunctor { - std::vector mHandles; + std::vector mObjects; bool operator() (Ptr ptr) { - Ogre::SceneNode* handle = ptr.getRefData().getBaseNodeOld(); - if (handle) - mHandles.push_back(handle->getName()); + if (ptr.getRefData().getBaseNode()) + mObjects.push_back(ptr); return true; } }; @@ -2356,12 +2345,12 @@ namespace MWWorld const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells(); for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt) { - ListHandlesFunctor functor; - (*cellIt)->forEach(functor); + ListObjectsFunctor functor; + (*cellIt)->forEach(functor); - for (std::vector::iterator it = functor.mHandles.begin(); it != functor.mHandles.end(); ++it) - if (Misc::StringUtils::ciEqual(searchPtrViaHandle(*it).getCellRef().getOwner(), npc.getCellRef().getRefId())) - out.push_back(searchPtrViaHandle(*it)); + for (std::vector::iterator it = functor.mObjects.begin(); it != functor.mObjects.end(); ++it) + if (Misc::StringUtils::ciEqual(it->getCellRef().getOwner(), npc.getCellRef().getRefId())) + out.push_back(*it); } } @@ -2714,8 +2703,8 @@ namespace MWWorld // For the player, use camera to aim std::string facedHandle; getFacedHandle(facedHandle, distance); - if (!facedHandle.empty()) - target = getPtrViaHandle(facedHandle); + //if (!facedHandle.empty()) + // target = getPtrViaHandle(facedHandle); } else { diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index a7830da3a..97515b7d0 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -98,8 +98,6 @@ namespace MWWorld World (const World&); World& operator= (const World&); - Ptr getPtrViaHandle (const std::string& handle, CellStore& cellStore); - int mActivationDistanceOverride; std::string mStartupScript; @@ -266,12 +264,6 @@ namespace MWWorld ///< Return a pointer to a liveCellRef with the given name. /// \param activeOnly do non search inactive cells. - virtual Ptr getPtrViaHandle (const std::string& handle); - ///< Return a pointer to a liveCellRef with the given Ogre handle. - - virtual Ptr searchPtrViaHandle (const std::string& handle); - ///< Return a pointer to a liveCellRef with the given Ogre handle or Ptr() if not found - virtual Ptr searchPtrViaActorId (int actorId); ///< Search is limited to the active cells.