build(deps): switch card_game/klondike to mainline fb01881f
Build and Deploy / build-and-push (push) Failing after 1m6s
Web E2E / web-e2e (push) Failing after 3m7s

Move both crates off the damaged "hacked" rev 99b49e62 onto mainline
master (card_game 0.4.0->0.4.1, klondike 0.3.0->0.4.0) to pick up the new
serialize implementation.

Mainline drops the serde derives from Deck/Suit/Rank (only Card is serde
now, as a compact transparent NonZeroU8) and gives KlondikeInstruction a
hand-written serde impl. Adapt the repo:
- Rank::value() was removed; the enum discriminant is the 1..=13 value, so
  use `rank as u32/u8` in the three card_to_id helpers (wasm, radial_menu,
  feedback_anim).
- Drop the vestigial Serialize/Deserialize derive on theme::CardKey; theme
  manifests address faces by manifest_name strings, never by serialising
  CardKey, and Suit/Rank no longer implement serde.

GameState's own instruction-mirror serde (schema v3/v4) is insulated from
the klondike serde change, so the on-disk save format is unchanged.

cargo test --workspace and cargo clippy --workspace -- -D warnings pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-10 09:34:56 -07:00
parent 056459619b
commit 2d0359c2ee
7 changed files with 21 additions and 18 deletions
+1 -1
View File
@@ -199,7 +199,7 @@ fn card_to_id(card: &Card) -> u32 {
Suit::Hearts => 2,
Suit::Spades => 3,
};
suit_index * 13 + (card.rank().value() as u32 - 1)
suit_index * 13 + (card.rank() as u32 - 1)
}
// ---------------------------------------------------------------------------
+2 -2
View File
@@ -361,7 +361,7 @@ fn pile_cards(game: &GameState, pile: &KlondikePile) -> Vec<(Card, bool)> {
/// Maps a `card_game::Card` to a stable `u32` identity used by `CardEntity`
/// and systems that still track cards by numeric ID.
/// Encoding: `suit_index * 13 + (rank.value() - 1)`, range 0..=51.
/// Encoding: `suit_index * 13 + (rank as u8 - 1)`, range 0..=51.
fn card_to_id(card: &Card) -> u32 {
use solitaire_core::card::Suit;
let suit_index: u32 = match card.suit() {
@@ -370,7 +370,7 @@ fn card_to_id(card: &Card) -> u32 {
Suit::Hearts => 2,
Suit::Spades => 3,
};
suit_index * 13 + (card.rank().value() as u32 - 1)
suit_index * 13 + (card.rank() as u32 - 1)
}
const fn foundations() -> [Foundation; 4] {
+5 -5
View File
@@ -43,11 +43,11 @@ pub use registry::{
/// Hashable lookup key into [`CardTheme::faces`].
///
/// Distinct from `solitaire_core::Card`: the core type carries an `id`
/// and a `face_up` flag that vary per deal, neither of which is
/// relevant to image lookup. `CardKey` is just the (suit, rank) pair
/// that uniquely identifies which artwork to draw.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
/// Distinct from `card_game::Card`, which also encodes a deck id: `CardKey`
/// is just the (suit, rank) pair that uniquely identifies which artwork to
/// draw. Serialised theme manifests address faces by
/// [`CardKey::manifest_name`] strings, not by serialising `CardKey` itself.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CardKey {
pub suit: Suit,
pub rank: Rank,