bug(time-attack): timer can underflow to negative values #55

Closed
opened 2026-05-28 01:48:59 +00:00 by funman300 · 0 comments
Owner

Bug

The Time Attack countdown timer in time_attack_plugin.rs decrements by delta_seconds each frame without clamping to zero. If a frame takes longer than the remaining time (e.g. a hitch or background process), the timer ticks past zero into negative territory before the game-over logic fires on the next frame.

Affected file

solitaire_engine/src/time_attack_plugin.rs

Fix

Clamp the timer value to 0.0 after subtraction:

remaining.0 = (remaining.0 - time.delta_seconds()).max(0.0);

Then trigger game-over when remaining.0 <= 0.0.

## Bug The Time Attack countdown timer in `time_attack_plugin.rs` decrements by `delta_seconds` each frame without clamping to zero. If a frame takes longer than the remaining time (e.g. a hitch or background process), the timer ticks past zero into negative territory before the game-over logic fires on the next frame. ## Affected file `solitaire_engine/src/time_attack_plugin.rs` ## Fix Clamp the timer value to `0.0` after subtraction: ```rust remaining.0 = (remaining.0 - time.delta_seconds()).max(0.0); ``` Then trigger game-over when `remaining.0 <= 0.0`.
funman300 added the bugcorrectness labels 2026-05-28 01:48:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#55