mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 20:02:40 +01:00
Improved function for destroying effects
Old version (needlessly) iterates on all vector
This commit is contained in:
parent
5b135a5689
commit
35405534e7
@ -552,10 +552,13 @@ TrailFX& GameWorld::createTrailEffect() {
|
||||
}
|
||||
|
||||
void GameWorld::destroyEffect(VisualFX& effect) {
|
||||
effects.erase(
|
||||
std::remove_if(effects.begin(), effects.end(),
|
||||
[&effect](auto& ef) { return ef.get() == &effect; }),
|
||||
effects.end());
|
||||
auto found =
|
||||
std::find_if(effects.begin(), effects.end(),
|
||||
[&effect](auto& ef) { return ef.get() == &effect; });
|
||||
|
||||
if (found != effects.end()) {
|
||||
effects.erase(found);
|
||||
}
|
||||
}
|
||||
|
||||
void GameWorld::doWeaponScan(const WeaponScan& scan) {
|
||||
|
Loading…
Reference in New Issue
Block a user