Skip to content

Pokemon Navigation: shared fault classes and fault counters for the sims - #422

Merged
dayfine merged 11 commits into
nav/sim-goldensfrom
nav/sim-faults
Nov 13, 2026
Merged

dayfine merged 11 commits into
nav/sim-goldensfrom
nav/sim-faults

Conversation

@dayfine

@dayfine dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Depends on #419. Base nav/sim-goldens; the diff shows only this change.

BDSP's and FRLG's fault sweeps each keep their own FaultClass enum, and FRLG's sim picks the nth turn tap, step tap or warp to fault with its own counters and std::set<int>s. This adds the shared piece for seam 3's S3-1 in Pokemon/Navigation/Simulation/Pokemon_SimFaults.{h,cpp}: one FaultClass covering both games' classes (scene end pose, scene early, battle opening, wild battles, late fade, slow fade-in, warp no-op, dark cave, lost tap, unseen step), FaultOccurrences (which chances of a fault to fault, numbered from 1 as FRLG's SimScript sets are), and SimFaults, a counter per class. Nothing uses it yet; the per-game switch-overs follow, with the goldens from #420 and #421 unchanged.

Tested with the headless runner: Pokemon::Navigation - Sim (sim faults and sim golden suites), 11 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

… for the sims

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine

dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

API review (claude-sonnet-5-5) at 6d55195: LGTM_with_nits

No bugs or hard-rule violations. The counters behave as described and the tests cover them. Two small style points: the fault-class list is not checked against the enum, and one readability nit in the test helper. The C-style cast and the missing include are minor.

  • [style] SerialPrograms/Source/Pokemon/Navigation/Simulation/Pokemon_SimFaults.cpp:14 fault_classes() restates the enum by hand, and fault_class_name() is a second table of the same data. Nothing fails if someone adds a FaultClass value and forgets the list. The name test iterates only fault_classes(), so it would still pass. The switch in fault_class_name() is protected by -Wswitch, but the list is not. Fix: Add a test that fails when the two disagree, for example by checking that fault_classes().size() equals the enum's value count. That count could come from a trailing sentinel or a static_assert on the last enumerator. Or derive the list from one source.
  • [nit] SerialPrograms/Source/Pokemon/Navigation/Simulation/Pokemon_SimFaults_Tests.cpp:88 The ternary that picks between two std::format calls just to place a separator is denser than it needs to be. Fix: Write it as if (!out.empty()){ out += ", "; } followed by out += std::format("{}", number);.
  • [nit] SerialPrograms/Source/Pokemon/Navigation/Simulation/Pokemon_SimFaults_Tests.cpp:98 This line uses a C-style (int) cast, while test_class_names in the same file uses static_cast<int>. Fix: Use static_cast<int>(faulted_at.size()).
  • [nit] SerialPrograms/Source/Pokemon/Navigation/Simulation/Pokemon_SimFaults_Tests.cpp:45 std::move is used but is not included. It currently arrives transitively. Fix: Add #include <utility>.

dayfine and others added 3 commits November 12, 2026 15:06

@dayfine dayfine left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed SHA: c55e280

LGTM_with_nits

Verdict

APPROVED

No bugs. Counters, enum/list consistency test, CMake and runner registration, and control-flow formatting are fine. Defensive-reader bar: nothing parses input here; SimFaults::chances()/faulted() use find and return 0 for an unknown class, next() on an unnamed class counts and faults none, and an empty or non-positive std::set never faults, so no crash path.

Prior review (801c8bf) findings:

  • [nit, NOT fixed] fault_class_name() still returns the bare literal "?" for an unknown value, test_class_names() and test_classes_match_enum() still compare against that literal as an end-of-enum marker, and the header does not document the fallback. Fix: constexpr std::string_view UNKNOWN_FAULT_CLASS_NAME = "?"; declared in the header, used in the .cpp and both tests, with one header line saying what an unknown value returns.

New nits:

  • [nit] The test comment says a class with no name "fails to build". That holds only because warnings are errors (-Wswitch is a warning, /W4 /WX and strict CI flags); say "fails the warnings-as-errors build".
  • [nit] The description's "11 passed" was not re-run in this review (no build was made); it is the author's claim, and the test file adds 6 cases, the rest being the golden suites.

dayfine added a commit that referenced this pull request Nov 13, 2026
@dayfine
dayfine merged commit 567d6d0 into nav/sim-goldens Nov 13, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant