diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index b08a52aac..624c65d57 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -60,12 +60,12 @@ namespace MWWorld std::cout << "Unloading cell\n"; ListHandles functor; - MWWorld::Ptr::CellStore* active = *iter; + - active->forEach(functor); + (*iter)->forEach(functor); { @@ -77,12 +77,13 @@ namespace MWWorld mPhysics->removeObject (node->getName()); } } - mRendering.removeCell(active); + mRendering.removeCell(*iter); //mPhysics->removeObject("Unnamed_43"); - mWorld->getLocalScripts().clearCell (active); - mEnvironment.mMechanicsManager->dropActors (active); - mEnvironment.mSoundManager->stopSound (active); - mActiveCells.erase(active); + mWorld->getLocalScripts().clearCell (*iter); + mEnvironment.mMechanicsManager->dropActors (*iter); + mEnvironment.mSoundManager->stopSound (*iter); + mActiveCells.erase(*iter); + } @@ -108,6 +109,7 @@ namespace MWWorld void Scene::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position, bool adjustPlayerPos) { + mWorld->makeNewPlayer(); if (adjustPlayerPos) mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]); diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 2232e8a1d..f655b6143 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -182,6 +182,13 @@ namespace MWWorld } + void World::makeNewPlayer(){ + MWRender::Player* play = &(mRendering.getPlayer()); + delete mPlayer; + mPlayer = new MWWorld::Player (play, mStore.npcs.find ("player"), *this); + mPhysics->addActor (mPlayer->getPlayer().getRefData().getHandle(), "", Ogre::Vector3 (0, 0, 0)); + } + World::~World() { delete mWorldScene; diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/world.hpp index 235d203a6..71231998a 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/world.hpp @@ -220,6 +220,7 @@ namespace MWWorld /// references that are currently not in the rendered scene should be ignored. void setObjectPhysicsRotation(const std::string& handle,Ogre::Quaternion quat); void setObjectPhysicsPosition(const std::string& handle,Ogre::Vector3 vector); + void makeNewPlayer(); }; }