Repository navigation
AutoStory: share AutoStoryStats, add Runs, clearer labels - #519
Conversation
Move SV's AutoStoryStats to Pokemon/AutoStory/Pokemon_AutoStoryStats.h so other games' AutoStory programs can use it. Add a Runs counter, counted at program start. Rename Segment, Checkpoint and Reset to Segments Started, Checkpoints Passed and Resets, with aliases so saved totals carry over.
dayfine
left a comment
There was a problem hiding this comment.
Reviewed SHA: 14c9bff
Verdict
NEEDS_REWORK
One label is wrong. The aliases, the Runs placement and the mechanical renames are fine.
Medium: "Checkpoints Passed" counts checkpoint starts, not checkpoints passed. m_checkpoints_passed++ runs in checkpoint_save() (PokemonSV_AutoStoryTools.cpp:1182) and in the i==0 branch of checkpoint_reattempt_loop_tutorial() (:1505). Both run the save before action(i), so the counter goes up when a checkpoint begins. A run from 03.08 that fails on its first attempt still shows "Checkpoints Passed: 1", and the last checkpoint a run completes is never counted. The old label "Checkpoint" was vague enough to cover this; the new one isn't. The cheap fix is to name it "Checkpoints Started", which also matches "Segments Started" (update the alias target and the test expectations). Moving the increment after action() would change SV's behaviour, so leave that to its own PR if anyone wants it.
Checked, OK:
- Aliases:
parse_and_append_line()stores old labels under their own keys (m_stats["Segment"], ...), andStatsTracker::to_str()folds every aliased key into its target before printing.StatList::aggregate()parses all saved lines into one tracker and prints throughto_str(), so old "Segment"/"Checkpoint"/"Reset" totals do show up under the new labels, and saved files are never rewritten. The three test cases cover old, new and mixed lines. The mixed case also covers the comma in1,234. - Runs is counted after the 16:9 / performance-class checks, the test-code early return and the start/end order checks (each of which throws or returns), and before
require_playerand the settings changes. That's a sensible point: a setup error doesn't count as a run, and anything that touches the game does. - All 40
m_segment++sites were renamed (40-/40+lines); no otherm_segment/m_checkpoint/m_resetusers are left in the tree.ClaimMysteryGift.cpp's unusedAutoStoryStatsstill resolves through theusing. - Test shape (name / input / expectation, nested) matches the house style. The SourceFiles.cmake entries are present.
Nit: the three blank lines removed in AutoStory::program(). Removing them to stay under code health's function-length limit is metric-gaming, but small: the three lines were a double blank line, a blank line before a closing brace and a whitespace-only line, so the diff is a cleanup anyway. Acceptable. If the function grows again, move the setup checks (or the Runs bump plus update_stats) into a helper rather than deleting more blank lines. The PR description could say why those lines changed.
Counts: 1 medium, 1 nit.
SV bumps the counter in checkpoint_save(), before the checkpoint runs, so it counts checkpoints started.
|
Review 5909634093: renamed the label to "Checkpoints Started" (old "Checkpoint" now aliases to it) and the member to |
dayfine
left a comment
There was a problem hiding this comment.
Reviewed SHA: d93032c
Verdict
APPROVED
LGTM. This re-review covers d93032c, the only commit since 14c9bff.
Previous medium (wrong label): fixed. The label is now "Checkpoints Started" and the member is m_checkpoints_started. The change covers the constructor binding, the display order, the Checkpoint alias target and both increment sites in PokemonSV_AutoStoryTools.cpp (checkpoint_save() and the tutorial i==0 branch). The increments stay where they were, so SV's behaviour is unchanged. All three test expectations use the new label. The mixed test case still checks that old Checkpoint: 10 folds into new Checkpoints Started: 5 to give 15. No m_checkpoints_passed or "Checkpoints Passed" is left in the tree. "Checkpoints Passed" never reached main, so it needs no alias. CRLF line endings are kept. The PR description now says why the label reads "Started".
Previous nit (blank lines in AutoStory::program()): left as is, which is fine. Nothing new.
Fork Draft CI (ubuntu build + tests, code-health, no-tabs) is green at this SHA.
Counts: 0 findings.
SV's AutoStoryStats lived in the SV AutoStory tools header, so the other games' AutoStory programs couldn't reuse it, and its labels (Segment, Checkpoint, Reset) didn't say what was counted. This moves it to Pokemon/AutoStory/Pokemon_AutoStoryStats.h, adds a Runs counter that SV's AutoStory bumps at program start, and renames the labels to Segments Started, Checkpoints Started (SV counts a checkpoint when it saves at its start) and Resets. StatsTracker aliases map the old labels to the new ones, so saved totals carry over. A new Pokemon::AutoStoryStats unit test loads old, new and mixed stats lines; Fork Draft CI builds and runs it.