Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
18ce0c8
Merge autostory/engine into autostory/story-breakpoints
dayfine Nov 14, 2026
931cb15
Merge autostory/engine into autostory/story-breakpoints
dayfine Nov 14, 2026
dde03e5
Merge origin/autostory/engine into autostory/fault-classes
dayfine Nov 14, 2026
bb240f6
Merge origin/autostory/engine into autostory/launch-from-home
dayfine Nov 14, 2026
2a0c69b
Merge origin/autostory/engine into autostory/shared-story-data
dayfine Nov 14, 2026
fda56d1
Merge origin/autostory/engine into autostory/story-breakpoints
dayfine Nov 14, 2026
b432d7c
AutoStory tests: name each case outside its input
dayfine Nov 14, 2026
6af16df
AutoStory: failures carry their class; a shared fault sweep by class
dayfine Nov 14, 2026
da0d5a4
Merge remote-tracking branch 'origin/autostory/engine' into autostory…
dayfine Nov 14, 2026
5334a11
AutoStory fault sweep: nest Failure and Injector in their structs
dayfine Nov 14, 2026
0957678
Story data codec: drop the stale PokemonSimulation native conformance…
dayfine Nov 14, 2026
929298e
Merge nav/story-engine into nav/screen-state: drop the stale native c…
dayfine Nov 14, 2026
ee797a4
ScreenEvents tests: the case's name outside its input (code health te…
dayfine Nov 14, 2026
564859c
Merge nav/screen-state into autostory/engine: conformance run dropped…
dayfine Nov 14, 2026
a44ab05
ScreenEvents: comments say why without lab runs or PR numbers (#313 r…
dayfine Nov 14, 2026
68e4ecf
AutoStory: a single step after the last target leaves the end pose un…
dayfine Nov 14, 2026
2cb688b
Merge nav/story-engine into nav/screen-state: end pose after a single…
dayfine Nov 14, 2026
9637e7c
Merge nav/screen-state into autostory/engine: review fixes from #312 …
dayfine Nov 14, 2026
6935936
AutoStory engine: name the text press timing (#332 review)
dayfine Nov 14, 2026
e2f3dd5
Merge nav/story-engine (#312) into nav/shared
dayfine Nov 14, 2026
6ccd314
Merge nav/shared into nav/screen-state: #312 merged
dayfine Nov 14, 2026
4f15782
Merge nav/screen-state (#313) into nav/shared
dayfine Nov 14, 2026
10b6a33
Merge nav/shared into autostory/engine: #312 and #313 merged
dayfine Nov 14, 2026
97f2018
Merge autostory/engine into autostory/launch-from-home: #312 and #313…
dayfine Nov 14, 2026
6bb699b
Merge autostory/engine into autostory/fault-classes: #312 and #313 me…
dayfine Nov 14, 2026
7ace2f2
Merge autostory/engine into autostory/shared-story-data: #312 and #31…
dayfine Nov 14, 2026
0e50418
Merge autostory/engine into autostory/story-breakpoints: #312 and #31…
dayfine Nov 14, 2026
ae2c629
Merge autostory/engine (#332) into nav/shared
dayfine Nov 14, 2026
efe1ea0
Merge autostory/launch-from-home (#477) into nav/shared
dayfine Nov 14, 2026
a95ab2b
Merge nav/shared into autostory/fault-classes: #332 and #477 merged
dayfine Nov 14, 2026
79fc652
Merge nav/shared into autostory/shared-story-data: #332 and #477 merged
dayfine Nov 14, 2026
596ed1d
Merge nav/shared into autostory/story-breakpoints: #332 and #477 merged
dayfine Nov 14, 2026
d8d0958
Merge autostory/fault-classes (#479) into nav/shared
dayfine Nov 14, 2026
b4a3c81
Merge autostory/story-breakpoints (#448) into nav/shared
dayfine Nov 14, 2026
9a093ab
Merge autostory/shared-story-data (#474) into nav/shared
dayfine Nov 14, 2026
aabb349
AutoStory engine: no retry after a SAVE step saved part-way
dayfine Nov 14, 2026
77ece85
AutoStory: SAVE steps in testing, once_per_save in JSON, save option …
dayfine Nov 14, 2026
8cd38a8
AutoStory engine: drop the unused StoryPoseTraits::from_declared()
dayfine Nov 14, 2026
0825ffb
AutoStory: tell INTEGER_ROWS from TIMED_LEGS; assert one arg type per…
dayfine Nov 14, 2026
c4a58f7
AutoStory story files: check reload_when_chained in a user's run too
dayfine Nov 14, 2026
644442d
AutoStory failure classes: function-local table, checked lookup
dayfine Nov 14, 2026
a80d9f3
ScreenEvents: assert the event count; ScreenEventLog tests
dayfine Nov 14, 2026
81e6a30
Merge pull request #490 from dayfine/autostory/engine-fixes
dayfine Nov 14, 2026
c004f55
Story data codec: run PokemonSimulation's shared wire cases natively …
dayfine Nov 14, 2026
107ce7b
Game languages: say why FRLG lists six languages and Gen 8-9 one Spanish
dayfine Nov 14, 2026
019fa24
Fix shared story engine review nits
dayfine Nov 14, 2026
98fe0a9
Story data tests: move the argv dispatch to devtools, a malformed cas…
dayfine Nov 14, 2026
fe8fe0c
Game languages: say what a missing reader gives; drop the upstream me…
dayfine Nov 14, 2026
f5ca8ab
StoryFiles test: replace the dev-only reload case with one that loads…
dayfine Nov 14, 2026
2f729c4
Merge pull request #497 from dayfine/autostory/engine-nits
dayfine Nov 15, 2026
3cce494
Merge pull request #494 from dayfine/autostory/story-cases-ci
dayfine Nov 15, 2026
58cee39
AutoStory engine: judge a watch window on the frames it inspected
dayfine Nov 15, 2026
838bf2d
Merge pull request #495 from dayfine/autostory/languages
dayfine Nov 15, 2026
b41b3ab
AutoStory engine: watch a hold-length tail past a covered window
dayfine Nov 15, 2026
890e785
AutoStory tests: default postconditions; case names outside the input
dayfine Nov 15, 2026
3df87aa
AutoStory: default RngHandoffResult fields for Windows Clang
dayfine Nov 15, 2026
97bf64b
AutoStory: shared settle loop and Pokemon Center visit
dayfine Nov 15, 2026
7de986a
AutoStory: settle and Center visit code health
dayfine Nov 15, 2026
3b2950e
Merge remote-tracking branch 'origin/autostory/center-settle' into fr…
dayfine Nov 15, 2026
95f5d62
FRLG AutoStory: red sim cases for the Center visit
dayfine Nov 15, 2026
dc336b5
FRLG AutoStory: settle and Center visit on the shared seam-5 code
dayfine Nov 15, 2026
6f4b913
FRLG AutoStory: Center visit code health
dayfine Nov 15, 2026
1c660b2
AutoStory settle: red tests for a look's quiet start and watched battles
dayfine Nov 15, 2026
b66c278
AutoStory settle: time a look's quiet from its start; watch battles f…
dayfine Nov 15, 2026
499004b
Merge branch 'autostory/center-settle' into frlg/seam5-adopt
dayfine Nov 15, 2026
3659234
FRLG AutoStory: quiet overworld wait counts each look's quiet from it…
dayfine Nov 15, 2026
a186c6e
FRLG AutoStory sim: stub a heal after a Center way in the sim stubbed
dayfine Nov 15, 2026
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
6 changes: 5 additions & 1 deletion .github/workflows/story-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
repository: dayfine/PokemonSimulation
# Synthetic contract cases, not an approved map/resource pin.
ref: 866613fa03e5c4a5eb7e57c91b59fafb44fc7ee3
ref: 4e023f3d57022c68018f95f6fc0a4c0722d53adf
path: publisher
- uses: actions/setup-python@v6
with:
Expand All @@ -28,3 +28,7 @@ jobs:
- run: cmake -S devtools/story-data-tests -B build-story-data -DCMAKE_BUILD_TYPE=Debug
- run: cmake --build build-story-data --config Debug -j4
- run: ctest --test-dir build-story-data -C Debug --output-on-failure
- if: runner.os != 'Windows'
run: ./build-story-data/StoryDataTests publisher/data/story/wire-conformance.json
- if: runner.os == 'Windows'
run: ./build-story-data/Debug/StoryDataTests.exe publisher/data/story/wire-conformance.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ enum class ScreenEvent : uint8_t{
PLAYER_CAN_MOVE, // The overworld with the player in control.
SCREEN_STILL, // The screen barely changed since the frame before.
SWITCH_HOME_MENU, // The Switch's HOME menu: the game is not on the screen.
PLAYER_STILL, // A box around the player barely changed since the
// frame before: people walking elsewhere do not count.
};
// How many ScreenEvent values there are.
constexpr size_t SCREEN_EVENT_COUNT = 11;
constexpr size_t SCREEN_EVENT_COUNT = 12;
static_assert((size_t)ScreenEvent::PLAYER_STILL + 1 == SCREEN_EVENT_COUNT, "PLAYER_STILL is the last ScreenEvent");
// "dialog box", for the log.
std::string screen_event_name(ScreenEvent event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ std::string screen_event_name(ScreenEvent event){
case ScreenEvent::PLAYER_CAN_MOVE: return "player can move";
case ScreenEvent::SCREEN_STILL: return "screen still";
case ScreenEvent::SWITCH_HOME_MENU: return "Switch HOME menu";
case ScreenEvent::PLAYER_STILL: return "player still";
}
return "?";
}
Expand Down
104 changes: 99 additions & 5 deletions SerialPrograms/Source/CommonTools/ScreenEvents/ScreenEvents_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#include <string>
#include <utility>
#include <vector>
#include "Common/Cpp/Time.h"
#include "Common/Cpp/TestRunners/UnitTest.h"
#include "CommonFramework/ImageTypes/ImageRGB32.h"
#include "ScreenEventLog.h"
#include "ScreenEventTypes.h"
#include "ScreenFades.h"
#include "ScreenEvents.h"
Expand Down Expand Up @@ -134,20 +136,20 @@ UnitTestResult test_watcher(){

struct ScreenEventsCase{
struct Input{
std::string name;
std::function<UnitTestResult()> body;
};
struct Expectation{
};

std::string name;
Input input;
Expectation expectation;
};

class Test_ScreenEvents : public UnitTest{
public:
explicit Test_ScreenEvents(ScreenEventsCase test_case)
: UnitTest(std::format("CommonTools::ScreenEvents - {}", test_case.input.name))
: UnitTest(std::format("CommonTools::ScreenEvents - {}", test_case.name))
, m_case(std::move(test_case))
{}
virtual UnitTestResult run(Logger&, CancellableScope&) const override{
Expand All @@ -163,23 +165,115 @@ class Test_ScreenEvents : public UnitTest{

const ScreenEventsCase SCREEN_EVENTS_CASES[] = {
{
.input = {"a set of events, its fade and its log text", test_set_and_describe},
.name = "a set of events, its fade and its log text",
.input = {.body = test_set_and_describe},
.expectation = {},
},
{
.input = {"a fade is uniform, dark or white; a textured floor is none", test_fade_of_screen},
.name = "a fade is uniform, dark or white; a textured floor is none",
.input = {.body = test_fade_of_screen},
.expectation = {},
},
{
.input = {"an observer as a watcher records and stops", test_watcher},
.name = "an observer as a watcher records and stops",
.input = {.body = test_watcher},
.expectation = {},
},
};

namespace{

// A stream of frames into a ScreenEventLog, and its describe() text.
struct ScreenEventLogCase{
struct Frame{
int ms = 0;
std::vector<ScreenEvent> events;
};
struct Input{
size_t capacity = 0;
std::vector<Frame> frames;
};
struct Expectation{
// describe() of the log, times from the first frame.
std::string text;
size_t dropped = 0;
};

std::string name;
Input input;
Expectation expectation;
};

class Test_ScreenEventLog : public UnitTest{
public:
explicit Test_ScreenEventLog(ScreenEventLogCase test_case)
: UnitTest(std::format("CommonTools::ScreenEventLog - {}", test_case.name))
, m_case(std::move(test_case))
{}
virtual UnitTestResult run(Logger&, CancellableScope&) const override{
ScreenEventLog log(m_case.input.capacity);
const WallClock origin = current_time();
for (const ScreenEventLogCase::Frame& frame : m_case.input.frames){
ScreenEvents events;
for (ScreenEvent event : frame.events){
events.set(event, true);
}
log.record(events, origin + Milliseconds(frame.ms));
}
if (log.dropped() != m_case.expectation.dropped){
return std::format("dropped(): expected {}, got {}", m_case.expectation.dropped, log.dropped());
}
return expect_equal("describe()", describe(log, origin), m_case.expectation.text);
}

private:
ScreenEventLogCase m_case;
};

} // namespace

const ScreenEventLogCase SCREEN_EVENT_LOG_CASES[] = {
{
.name = "no frames",
.input = {.capacity = 8, .frames = {}},
.expectation = {.text = "no changes", .dropped = 0},
},
{
.name = "the first frame's events all rise",
.input = {.capacity = 8, .frames = {{.ms = 0, .events = {ScreenEvent::DIALOG_BOX, ScreenEvent::SCREEN_STILL}}}},
.expectation = {.text = "+0 ms dialog box rose\n+0 ms screen still rose\n", .dropped = 0},
},
{
.name = "only changes are kept, rising and falling",
.input = {.capacity = 8, .frames = {
{.ms = 0, .events = {ScreenEvent::PLAYER_CAN_MOVE}},
{.ms = 100, .events = {ScreenEvent::PLAYER_CAN_MOVE}},
{.ms = 200, .events = {ScreenEvent::FADE_BLACK}},
{.ms = 900, .events = {}},
}},
.expectation = {
.text = "+0 ms player can move rose\n+200 ms black fade rose\n+200 ms player can move fell\n+900 ms black fade fell\n",
.dropped = 0,
},
},
{
.name = "the oldest changes drop past the capacity",
.input = {.capacity = 2, .frames = {
{.ms = 0, .events = {ScreenEvent::DIALOG_BOX}},
{.ms = 100, .events = {}},
{.ms = 200, .events = {ScreenEvent::CHOICE_BOX}},
}},
.expectation = {.text = "(1 older changes dropped)\n+100 ms dialog box fell\n+200 ms choice box rose\n", .dropped = 1},
},
};

void add_tests_ScreenEvents(UnitTestDatabase& database){
for (const auto& item : SCREEN_EVENTS_CASES){
database.add<Test_ScreenEvents>(item);
}
for (const auto& item : SCREEN_EVENT_LOG_CASES){
database.add<Test_ScreenEventLog>(item);
}
}


Expand Down
9 changes: 4 additions & 5 deletions SerialPrograms/Source/CommonTools/ScreenEvents/ScreenFades.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ ScreenEvents fade_events(WarpFade fade);
WarpFade fade_in(const ScreenEvents& events);


// A fade is uniform over the middle 80% of the screen, the shared
// Black/WhiteScreenWatcher's stddev test (upstream #1717): a dim cave floor
// is textured, so it is no fade (BDSP's Oreburgh Gate, mean 46, lab-B
// 2026-11-08). Check against the Gate's frames on the console before
// tightening.
// A fade is uniform over the middle 80% of the screen, the same stddev
// test as the shared Black/WhiteScreenWatcher: a dim cave floor (mean
// about 46 a channel) is textured, so it is no fade. A tighter bound
// needs checking against such dim floors first.
constexpr double FADE_MAX_STDDEV_SUM = 10;
// Dark goes to an rgb sum of 225, as a cave mouth's fade is dim, 45 to 64
// a channel, not black.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace NintendoSwitch{

// A game's observer behind a look at the Switch itself: a frame showing
// the HOME menu shows SWITCH_HOME_MENU and nothing else, as a game's
// detectors may read HOME's plain screen as a quiet overworld (BDSP,
// lab-B 2026-11-09). Every other frame is the game's to read.
// detectors may read HOME's plain screen as a quiet overworld. Every
// other frame is the game's to read.
class SwitchHomeObserver : public ScreenEventObserver{
public:
SwitchHomeObserver(ConsoleHandle& console, ScreenEventObserver& game);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ enum class Failure{
};

struct AuthoredCase{
std::string name;
struct Input{
std::string name;
std::string json;
std::string game = "frlg";
bool resource = false;
Expand All @@ -54,21 +54,21 @@ struct AuthoredCase{
};

const AuthoredCase CASES[] = {
{.input = {.name = "FRLG envelope", .json = FRLG}, .expectation = {}},
{.input = {.name = "BDSP embedded resource", .json = BDSP, .game = "bdsp", .resource = true}, .expectation = {
{.name = "FRLG envelope", .input = {.json = FRLG}, .expectation = {}},
{.name = "BDSP embedded resource", .input = {.json = BDSP, .game = "bdsp", .resource = true}, .expectation = {
.checkpoint = "01.03", .execution = R"({"on_failure":"reload_and_retry","saves_in":"Oreburgh City"})", .events = {"roark"}}},
{.input = {.name = "FRLG embedded resource", .json = FRLG, .resource = true}, .expectation = {}},
{.input = {.name = "wrong game", .json = BDSP}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "empty expected game", .json = FRLG, .game = ""}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "missing resource", .json = FRLG, .resource = true, .file = "absent"}, .expectation = {.failure = Failure::MISSING_RESOURCE}},
{.input = {.name = "invalid embedded JSON", .json = "{", .resource = true}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "wrong format", .json = R"({"format":"future","game":"frlg","checkpoint":{},"execution":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "missing execution", .json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "same count wrong field", .json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{},"extra":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "extra envelope field", .json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{},"execution":{},"extra":0})"}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "execution must be object", .json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{"id":"x","title":"X","events":[]},"execution":false})"}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "invalid common action", .json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{"id":"x","title":"X","events":[{"id":"bad","kind":"magic"}]},"execution":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.input = {.name = "execution stays game owned", .json = R"({"format":"pokesim-authored-checkpoint/1","game":"future","checkpoint":{"id":"x","title":"X","events":[]},"execution":{"zero":0,"false":false,"null":null}})", .game = "future"}, .expectation = {
{.name = "FRLG embedded resource", .input = {.json = FRLG, .resource = true}, .expectation = {}},
{.name = "wrong game", .input = {.json = BDSP}, .expectation = {.failure = Failure::PARSE}},
{.name = "empty expected game", .input = {.json = FRLG, .game = ""}, .expectation = {.failure = Failure::PARSE}},
{.name = "missing resource", .input = {.json = FRLG, .resource = true, .file = "absent"}, .expectation = {.failure = Failure::MISSING_RESOURCE}},
{.name = "invalid embedded JSON", .input = {.json = "{", .resource = true}, .expectation = {.failure = Failure::PARSE}},
{.name = "wrong format", .input = {.json = R"({"format":"future","game":"frlg","checkpoint":{},"execution":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.name = "missing execution", .input = {.json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.name = "same count wrong field", .input = {.json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{},"extra":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.name = "extra envelope field", .input = {.json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{},"execution":{},"extra":0})"}, .expectation = {.failure = Failure::PARSE}},
{.name = "execution must be object", .input = {.json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{"id":"x","title":"X","events":[]},"execution":false})"}, .expectation = {.failure = Failure::PARSE}},
{.name = "invalid common action", .input = {.json = R"({"format":"pokesim-authored-checkpoint/1","game":"frlg","checkpoint":{"id":"x","title":"X","events":[{"id":"bad","kind":"magic"}]},"execution":{}})"}, .expectation = {.failure = Failure::PARSE}},
{.name = "execution stays game owned", .input = {.json = R"({"format":"pokesim-authored-checkpoint/1","game":"future","checkpoint":{"id":"x","title":"X","events":[]},"execution":{"zero":0,"false":false,"null":null}})", .game = "future"}, .expectation = {
.checkpoint = "x", .execution = R"({"zero":0,"false":false,"null":null})", .events = {}}},
};

Expand Down Expand Up @@ -116,7 +116,7 @@ std::string check_case(const AuthoredCase& test){
Loaded actual;
actual.checkpoint = test.input.resource
? load_authored_checkpoint(files, test.input.file, test.input.game, keep_execution(actual.execution))
: read_authored_checkpoint(parse_json(test.input.json), test.input.game, test.input.name, keep_execution(actual.execution));
: read_authored_checkpoint(parse_json(test.input.json), test.input.game, test.name, keep_execution(actual.execution));
return check_loaded(actual, test);
}catch (const ParseException& error){
return test.expectation.failure == Failure::PARSE ? "" : std::format("Unexpected parse failure: {}", error.message());
Expand All @@ -131,7 +131,7 @@ std::string check_case(const AuthoredCase& test){
class AuthoredJsonTest : public UnitTest{
public:
explicit AuthoredJsonTest(AuthoredCase test)
: UnitTest(std::format("Pokemon::AuthoredCheckpointJson - {}", test.input.name))
: UnitTest(std::format("Pokemon::AuthoredCheckpointJson - {}", test.name))
, m_case(std::move(test))
{}

Expand Down Expand Up @@ -172,7 +172,7 @@ int main(){
int failed = 0;
for (const auto& test : PokemonAutomation::Pokemon::CASES){
const std::string error = PokemonAutomation::Pokemon::check_case(test);
std::cout << test.input.name << ": " << (error.empty() ? "PASS" : error) << '\n';
std::cout << test.name << ": " << (error.empty() ? "PASS" : error) << '\n';
failed += !error.empty();
}
return failed != 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,51 @@ void check_in_story_order(
}
}

namespace{

// Which row sequence the reload check applies to.
enum class RunKind{
DEVELOPER,
USER,
};

// Text naming `run` in a reload error.
std::string_view run_suffix(RunKind run){
switch (run){
case RunKind::DEVELOPER:
return "";
case RunKind::USER:
return " in a user's run";
}
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Unknown story run kind.");
}

// Throws ParseException naming `source` unless `previous` ends on the
// game's autosave in `rows`, for `run`.
void check_reload_after(
std::optional<std::string_view> previous, const StoryRows& rows, RunKind run, std::string_view source
){
if (!previous || !rows.autosaves.contains(*previous)){
throw ParseException(std::format(
"{}: reload_when_chained after a checkpoint that does not end on the game's autosave{}: the reload would load an older save",
source, run_suffix(run)
));
}
}

} // namespace

void add_story_row(
std::string_view id, const StoryRowExecution& execution, RowSave start,
std::optional<std::string_view> previous_id, std::string_view source, StoryRows& rows
const PreviousRows& previous, std::string_view source, StoryRows& rows
){
if (execution.reload != StoryReload::NEVER){
if (start == RowSave::WITHOUT_SAVE){
throw ParseException(std::format("{}: reload_when_chained on a checkpoint with no save to reload", source));
}
if (!previous_id || !rows.autosaves.contains(*previous_id)){
throw ParseException(std::format(
"{}: reload_when_chained after a checkpoint that does not end on the game's autosave: the reload would load an older save",
source
));
check_reload_after(previous.in_dev_run, rows, RunKind::DEVELOPER, source);
if (!execution.dev_only && previous.in_user_run != previous.in_dev_run){
check_reload_after(previous.in_user_run, rows, RunKind::USER, source);
}
rows.reload_when_chained.emplace(id);
}
Expand Down
Loading
Loading