CFontImageDef: Collapse IsLoaded() into a std::all_of call

Same behavior, less code. C++20 ranges will allow shortening this in the
future.
This commit is contained in:
Lioncash 2020-05-21 01:40:28 -04:00
parent 6063ec2540
commit 1158a171e7
1 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,7 @@
#include "Runtime/GuiSys/CFontImageDef.hpp" #include "Runtime/GuiSys/CFontImageDef.hpp"
#include <algorithm>
#include "Runtime/Graphics/CTexture.hpp" #include "Runtime/Graphics/CTexture.hpp"
namespace urde { namespace urde {
@ -19,10 +21,7 @@ CFontImageDef::CFontImageDef(const TToken<CTexture>& tex, const zeus::CVector2f&
} }
bool CFontImageDef::IsLoaded() const { bool CFontImageDef::IsLoaded() const {
for (const TToken<CTexture>& tok : x4_texs) return std::all_of(x4_texs.cbegin(), x4_texs.cend(), [](const auto& token) { return token.IsLoaded(); });
if (!tok.IsLoaded())
return false;
return true;
} }
s32 CFontImageDef::CalculateBaseline() const { s32 CFontImageDef::CalculateBaseline() const {