fix(engine): remove latent unreachable! panic in difficulty seed cursor
The Random arm was only unreachable because seeds_for(Random) returns None in a different function — a future catalog change would turn it into a shipped runtime panic. Returning a system-time seed is the correct Random behaviour either way. CLAUDE.md §2.3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,10 @@ impl DifficultyIndexResource {
|
||||
DifficultyLevel::Hard => &mut self.hard,
|
||||
DifficultyLevel::Expert => &mut self.expert,
|
||||
DifficultyLevel::Grandmaster => &mut self.grandmaster,
|
||||
DifficultyLevel::Random => unreachable!("Random has no catalog"),
|
||||
// Random has no catalog today, so seeds_for() already returned
|
||||
// None above; if it ever gains one, a time seed is still the
|
||||
// right answer for "Random" — never a reachable panic.
|
||||
DifficultyLevel::Random => return seed_from_system_time(),
|
||||
};
|
||||
let seed = catalog[*cursor % catalog.len()];
|
||||
*cursor = cursor.wrapping_add(1);
|
||||
|
||||
Reference in New Issue
Block a user