1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 11:53:51 +00:00

More fixes

This commit is contained in:
scrawl 2013-04-28 15:59:59 +02:00
parent 208f9ca8c5
commit 6ecd88af14

View file

@ -986,19 +986,16 @@ namespace MWWorld
void World::processDoors(float duration) void World::processDoors(float duration)
{ {
// doors std::map<MWWorld::Ptr, int>::iterator it = mDoorStates.begin();
for (std::map<MWWorld::Ptr, int>::iterator it = mDoorStates.begin(); it != mDoorStates.end(); ++it) while (it != mDoorStates.end())
{ {
if (it->first.isEmpty() || !it->first.getRefData().getCount()) if (!mWorldScene->isCellActive(*it->first.getCell()))
mDoorStates.erase(it++); mDoorStates.erase(it++);
else else
{ {
if (!mWorldScene->isCellActive(*it->first.getCell()))
continue;
float oldRot = Ogre::Radian(it->first.getRefData().getLocalRotation().rot[2]).valueDegrees(); float oldRot = Ogre::Radian(it->first.getRefData().getLocalRotation().rot[2]).valueDegrees();
float diff = duration * 90 * (it->second ? 1 : -1); float diff = duration * 90;
float targetRot = std::min(std::max(0.f, oldRot + diff), 90.f); float targetRot = std::min(std::max(0.f, oldRot + diff * (it->second ? 1 : -1)), 90.f);
localRotateObject(it->first, 0, 0, targetRot); localRotateObject(it->first, 0, 0, targetRot);
std::vector<std::string> collisions = mPhysics->getCollisions(it->first); std::vector<std::string> collisions = mPhysics->getCollisions(it->first);
@ -1021,7 +1018,9 @@ namespace MWWorld
} }
if ((targetRot == 90.f && it->second) || targetRot == 0.f) if ((targetRot == 90.f && it->second) || targetRot == 0.f)
mDoorStates.erase(it); mDoorStates.erase(it++);
else
++it;
} }
} }
} }