From a2cede8f3470b900c6bbef65b8da697c1e1f8e6a Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 4 Feb 2017 17:20:47 +0100 Subject: [PATCH] Add timer for updateEquippedLight --- apps/openmw/mwmechanics/actors.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index db8598a755..6290109b20 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -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); + } } }