Add timer for updateEquippedLight

coverity_scan^2
scrawl 8 years ago
parent 1eb3384043
commit a2cede8f34

@ -396,7 +396,6 @@ namespace MWMechanics
{
updateDrowning(ptr, duration);
calculateNpcStatModifiers(ptr, duration);
updateEquippedLight(ptr, duration);
}
void Actors::adjustMagicEffects (const MWWorld::Ptr& creature)
@ -1018,10 +1017,13 @@ namespace MWMechanics
{
static float timerUpdateAITargets = 0;
static float timerUpdateHeadTrack = 0;
static float timerUpdateEquippedLight = 0;
const float updateEquippedLightInterval = 1.0f;
// target lists get updated once every 1.0 sec
if (timerUpdateAITargets >= 1.0f) timerUpdateAITargets = 0;
if (timerUpdateHeadTrack >= 0.3f) timerUpdateHeadTrack = 0;
if (timerUpdateEquippedLight >= updateEquippedLightInterval) timerUpdateEquippedLight = 0;
MWWorld::Ptr player = getPlayer();
@ -1096,7 +1098,12 @@ namespace MWMechanics
}
if(iter->first.getTypeName() == typeid(ESM::NPC).name())
{
updateNpc(iter->first, duration);
if (timerUpdateEquippedLight == 0)
updateEquippedLight(iter->first, updateEquippedLightInterval);
}
}
}

Loading…
Cancel
Save