mirror of https://github.com/AxioDL/metaforce.git
CTeamAiMgr: Make use of std::any_of in ShouldUpdateRoles()
Same behavior, less code.
This commit is contained in:
parent
e73e704d20
commit
e1ddabaff8
|
@ -65,20 +65,19 @@ void CTeamAiMgr::UpdateTeamCaptain() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTeamAiMgr::ShouldUpdateRoles(float dt) {
|
bool CTeamAiMgr::ShouldUpdateRoles(float dt) {
|
||||||
if (x58_roles.empty())
|
if (x58_roles.empty()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
x88_timeDirty += dt;
|
x88_timeDirty += dt;
|
||||||
if (x88_timeDirty >= 1.5f)
|
if (x88_timeDirty >= 1.5f) {
|
||||||
return true;
|
|
||||||
|
|
||||||
for (const auto& role : x58_roles) {
|
|
||||||
if (role.GetTeamAiRole() <= CTeamAiRole::ETeamAiRole::Initial ||
|
|
||||||
role.GetTeamAiRole() > CTeamAiRole::ETeamAiRole::Unassigned)
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return std::any_of(x58_roles.cbegin(), x58_roles.cend(), [](const auto& role) {
|
||||||
|
return role.GetTeamAiRole() <= CTeamAiRole::ETeamAiRole::Initial ||
|
||||||
|
role.GetTeamAiRole() > CTeamAiRole::ETeamAiRole::Unassigned;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTeamAiMgr::ResetRoles(CStateManager& mgr) {
|
void CTeamAiMgr::ResetRoles(CStateManager& mgr) {
|
||||||
|
|
Loading…
Reference in New Issue