Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void BDSPAutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerCo
throw UserSetupError(env.console, "Verify mode reloads the start's save between runs: turn off \"Start a new game first\".");
}
std::set<std::string> saved = saved_before_the_run(checkpoints, first, start);
Pokemon::Segment segment = make_story_segment(checkpoints, executor, saved);
Pokemon::Segment segment = make_story_segment(checkpoints, executor, saved, RUN.policy().save_mode);
Pokemon::StoryGameHooks game = story_game(env, context);
Pokemon::RunState state;
start_story(env, context, checkpoints[first], start, game, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@
}


Pokemon::Segment make_story_segment(

Check warning on line 335 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonBDSP::make_story_segment( const std :: vector<StoryCheckpoint> & rows , Pokemon :: StoryStepExecutor & executor , std :: set<std::string> & saved , Pokemon :: StorySaveMode save_mode): function_lines=47 (advisory above 25, limit 50)
const std::vector<StoryCheckpoint>& rows, Pokemon::StoryStepExecutor& executor,
std::set<std::string>& saved
std::set<std::string>& saved, Pokemon::StorySaveMode save_mode
){
static const StoryStep SAVE_AT_START = []{
StoryStep step;
Expand All @@ -348,9 +348,11 @@
for (const StoryCheckpoint& row : rows){
segment.checkpoints.push_back(Pokemon::CheckpointSpec{
.id = row.id, .title = row.title, .saves = false,
.build = [&row, &executor, &saved]{
.build = [&row, &executor, &saved, save_mode]{
Pokemon::Checkpoint steps = Pokemon::build_story_checkpoint(row, executor);
if (row.on_failure != StoryFailure::RELOAD_AND_RETRY){
// Only PER_CHECKPOINT saves part-way through a run (console
// B, 2026-11-11: save mode none saved at 00.05b's start).
if (row.on_failure != StoryFailure::RELOAD_AND_RETRY || save_mode != Pokemon::StorySaveMode::PER_CHECKPOINT){
return steps;
}
StoryStep save_at_start = SAVE_AT_START;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* BDSP AutoStory - Story executor

Check warning on line 1 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.h

View workflow job for this annotation

GitHub Actions / code-health

Code health (bypass)

<header>: header_symbols=10 over limit 8, bypassed by the tag at line 3: "BDSP story executor and checkpoint execution primitives"
*
// code-health: allow header_symbols -- BDSP story executor and checkpoint execution primitives
*
Expand Down Expand Up @@ -222,12 +222,13 @@
};


// `rows` (kept alive by the caller) as one segment. A row that reloads on
// failure saves first, unless `saved` says it has in this run: a retry
// starts from that save. `executor` and `saved` must outlive the segment.
// `rows` (kept alive by the caller) as one segment run in `save_mode`. In
// PER_CHECKPOINT a row that reloads on failure saves first, unless `saved`
// says it has in this run: a retry starts from that save. Other modes never
// save at a row's start. `executor` and `saved` must outlive the segment.
Pokemon::Segment make_story_segment(
const std::vector<StoryCheckpoint>& rows, Pokemon::StoryStepExecutor& executor,
std::set<std::string>& saved
std::set<std::string>& saved, Pokemon::StorySaveMode save_mode
);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,8 @@ Pokemon::SegmentReport run_rows_on(
const std::vector<StoryCheckpoint>& rows
){
std::set<std::string> saved;
Pokemon::Segment segment = make_story_segment(rows, executor, saved);
Pokemon::SegmentPolicy policy;
Pokemon::Segment segment = make_story_segment(rows, executor, saved, policy.save_mode);
policy.attempts_per_checkpoint = 1;
Pokemon::SegmentHooks hooks;
hooks.reload = [](RunState&){ return Pokemon::outcome_ok(); };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* BDSP AutoStory Story Simulation Tests

Check warning on line 1 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=735 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -26,6 +26,7 @@
#include "Pokemon/AutoStory/Pokemon_BuiltinStoryActions.h"
#include "Pokemon/AutoStory/Pokemon_StoryStepExecutor.h"
#include "Pokemon/AutoStory/Types/Pokemon_GridPose.h"
#include "Pokemon/AutoStory/Types/Pokemon_StorySaveMode.h"
#include "Pokemon/AutoStory/Pokemon_TilePose.h"
#include "PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RobustRoute.h"
#include "PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_WalkRules.h"
Expand Down Expand Up @@ -356,7 +357,7 @@

Pokemon::SegmentReport run(const Pokemon::SegmentRange& range, Language language = Language::Japanese){
game.set_language(language);
Pokemon::Segment segment = make_story_segment(story_checkpoints(), game, saved);
Pokemon::Segment segment = make_story_segment(story_checkpoints(), game, saved, policy.save_mode);
Pokemon::SegmentHooks hooks;
hooks.reload = [this](RunState&){
trace.push_back("reload");
Expand Down Expand Up @@ -446,6 +447,23 @@
return true;
}

// Console B, 2026-11-11: with save mode none, 00.05b and 00.05c saved at
// their starts, overwriting 00.05's save. Save mode none saves nowhere.
UnitTestResult test_save_mode_none_saves_nowhere(Logger&){
Simulation sim;
sim.policy.save_mode = Pokemon::StorySaveMode::NONE;
const Pokemon::SegmentReport report = sim.run({.from = "00.04b", .to = "00.05c"});
if (!report.completed){
return "Expected 00.04b to 00.05c through:" + joined(sim.lines);

Check warning on line 457 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
for (const std::string& item : sim.trace){
if (item.starts_with("save in ")){
return "Expected no save with save mode none:" + joined(sim.trace);

Check warning on line 461 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
}
return true;
}

// r72: a blackout in 00.04b's training. The checkpoint resets to the save
// it made at its start, does not save again, and walks from that save's
// pose to the grass again.
Expand Down Expand Up @@ -674,6 +692,10 @@
.input = {"start and end checkpoints", test_start_and_end},
.expectation = {},
},
{
.input = {"save mode none saves at no row's start, 00.04b to 00.05c (lab-B, 2026-11-11)", test_save_mode_none_saves_nowhere},
.expectation = {},
},
{
.input = {"a blackout in 00.04b's training resets to its save", test_training_blackout},
.expectation = {},
Expand Down
Loading