From ea87b81c5030139d14870bcfff504cdfbe010d41 Mon Sep 17 00:00:00 2001 From: pifopi Date: Sun, 24 May 2026 16:27:34 +0200 Subject: [PATCH 1/2] Fix bool arithmetics --- .../Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp index 7674cc2b2a..a784e96ce1 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp @@ -122,7 +122,8 @@ int detect_stall_amount_item(SingleSwitchProgramEnvironment& env, StallBuyer_Des bool is_five_item_stall = five_item_stall_detector.detect(snapshot); bool is_two_item_stall = two_item_stall_detector.detect(snapshot); - int count = is_seven_item_stall + is_six_item_stall + is_five_item_stall + is_two_item_stall; + std::array vec = {is_seven_item_stall, is_six_item_stall, is_five_item_stall, is_two_item_stall}; + auto count = std::count(vec.begin(), vec.end(), true); if (count == 1){ // Exactly one kind of stall detected if (is_seven_item_stall){ From 561ee6c45e565ee0497f1b6e932c224ade11c5ba Mon Sep 17 00:00:00 2001 From: pifopi Date: Sun, 24 May 2026 16:36:50 +0200 Subject: [PATCH 2/2] Fix compilation --- .../Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp index a784e96ce1..a57dfb08e9 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp @@ -18,6 +18,7 @@ #include "PokemonLZA/Inference/PokemonLZA_SelectionArrowDetector.h" #include "PokemonLZA/Inference/PokemonLZA_DialogDetector.h" #include "PokemonLZA_StallBuyer.h" +#include namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -122,8 +123,8 @@ int detect_stall_amount_item(SingleSwitchProgramEnvironment& env, StallBuyer_Des bool is_five_item_stall = five_item_stall_detector.detect(snapshot); bool is_two_item_stall = two_item_stall_detector.detect(snapshot); - std::array vec = {is_seven_item_stall, is_six_item_stall, is_five_item_stall, is_two_item_stall}; - auto count = std::count(vec.begin(), vec.end(), true); + std::array array = {is_seven_item_stall, is_six_item_stall, is_five_item_stall, is_two_item_stall}; + auto count = std::count(array.begin(), array.end(), true); if (count == 1){ // Exactly one kind of stall detected if (is_seven_item_stall){