mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
use erase remove if
This commit is contained in:
parent
a67ef6336f
commit
3a50470dbb
@ -1988,13 +1988,9 @@ void Entity::SetNetworkId(const uint16_t id) {
|
||||
|
||||
std::vector<LWOOBJID> Entity::GetTargetsInPhantom() {
|
||||
// Clean up invalid targets, like disconnected players
|
||||
for (auto i = 0u; i < m_TargetsInPhantom.size(); ) {
|
||||
if (Game::entityManager->GetEntity(m_TargetsInPhantom.at(i))) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
m_TargetsInPhantom.erase(m_TargetsInPhantom.begin() + i);
|
||||
}
|
||||
m_TargetsInPhantom.erase(std::remove_if(m_TargetsInPhantom.begin(), m_TargetsInPhantom.end(), [](const LWOOBJID id) {
|
||||
return !Game::entityManager->GetEntity(id);
|
||||
}), m_TargetsInPhantom.end());
|
||||
|
||||
std::vector<LWOOBJID> enemies;
|
||||
for (const auto id : m_TargetsInPhantom) {
|
||||
|
Loading…
Reference in New Issue
Block a user