1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:49:58 +00:00

Merge remote-tracking branch 'miroslavr/master'

This commit is contained in:
Marc Zinnschlag 2014-11-25 19:30:49 +01:00
commit 533bb3b0d5

View file

@ -17,18 +17,35 @@ namespace MWMechanics
MWWorld::TimeStamp now = MWBase::Environment::get().getWorld()->getTimeStamp();
// Erase no longer active spells
// Erase no longer active spells and effects
if (mLastUpdate!=now)
{
TContainer::iterator iter (mSpells.begin());
while (iter!=mSpells.end())
{
if (!timeToExpire (iter))
{
mSpells.erase (iter++);
rebuild = true;
}
else
{
std::vector<ActiveEffect>& effects = iter->second.mEffects;
for (std::vector<ActiveEffect>::iterator effectIt = effects.begin(); effectIt != effects.end();)
{
MWWorld::TimeStamp start = iter->second.mTimeStamp;
MWWorld::TimeStamp end = start + static_cast<double>(effectIt->mDuration)*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/(60*60);
if (end <= now)
{
effectIt = effects.erase(effectIt);
rebuild = true;
}
else
++effectIt;
}
++iter;
}
}
mLastUpdate = now;
}