diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory.cpp index d5c9725106..fbdb210e8e 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory.cpp @@ -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 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); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.cpp index 80d18d89bd..d93d8198fc 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.cpp @@ -334,7 +334,7 @@ Outcome StoryExecutor::game(RunState&, const StoryStep& step){ Pokemon::Segment make_story_segment( const std::vector& rows, Pokemon::StoryStepExecutor& executor, - std::set& saved + std::set& saved, Pokemon::StorySaveMode save_mode ){ static const StoryStep SAVE_AT_START = []{ StoryStep step; @@ -348,9 +348,11 @@ Pokemon::Segment make_story_segment( 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; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.h index 6a19c9cd74..5e4115a809 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StoryExecutor.h @@ -222,12 +222,13 @@ class StoryExecutor : public Pokemon::TableExecutor{ }; -// `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& rows, Pokemon::StoryStepExecutor& executor, - std::set& saved + std::set& saved, Pokemon::StorySaveMode save_mode ); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySim.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySim.cpp index f0756f17ed..f61e3d6720 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySim.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySim.cpp @@ -965,8 +965,8 @@ Pokemon::SegmentReport run_rows_on( const std::vector& rows ){ std::set 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(); }; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp index 069bb9e5ef..882351b45c 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp @@ -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" @@ -356,7 +357,7 @@ struct Simulation{ 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"); @@ -446,6 +447,23 @@ UnitTestResult test_start_and_end(Logger&){ 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); + } + for (const std::string& item : sim.trace){ + if (item.starts_with("save in ")){ + return "Expected no save with save mode none:" + joined(sim.trace); + } + } + 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. @@ -674,6 +692,10 @@ const AutoStoryStorySimulationCase AUTO_STORY_STORY_SIMULATION_CASES[] = { .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 = {},