CIntElement: Simplify CIEKeyframeEmitter's GetMaxValue()

We can just use std::max_element here to collapse the loop into an
assignment.
This commit is contained in:
Lioncash 2019-10-04 19:23:57 -04:00
parent af0c2c41e3
commit 3407a59ad7
1 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,7 @@
#include "Runtime/Particle/CIntElement.hpp" #include "Runtime/Particle/CIntElement.hpp"
#include <algorithm>
#include "Runtime/CRandom16.hpp" #include "Runtime/CRandom16.hpp"
#include "Runtime/Particle/CElementGen.hpp" #include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/Particle/CGenDescription.hpp" #include "Runtime/Particle/CGenDescription.hpp"
@ -52,11 +54,7 @@ bool CIEKeyframeEmitter::GetValue(int frame, int& valOut) const {
} }
int CIEKeyframeEmitter::GetMaxValue() const { int CIEKeyframeEmitter::GetMaxValue() const {
int maxVal = INT_MIN; return *std::max_element(x18_keys.cbegin(), x18_keys.cend());
for (int k : x18_keys)
if (k > maxVal)
maxVal = k;
return maxVal;
} }
bool CIEDeath::GetValue(int frame, int& valOut) const { bool CIEDeath::GetValue(int frame, int& valOut) const {