From 3c8f6762c8c03bdf8ed475ba2002f408c4a1fbd3 Mon Sep 17 00:00:00 2001 From: phosit Date: Wed, 18 Sep 2024 19:17:11 +0200 Subject: [PATCH] Change flags to a single bool In `RunGameOrAtlas` only one of thous flags is used. Using a `bool` is simpler and less error-prone. Also reset the variable earlier, so it's easyer to reason about it. --- source/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 6d8e77ee99..f46d760e4f 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -125,6 +125,7 @@ extern "C" #endif #include +#include extern CStrW g_UniqueLogPostfix; @@ -631,7 +632,7 @@ static void RunGameOrAtlas(const PS::span argv) g_frequencyFilter = CreateFrequencyFilter(res, 30.0); // run the game - int flags = INIT_MODS; + bool firstIteration{true}; do { g_Shutdown = ShutdownType::None; @@ -644,9 +645,8 @@ static void RunGameOrAtlas(const PS::span argv) // output log files). FileLogger logger; - if (!Init(args, flags)) + if (!Init(args, std::exchange(firstIteration, false) ? INIT_MODS : 0)) { - flags &= ~INIT_MODS; ShutdownConfigAndSubsequent(); continue; } @@ -708,7 +708,6 @@ static void RunGameOrAtlas(const PS::span argv) guiScriptInterface.reset(); ShutdownConfigAndSubsequent(); MainControllerShutdown(); - flags &= ~INIT_MODS; } while (g_Shutdown == ShutdownType::Restart);