This commit is contained in:
Pcornat 2024-12-18 22:55:42 +01:00
parent abf68d7ad3
commit 124f15c213
Signed by: Pcornat
GPG Key ID: E0326CC678A00BDD

View File

@ -75,27 +75,29 @@ namespace gui_to_app {
const auto test_result = [this]() -> std::vector<const char *> { const auto test_result = [this]() -> std::vector<const char *> {
const std::array test_ptrs{ const std::array test_ptrs{
std::pair{ "sword_switch", sword_switch == nullptr }, std::pair{ "sword_switch", sword_switch == nullptr },
std::pair{ "lance_switch", lance_switch == nullptr }, std::pair{ "lance_switch", lance_switch == nullptr },
std::pair{ "morgen_switch", morgen_switch == nullptr }, std::pair{ "morgen_switch", morgen_switch == nullptr },
std::pair{ "bow_switch", bow_switch == nullptr }, std::pair{ "bow_switch", bow_switch == nullptr },
std::pair{ "chainmail_switch", chainmail_switch == nullptr }, std::pair{ "chainmail_switch", chainmail_switch == nullptr },
std::pair{ "cookpot_switch", cookpot_switch == nullptr }, std::pair{ "cookpot_switch", cookpot_switch == nullptr },
std::pair{ "pamphlet_switch", pamphlet_switch == nullptr }, std::pair{ "pamphlet_switch", pamphlet_switch == nullptr },
std::pair{ "medkit_switch", medkit_switch == nullptr }, std::pair{ "medkit_switch", medkit_switch == nullptr },
std::pair{ "fourche_switch", fourche_switch == nullptr }, std::pair{ "fourche_switch", fourche_switch == nullptr },
std::pair{ "dagger_switch", dagger_switch == nullptr }, std::pair{ "dagger_switch", dagger_switch == nullptr },
std::pair{ "rock_kit_switch", rock_kit_switch == nullptr }, std::pair{ "rock_kit_switch", rock_kit_switch == nullptr },
std::pair{ "sack_switch", sack_switch == nullptr }, std::pair{ "sack_switch", sack_switch == nullptr },
}; };
std::vector<const char *> test_result; std::vector<const char *> local_test_result;
test_result.reserve(test_ptrs.size()); local_test_result.reserve(test_ptrs.size());
std::for_each(test_ptrs.cbegin(), test_ptrs.cend(), [&test_result](const auto &a) { std::for_each(test_ptrs.cbegin(),
if (a.second) { test_ptrs.cend(),
test_result.emplace_back(a.first); [&local_test_result](const auto &a) {
} if (a.second) {
}); local_test_result.emplace_back(a.first);
return test_result; }
});
return local_test_result;
}(); }();
if (!test_result.empty()) { if (!test_result.empty()) {
spdlog::critical("Error occurred, at least one switch is not available. See logs below"); spdlog::critical("Error occurred, at least one switch is not available. See logs below");
@ -115,5 +117,4 @@ namespace gui_to_app {
} }
quit(); quit();
} }
} // gui_to_app } // gui_to_app