CDrone: Use std::any_of in HearShot

This commit is contained in:
Luke Street 2020-09-13 19:34:34 -04:00
parent 3bf5a6fc83
commit ecc8b73ead
1 changed files with 2 additions and 2 deletions

View File

@ -825,11 +825,11 @@ bool CDrone::ShouldAttack(CStateManager& mgr, float arg) {
bool CDrone::HearShot(CStateManager& mgr, float arg) { bool CDrone::HearShot(CStateManager& mgr, float arg) {
rstl::reserved_vector<TUniqueId, 1024> nearList; rstl::reserved_vector<TUniqueId, 1024> nearList;
BuildNearList(EMaterialTypes::Projectile, EMaterialTypes::Player, nearList, 10.f, mgr); BuildNearList(EMaterialTypes::Projectile, EMaterialTypes::Player, nearList, 10.f, mgr);
return std::find_if(nearList.begin(), nearList.end(), [&mgr](TUniqueId uid) { return std::any_of(nearList.begin(), nearList.end(), [&mgr](TUniqueId uid) {
if (TCastToConstPtr<CWeapon> wp = mgr.GetObjectById(uid)) if (TCastToConstPtr<CWeapon> wp = mgr.GetObjectById(uid))
return wp->GetType() != EWeaponType::AI; return wp->GetType() != EWeaponType::AI;
return false; return false;
}) != nearList.end(); });
} }
bool CDrone::CoverCheck(CStateManager& mgr, float arg) { bool CDrone::CoverCheck(CStateManager& mgr, float arg) {