From 6ecd88af1426cf406f0fcb92261ad15a785f74be Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 28 Apr 2013 15:59:59 +0200 Subject: [PATCH] More fixes --- apps/openmw/mwworld/worldimp.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index ffa87f58c9..6fc7324e51 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -986,19 +986,16 @@ namespace MWWorld void World::processDoors(float duration) { - // doors - for (std::map::iterator it = mDoorStates.begin(); it != mDoorStates.end(); ++it) + std::map::iterator it = mDoorStates.begin(); + while (it != mDoorStates.end()) { - if (it->first.isEmpty() || !it->first.getRefData().getCount()) + if (!mWorldScene->isCellActive(*it->first.getCell())) mDoorStates.erase(it++); else { - if (!mWorldScene->isCellActive(*it->first.getCell())) - continue; - float oldRot = Ogre::Radian(it->first.getRefData().getLocalRotation().rot[2]).valueDegrees(); - float diff = duration * 90 * (it->second ? 1 : -1); - float targetRot = std::min(std::max(0.f, oldRot + diff), 90.f); + float diff = duration * 90; + float targetRot = std::min(std::max(0.f, oldRot + diff * (it->second ? 1 : -1)), 90.f); localRotateObject(it->first, 0, 0, targetRot); std::vector collisions = mPhysics->getCollisions(it->first); @@ -1021,7 +1018,9 @@ namespace MWWorld } if ((targetRot == 90.f && it->second) || targetRot == 0.f) - mDoorStates.erase(it); + mDoorStates.erase(it++); + else + ++it; } } }