Don't leave stale player CharacterController in Actors when loading game (Fixes #1713)

This commit is contained in:
scrawl 2014-07-27 23:10:58 +02:00
parent d81e9cfefd
commit 6262d6c964
2 changed files with 10 additions and 8 deletions

View file

@ -924,12 +924,7 @@ namespace MWMechanics
Actors::~Actors()
{
PtrControllerMap::iterator it(mActors.begin());
for (; it != mActors.end(); ++it)
{
delete it->second;
it->second = NULL;
}
clear();
}
void Actors::addActor (const MWWorld::Ptr& ptr, bool updateImmediately)
@ -1359,6 +1354,13 @@ namespace MWMechanics
void Actors::clear()
{
PtrControllerMap::iterator it(mActors.begin());
for (; it != mActors.end(); ++it)
{
delete it->second;
it->second = NULL;
}
mActors.clear();
mDeathCount.clear();
}
}

View file

@ -2111,8 +2111,8 @@ namespace MWWorld
void World::enableActorCollision(const MWWorld::Ptr& actor, bool enable)
{
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
physicActor->enableCollisionBody(enable);
if (physicActor)
physicActor->enableCollisionBody(enable);
}
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)