evaluate_on_win uses .last() — drops all but the final GameWonEvent when multiple fire in one frame #29

Closed
opened 2026-05-19 18:44:35 +00:00 by funman300 · 0 comments
Owner

File

solitaire_engine/src/achievement_plugin.rs line 165

Description

wins.read().last() only processes the final GameWonEvent per frame. If multiple events arrive (e.g. integration tests, replaying quickly), earlier wins in the same frame skip achievement evaluation entirely. This is inconsistent with progress_plugin.rs:award_xp_on_win, which correctly iterates for ev in wins.read().

Fix

Change to for ev in wins.read() { ... } to handle every win event, matching the pattern in progress_plugin.rs.

## File `solitaire_engine/src/achievement_plugin.rs` line 165 ## Description `wins.read().last()` only processes the final `GameWonEvent` per frame. If multiple events arrive (e.g. integration tests, replaying quickly), earlier wins in the same frame skip achievement evaluation entirely. This is inconsistent with `progress_plugin.rs:award_xp_on_win`, which correctly iterates `for ev in wins.read()`. ## Fix Change to `for ev in wins.read() { ... }` to handle every win event, matching the pattern in `progress_plugin.rs`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#29