mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 21:45:33 +00:00
Make some more optimizations to actor processing loops
This commit is contained in:
parent
b77d733c3e
commit
910065f38f
1 changed files with 9 additions and 4 deletions
|
@ -1782,6 +1782,8 @@ namespace MWMechanics
|
|||
if (iteratedActor == getPlayer())
|
||||
continue;
|
||||
|
||||
const bool sameActor = (iteratedActor == actor);
|
||||
|
||||
const CreatureStats &stats = iteratedActor.getClass().getCreatureStats(iteratedActor);
|
||||
if (stats.isDead())
|
||||
continue;
|
||||
|
@ -1792,7 +1794,7 @@ namespace MWMechanics
|
|||
{
|
||||
if ((*package)->sideWithTarget() && !(*package)->getTarget().isEmpty())
|
||||
{
|
||||
if (iteratedActor == actor)
|
||||
if (sameActor)
|
||||
{
|
||||
list.push_back((*package)->getTarget());
|
||||
}
|
||||
|
@ -1815,7 +1817,7 @@ namespace MWMechanics
|
|||
for(PtrActorMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
|
||||
{
|
||||
const MWWorld::Ptr &iteratedActor = iter->first;
|
||||
if (iteratedActor == getPlayer())
|
||||
if (iteratedActor == getPlayer() || iteratedActor == actor)
|
||||
continue;
|
||||
|
||||
const CreatureStats &stats = iteratedActor.getClass().getCreatureStats(iteratedActor);
|
||||
|
@ -1878,7 +1880,7 @@ namespace MWMechanics
|
|||
for(PtrActorMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
|
||||
{
|
||||
const MWWorld::Ptr &iteratedActor = iter->first;
|
||||
if (iteratedActor == getPlayer())
|
||||
if (iteratedActor == getPlayer() || iteratedActor == actor)
|
||||
continue;
|
||||
|
||||
const CreatureStats &stats = iteratedActor.getClass().getCreatureStats(iteratedActor);
|
||||
|
@ -1908,8 +1910,11 @@ namespace MWMechanics
|
|||
getObjectsInRange(position, aiProcessingDistance, neighbors);
|
||||
for(auto neighbor = neighbors.begin(); neighbor != neighbors.end(); ++neighbor)
|
||||
{
|
||||
if (*neighbor == actor)
|
||||
continue;
|
||||
|
||||
const CreatureStats &stats = neighbor->getClass().getCreatureStats(*neighbor);
|
||||
if (stats.isDead() || *neighbor == actor)
|
||||
if (stats.isDead())
|
||||
continue;
|
||||
|
||||
if (stats.getAiSequence().isInCombat(actor))
|
||||
|
|
Loading…
Reference in a new issue