1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 22:53:53 +00:00

Reset lastHitObject when it is retrieved rather than every frame

This seems to be how vanilla MW does it.
This commit is contained in:
scrawl 2014-12-11 22:00:31 +01:00
parent a355550cab
commit 5f00a3d5c3
2 changed files with 2 additions and 9 deletions

View file

@ -1122,15 +1122,6 @@ namespace MWMechanics
// target lists get updated once every 1.0 sec
if (timerUpdateAITargets >= 1.0f) timerUpdateAITargets = 0;
// Reset data from previous frame
for (PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
{
// Reset last hit object, which is only valid for one frame
// Note, the new hit object for this frame may be set by CharacterController::update -> Animation::runAnimation
// (below)
iter->first.getClass().getCreatureStats(iter->first).setLastHitObject(std::string());
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int hostilesCount = 0; // need to know this to play Battle music

View file

@ -732,6 +732,8 @@ namespace MWScript
MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
runtime.push(::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject()));
stats.setLastHitObject(std::string());
}
};