Repository navigation
Conversation
StoryRangeOptions holds the start and end checkpoint dropdowns over one story list and checks the start does not come after the end. SV's tutorial and main-story checkpoint pairs now use it, adding the dropdowns under their old keys and with their old labels, defaults and lock modes, so saved settings still load.
dayfine
left a comment
There was a problem hiding this comment.
Testing: we should try to run SV autostory with this
| Source/Pokemon/Options/Pokemon_NameSelectWidget.h | ||
| Source/Pokemon/Options/Pokemon_StatsHuntFilter.cpp | ||
| Source/Pokemon/Options/Pokemon_StatsHuntFilter.h | ||
| Source/Pokemon/Options/Pokemon_StoryRangeOptions.cpp |
There was a problem hiding this comment.
is there an practice to put game / program options under their subdirectories?
if so, we could put this under AutoStory/Options?
There was a problem hiding this comment.
Yes: options live in an Options/ folder of the module that owns them (CommonFramework/Options, each game's Options/, and PokemonSwSh/MaxLair/Options for one feature). Moved to Pokemon/AutoStory/Options in fd8c614.
| OCR::add_tests(ret); | ||
| Kernels::add_tests(ret); | ||
| Pokemon::add_tests_AutoStorySelect(ret); | ||
| Pokemon::add_tests_StoryRangeOptions(ret); |
There was a problem hiding this comment.
If the answer to above is yes, then let's do the add_tests_AutoStoryTests header for collecting autostory tests to avoid keep editing this file
There was a problem hiding this comment.
Added Pokemon/AutoStory/Pokemon_AutoStory_Tests.h with add_tests_AutoStory(), which registers the AutoStorySelect and StoryRangeOptions suites; the runner now calls only that. The PLZA PRs above register their AutoStory suites there too.
| std::move(labels.start), | ||
| checkpoints, | ||
| LockMode::LOCK_WHILE_RUNNING, | ||
| 0 |
There was a problem hiding this comment.
give parameter comment to 0
| std::move(labels.end), | ||
| checkpoints, | ||
| end_lock, | ||
| checkpoints.size() == 0 ? 0 : checkpoints.size() - 1 |
There was a problem hiding this comment.
Done: /default_index=/ on the end too.
| // The checkpoints chosen, by index in the database, both inclusive. | ||
| size_t start_index() const; | ||
| size_t end_index() const; | ||
| // "The start checkpoint comes after the end checkpoint." if it does. |
There was a problem hiding this comment.
this comment is bad -- it should just check if the selected options is valid, or just remove it
There was a problem hiding this comment.
Now: "Checks that the start checkpoint does not come after the end."
| // entries. `end_lock`: UNLOCK_WHILE_RUNNING for a program that reads | ||
| // the end after each checkpoint, so the end can be moved during a run. | ||
| StoryRangeOptions( | ||
| std::string label, const StringSelectDatabase& checkpoints, |
There was a problem hiding this comment.
should this be a string_view?
There was a problem hiding this comment.
Yes, changed to std::string_view by value; it is converted to std::string for GroupOption.
| namespace Pokemon{ | ||
|
|
||
|
|
||
| // A program shows the group, or adds START_CHECKPOINT and END_CHECKPOINT |
There was a problem hiding this comment.
comment is bad
The options in autostory programs to describe the range of checkpoints to run?
There was a problem hiding this comment.
Replaced with your wording: the options in an AutoStory program that pick the range of checkpoints to run.
| ENDPOINT_TUTORIAL.remove_listener(*this); | ||
| STARTPOINT_MAINSTORY.remove_listener(*this); | ||
| ENDPOINT_MAINSTORY.remove_listener(*this); | ||
| TUTORIAL_CHECKPOINTS.START_CHECKPOINT.remove_listener(*this); |
There was a problem hiding this comment.
why do we need these now?
There was a problem hiding this comment.
They aren't needed: the dropdowns are members of AutoStory and die with it, and the old START/END_CHECKPOINT dropdowns never removed their listeners either. Removed.
| return story_index( | ||
| main_story, | ||
| main_story ? START_CHECKPOINT_MAINSTORY.index() : START_CHECKPOINT_TUTORIAL.index(), | ||
| STORY_SECTION == StorySection::MAIN_STORY, |
There was a problem hiding this comment.
this one needs a parameter comment - same below
There was a problem hiding this comment.
Done for both story_index calls: /main_story=/, /index_in_section=/, /first_main_story_index=/.
…ests_AutoStory collects the AutoStory suites
… line, comments); SV drops unneeded remove_listener calls
Brings the reviewed slice chain (#572-#582) into the long-lived branch. Where both sides add the same file, plza/autostory's later version is kept and the slices' review fixes are applied on top: StoryRangeOptions moves to Pokemon/AutoStory/Options with #572's review fixes, SV takes the slices' version, the shared Outcome and Pose functions move to their own .cpp files, and add_tests_AutoStory() also registers the slices' new suites (StoryBackend, CheckpointAttempts, ScreenMachine, PLZA AutoStoryDialogDetector). The slices' PLZA AutoStoryGame tests are left out: they are written against the slices' smaller game API (make_plza_story_game_without_console(), unverified autosaves), which this branch has not adopted; its AutoStoryEngine tests cover the same game. The nine AutoStoryScreenEvents frames missing from CommandLineTests #18 are skipped as pending a recapture.
|
|
||
| // A stand-in for a story checkpoint: only its name is read. | ||
| struct NamedCheckpoint{ | ||
| std::string label; |
There was a problem hiding this comment.
why do we need both name and label here?
There was a problem hiding this comment.
make_story_select_database() labels each entry with list[i]->name(), a member function as on the real checkpoint classes, so the stand-in needs name(); label is just the string it returns. They hold the same value, but neither can go: the template needs the function and the function needs somewhere to keep the string. Pokemon_AutoStorySelect_Tests.cpp uses the same stand-in.
|
|
||
| // The main story's dropdowns: entries 2..4 of the list, slugged 2..4. | ||
| const StringSelectDatabase& main_story_database(){ | ||
| static const StringSelectDatabase database = make_story_select_database(story_list(), 2, story_list().size()); |
There was a problem hiding this comment.
Done in 0758e5c: /*first=*/2, /*last=*/story_list().size().
| std::string end_checkpoint_description(); | ||
|
|
||
| // The checkpoint range of the chosen story section. | ||
| const Pokemon::StoryRangeOptions& checkpoint_range() const; |
There was a problem hiding this comment.
does this need to be public?
There was a problem hiding this comment.
It is already private: it sits under the private: that opens with on_config_value_changed() (line 65), and only AutoStory.cpp calls it, from get_start_checkpoint_index() and get_end_checkpoint_index().
…n the test database
Base: main (fork main contains upstream main e961bf4); the diff shows only this change.
AutoStory programs each build their own start/end checkpoint dropdowns; this adds
Pokemon::StoryRangeOptions(inPokemon/AutoStory/Options), a shared pair of dropdowns over one checkpoint list with a start-after-end check, so BDSP, FRLG and PLZA can share it. SV's tutorial and main-story checkpoint pairs now use it: the dropdowns are added under their old keys (START_CHECKPOINT_TUTORIALetc.) with their old labels, defaults and lock modes, so SV users see the same panel and saved settings still load. The AutoStory unit test suites now register through oneadd_tests_AutoStory(). SV's segment dropdowns and its start/end error messages are unchanged. Tested by the newPokemon::StoryRangeOptionsunit tests (indexes, validity, labels) on Fork Draft CI; nothing on a console.