CActorModelParticles: Collapse FindSystem() into a find_if call

Same behavior, less code.
This commit is contained in:
Lioncash 2020-04-03 00:22:34 -04:00
parent c913502d90
commit b33fcf9e02
1 changed files with 2 additions and 4 deletions

View File

@ -1,5 +1,6 @@
#include "Runtime/World/CActorModelParticles.hpp"
#include <algorithm>
#include <array>
#include "Runtime/CDependencyGroup.hpp"
@ -528,10 +529,7 @@ void CActorModelParticles::SetupHook(TUniqueId uid) {
}
std::list<CActorModelParticles::CItem>::const_iterator CActorModelParticles::FindSystem(TUniqueId uid) const {
for (auto it = x0_items.cbegin(); it != x0_items.cend(); ++it)
if (it->x0_id == uid)
return it;
return x0_items.cend();
return std::find_if(x0_items.begin(), x0_items.end(), [uid](const auto& entry) { return entry.x0_id == uid; });
}
std::list<CActorModelParticles::CItem>::iterator CActorModelParticles::FindOrCreateSystem(CActor& act) {