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

Replace std::find with std::set::find where applicable

This commit is contained in:
Capostrophic 2018-08-14 18:14:43 +03:00 committed by GitHub
parent 53599290c3
commit 22162dcbda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -403,7 +403,7 @@ namespace MWMechanics
std::set<MWWorld::Ptr> playerAllies;
getActorsSidingWith(MWMechanics::getPlayer(), playerAllies, cachedAllies);
bool isPlayerFollowerOrEscorter = std::find(playerAllies.begin(), playerAllies.end(), actor1) != playerAllies.end();
bool isPlayerFollowerOrEscorter = playerAllies.find(actor1) != playerAllies.end();
// If actor2 and at least one actor2 are in combat with actor1, actor1 and its allies start combat with them
// Doesn't apply for player followers/escorters
@ -457,7 +457,7 @@ namespace MWMechanics
// Do aggression check if actor2 is the player or a player follower or escorter
if (!aggressive)
{
if (againstPlayer || std::find(playerAllies.begin(), playerAllies.end(), actor2) != playerAllies.end())
if (againstPlayer || playerAllies.find(actor2) != playerAllies.end())
{
// Player followers and escorters with high fight should not initiate combat with the player or with
// other player followers or escorters
@ -1934,7 +1934,7 @@ namespace MWMechanics
if (stats.isDead() || *neighbor == actor || neighbor->getClass().isPureWaterCreature(*neighbor))
continue;
const bool isFollower = std::find(followers.begin(), followers.end(), *neighbor) != followers.end();
const bool isFollower = followers.find(*neighbor) != followers.end();
if (stats.getAiSequence().isInCombat(actor) || (MWBase::Environment::get().getMechanicsManager()->isAggressive(*neighbor, actor) && !isFollower))
list.push_back(*neighbor);