mirror of https://github.com/AxioDL/metaforce.git
CSlideShow: Collapse loop into std::all_of
Same behavior, less code. We can also make this function fully internally linked, given it doesn't depend on instance state.
This commit is contained in:
parent
fd2f2e146c
commit
bfbb027117
|
@ -1,10 +1,16 @@
|
|||
#include "Runtime/MP1/CSlideShow.hpp"
|
||||
|
||||
#include "Editor/ProjectManager.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
#include "Editor/ProjectManager.hpp"
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
|
||||
namespace urde {
|
||||
namespace {
|
||||
bool AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps) {
|
||||
return std::all_of(deps.cbegin(), deps.cend(), [](const auto& dep) { return dep.IsLoaded(); });
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
CSlideShow::CSlideShow() : CIOWin("SlideShow"), x130_(g_tweakSlideShow->GetX54()) {
|
||||
const SObjectTag* font = g_ResFactory->GetResourceIdByName(g_tweakSlideShow->GetFont());
|
||||
|
@ -58,14 +64,6 @@ bool CSlideShow::LoadTXTRDep(std::string_view name) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CSlideShow::AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps) {
|
||||
for (const TLockedToken<CDependencyGroup>& token : deps) {
|
||||
if (!token.IsLoaded())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) {
|
||||
switch (msg.GetType()) {
|
||||
case EArchMsgType::TimerTick: {
|
||||
|
|
|
@ -98,7 +98,6 @@ private:
|
|||
bool x135_24_ : 1 = true;
|
||||
|
||||
bool LoadTXTRDep(std::string_view name);
|
||||
static bool AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps);
|
||||
|
||||
public:
|
||||
CSlideShow();
|
||||
|
|
Loading…
Reference in New Issue