From 6703529445023f323ad9e0efda5dbd4ee4b908ce Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 3 Aug 2020 01:18:10 -0400 Subject: [PATCH] CInGameGuiManager: Make use of std::all_of in CheckDGRPLoadComplete() When ranges are implemented in all compilers, we can simplify this significantly. --- Runtime/MP1/CInGameGuiManager.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Runtime/MP1/CInGameGuiManager.cpp b/Runtime/MP1/CInGameGuiManager.cpp index 3b2dd393d..67c341650 100644 --- a/Runtime/MP1/CInGameGuiManager.cpp +++ b/Runtime/MP1/CInGameGuiManager.cpp @@ -1,5 +1,6 @@ #include "Runtime/MP1/CInGameGuiManager.hpp" +#include #include #include "Runtime/CDependencyGroup.hpp" @@ -47,13 +48,10 @@ std::vector> CInGameGuiManager::LockPauseScreenDe } bool CInGameGuiManager::CheckDGRPLoadComplete() const { - for (const auto& dgrp : x5c_pauseScreenDGRPs) - if (!dgrp.IsLoaded()) - return false; - for (const auto& dgrp : xc8_inGameGuiDGRPs) - if (!dgrp.IsLoaded()) - return false; - return true; + const auto isLoaded = [](const auto& entry) { return entry.IsLoaded(); }; + + return std::all_of(x5c_pauseScreenDGRPs.cbegin(), x5c_pauseScreenDGRPs.cend(), isLoaded) && + std::all_of(xc8_inGameGuiDGRPs.cbegin(), xc8_inGameGuiDGRPs.cend(), isLoaded); } void CInGameGuiManager::BeginStateTransition(EInGameGuiState state, CStateManager& stateMgr) {