From 1158a171e78be480bd0e7fbc29ed1f859550e7e8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 21 May 2020 01:40:28 -0400 Subject: [PATCH] CFontImageDef: Collapse IsLoaded() into a std::all_of call Same behavior, less code. C++20 ranges will allow shortening this in the future. --- Runtime/GuiSys/CFontImageDef.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Runtime/GuiSys/CFontImageDef.cpp b/Runtime/GuiSys/CFontImageDef.cpp index e20b52403..7a0db90b1 100644 --- a/Runtime/GuiSys/CFontImageDef.cpp +++ b/Runtime/GuiSys/CFontImageDef.cpp @@ -1,5 +1,7 @@ #include "Runtime/GuiSys/CFontImageDef.hpp" +#include + #include "Runtime/Graphics/CTexture.hpp" namespace urde { @@ -19,10 +21,7 @@ CFontImageDef::CFontImageDef(const TToken& tex, const zeus::CVector2f& } bool CFontImageDef::IsLoaded() const { - for (const TToken& tok : x4_texs) - if (!tok.IsLoaded()) - return false; - return true; + return std::all_of(x4_texs.cbegin(), x4_texs.cend(), [](const auto& token) { return token.IsLoaded(); }); } s32 CFontImageDef::CalculateBaseline() const {