diff --git a/reikhelm-core/src/grid.rs b/reikhelm-core/src/grid.rs index 6eb0352..2dbf681 100644 --- a/reikhelm-core/src/grid.rs +++ b/reikhelm-core/src/grid.rs @@ -23,8 +23,11 @@ use crate::geometry::{Point, Rect}; /// /// `Serialize`/`Deserialize` are available whenever `T` itself supports them, /// so a `Grid` can round-trip through serde while a `Grid` -/// simply does not gain those impls. -#[derive(Clone, Debug, Serialize, Deserialize)] +/// simply does not gain those impls. Likewise `PartialEq`/`Eq` are derived and +/// auto-gated on `T`: `Grid` is fully `Eq` (so two maps can be compared +/// directly for determinism tests), while a `Grid` scratch buffer gains +/// only `PartialEq`. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Grid { width: u32, height: u32, diff --git a/reikhelm-core/src/map.rs b/reikhelm-core/src/map.rs index 3bca459..156feac 100644 --- a/reikhelm-core/src/map.rs +++ b/reikhelm-core/src/map.rs @@ -38,11 +38,11 @@ pub enum Tile { /// data directly; the type intentionally holds nothing visual. The `seed` is /// retained for reproducibility โ€” the same seed reproduces this exact map. /// -/// `Map` does not derive `PartialEq`/`Eq` because its `tiles: Grid` does -/// not (the [`crate::grid::Grid`] storage type is generic and only derives the -/// comparison traits where it chooses to). Equality of two maps is established -/// via their serde representation instead โ€” see the round-trip test. -#[derive(Clone, Debug, Serialize, Deserialize)] +/// `Map` derives `PartialEq`/`Eq`: it has no float fields and `Grid` is +/// `Eq`, so two maps generated from the same seed can be compared directly with +/// `==` โ€” the cleanest expression of the determinism contract (spec ยง7). The +/// serde round-trip test additionally checks byte-stable JSON. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Map { /// The base terrain layer: what tile occupies each cell. pub tiles: Grid,