mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-06-11 04:35:39 +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() {
|
std::vector<LWOOBJID> Entity::GetTargetsInPhantom() {
|
||||||
// Clean up invalid targets, like disconnected players
|
// Clean up invalid targets, like disconnected players
|
||||||
for (auto i = 0u; i < m_TargetsInPhantom.size(); ) {
|
m_TargetsInPhantom.erase(std::remove_if(m_TargetsInPhantom.begin(), m_TargetsInPhantom.end(), [](const LWOOBJID id) {
|
||||||
if (Game::entityManager->GetEntity(m_TargetsInPhantom.at(i))) {
|
return !Game::entityManager->GetEntity(id);
|
||||||
i++;
|
}), m_TargetsInPhantom.end());
|
||||||
continue;
|
|
||||||
}
|
|
||||||
m_TargetsInPhantom.erase(m_TargetsInPhantom.begin() + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<LWOOBJID> enemies;
|
std::vector<LWOOBJID> enemies;
|
||||||
for (const auto id : m_TargetsInPhantom) {
|
for (const auto id : m_TargetsInPhantom) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user