mirror of https://github.com/AxioDL/metaforce.git
CInGameTweakManagerBase: Make use of algorithms where applicable
This commit is contained in:
parent
e1dfe9ff8e
commit
e4dedac2b6
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -51,18 +52,18 @@ protected:
|
|||
|
||||
public:
|
||||
bool HasTweakValue(std::string_view name) const {
|
||||
for (const CTweakValue& val : x0_values)
|
||||
if (val.GetName() == name)
|
||||
return true;
|
||||
return false;
|
||||
return std::any_of(x0_values.cbegin(), x0_values.cend(),
|
||||
[name](const auto& value) { return value.GetName() == name; });
|
||||
}
|
||||
|
||||
const CTweakValue* GetTweakValue(std::string_view name) const {
|
||||
for (const CTweakValue& val : x0_values)
|
||||
if (val.GetName() == name)
|
||||
return &val;
|
||||
const auto iter = std::find_if(x0_values.cbegin(), x0_values.cend(),
|
||||
[name](const auto& value) { return value.GetName() == name; });
|
||||
if (iter == x0_values.cend()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &*iter;
|
||||
}
|
||||
|
||||
bool ReadFromMemoryCard(std::string_view name) { return true; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue