From d887e93dfb7008d4fc5126af6dfe00e37eaeb467 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 22 Oct 2026 17:32:33 -0700 Subject: [PATCH] Log one line naming the slot and quest for every BBQ reroll A reroll's decision was logged when the panel was planned ("Reroll selected. Rerolling quest."), with no slot or quest, and the reroll itself logged nothing until it was verified. With two rerolls planned, the second spent 10 BP ~30 s later with no line of its own (R5 12:45:40, 13:01:31), so log scans counted it as a reroll that was never selected. reroll_quest(), which every slot reroll goes through, now logs "Rerolling quest N (slug)." before it opens the panel, whatever the result. The slug comes from BBQuests_enum_to_string(), as in the quest reads, or is "unknown" for an undetected quest. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../Programs/Farming/PokemonSV_BBQTests.cpp | 18 +++++++++++++++++- .../Farming/PokemonSV_BlueberryQuests.cpp | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BBQTests.cpp b/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BBQTests.cpp index 03433af297..2c87ea1bc2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BBQTests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BBQTests.cpp @@ -75,6 +75,13 @@ class NullLogger : public Logger{ public: virtual void log(const std::string&, Color) override{} }; +class RecordingLogger : public Logger{ +public: + std::vector lines; + virtual void log(const std::string& line, Color) override{ + lines.push_back(line); + } +}; // A singleplayer quest panel that behaves like the game's: 3 blue quests, // and a completed quest is replaced by a new one. process_quest_list() @@ -536,9 +543,18 @@ class Test_BBQReroll : public UnitTest{ panel.out_of_bp = m_scenario.out_of_bp; panel.missed_reads = m_scenario.missed_reads; - NullLogger logger; + RecordingLogger logger; std::vector quests = m_scenario.quests; const BBQRerollResult result = reroll_quest(logger, panel, quests, m_scenario.slot); + //Each reroll logs one line naming its slot and quest, whatever the result. + const std::string reroll_line = "Rerolling quest " + std::to_string(m_scenario.slot + 1) + + " (" + BBQuests_enum_to_string(m_scenario.quests[m_scenario.slot]) + ")."; + const size_t reroll_lines = std::count_if(logger.lines.begin(), logger.lines.end(), [](const std::string& line){ + return line.starts_with("Rerolling quest "); + }); + if (reroll_lines != 1 || std::find(logger.lines.begin(), logger.lines.end(), reroll_line) == logger.lines.end()){ + return "Expected one log line \"" + reroll_line + "\", got " + std::to_string(reroll_lines) + " reroll lines."; + } if (result != m_scenario.expected){ return "Expected " + reroll_result_to_string(m_scenario.expected) + ", got " + reroll_result_to_string(result); diff --git a/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp b/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp index 091a6374f4..f61e9e6e7a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp @@ -296,6 +296,9 @@ BBQRerollResult reroll_quest( std::vector& quests, size_t slot ){ + //Every slot reroll logs this one line, whatever decided it, so a log shows each BP spent. + const std::string quest = slot < quests.size() ? BBQuests_enum_to_string(quests[slot]) : ""; + logger.log("Rerolling quest " + std::to_string(slot + 1) + " (" + (quest.empty() ? "unknown" : quest) + ")."); if (!actions.open_panel()){ return BBQRerollResult::PanelNotOpened; }