From 9ba6f5f36c7321ab237ed97263056f2aad0f8283 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 11 May 2019 09:44:30 +0400 Subject: [PATCH] Do not copy pointers during iteration --- apps/openmw/mwmechanics/actors.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index bf515c8421..0317e7dde7 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -470,7 +470,7 @@ namespace MWMechanics { MWBase::Environment::get().getMechanicsManager()->startCombat(actor1, actor2); // Also have actor1's allies start combat - for (const MWWorld::Ptr ally1 : allies1) + for (const MWWorld::Ptr& ally1 : allies1) MWBase::Environment::get().getMechanicsManager()->startCombat(ally1, actor2); return; } @@ -2075,7 +2075,7 @@ namespace MWMechanics std::vector neighbors; osg::Vec3f position (actor.getRefData().getPosition().asVec3()); getObjectsInRange(position, mActorsProcessingRange, neighbors); - for(const MWWorld::Ptr neighbor : neighbors) + for(const MWWorld::Ptr& neighbor : neighbors) { if (neighbor == actor) continue;