From d3217c5ae3e04278c785c84732d9ce59bae1991d Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sat, 28 Feb 2026 23:25:02 +0100 Subject: [PATCH] fix(simulation): replace f32 fields in generator with integer types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BlockPlacement.street_width_factor (f32) → street_width_bps (u16, basis points where 10000 = 1.0×). BlockSkeleton.density (f32) → density_pct (u8, 0–100 percentage). Eliminates latent f32 non-determinism per D-010 principle 1. Co-Authored-By: Claude Opus 4.6 --- server/src/simulation/generator.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/src/simulation/generator.rs b/server/src/simulation/generator.rs index b067b8298..b4fa2cb89 100644 --- a/server/src/simulation/generator.rs +++ b/server/src/simulation/generator.rs @@ -301,8 +301,9 @@ pub struct BlockPlacement { pub offset: (i16, i16), /// Rotation in 15° increments (0–3, max 45°). pub rotation_steps: u8, - /// Street width multiplier (0.75–2.0; default 1.0 = 4 visual tiles). - pub street_width_factor: f32, + /// Street width in basis points (10000 = 1.0×, range 7500–20000 for 0.75–2.0×). + /// Default 10000 = 4 visual tiles. Uses integer to avoid f32 non-determinism (D-010). + pub street_width_bps: u16, } /// Single block within a district's 4×4 block grid. @@ -319,8 +320,9 @@ pub struct BlockSkeleton { pub era: Era, pub era_modifications: Vec, pub era_cause: Option, - /// Build density scalar (0.0 = open/empty, 1.0 = fully built-up). - pub density: f32, + /// Build density percentage (0 = open/empty, 100 = fully built-up). + /// Integer to avoid f32 non-determinism (D-010). + pub density_pct: u8, pub landmark: Option, }