diff --git a/server/src/atlas/gen_queue.rs b/server/src/atlas/gen_queue.rs index 40b747fd4..28fd621d0 100644 --- a/server/src/atlas/gen_queue.rs +++ b/server/src/atlas/gen_queue.rs @@ -111,10 +111,7 @@ pub enum GenCompletion { block_pos: (u32, u32), }, /// Work item failed — body_id or city_id for logging. - Failed { - item: GenWorkItem, - reason: String, - }, + Failed { item: GenWorkItem, reason: String }, } // --------------------------------------------------------------------------- diff --git a/server/src/atlas/plugin.rs b/server/src/atlas/plugin.rs index cd48473fa..7cbc67189 100644 --- a/server/src/atlas/plugin.rs +++ b/server/src/atlas/plugin.rs @@ -88,6 +88,8 @@ fn drain_generation_completions( } => { if !body_id.is_empty() { if let Some(body_state) = cache.peek_mut(&body_id) { + // TODO(#957): keying by city_id is a stub — a city has multiple districts; + // use DistrictSkeleton.district_id as the DistrictId key when real skeleton gen lands. body_state.districts.insert(city_id, state); } else { tracing::warn!( diff --git a/server/src/simulation/generator.rs b/server/src/simulation/generator.rs index 469de879e..0f4cc6f4f 100644 --- a/server/src/simulation/generator.rs +++ b/server/src/simulation/generator.rs @@ -555,9 +555,13 @@ impl FloorExtent { } } - /// Map a D-110 floor index to the first voxel-z value at that floor's base. + /// Map a building-relative voxel-z coordinate to the D-110 floor index that contains it. /// - /// Returns `None` if `floor_index` is outside `[base_floor, base_floor + floor_count)`. + /// Returns the floor index whose voxel span covers `voxel_z`, or `None` if `voxel_z` + /// falls outside the building's extent (below base floor or above the topmost floor). + /// + /// `voxel_z` is building-relative: the base floor maps to z = 0. Callers working in + /// world space must subtract the building's world-base z offset before calling this method. pub fn floor_at_voxel_z(&self, voxel_z: i32) -> Option { let voxel_z_for_base = self.voxel_z_for_floor(self.base_floor)?; if voxel_z < voxel_z_for_base { @@ -584,6 +588,9 @@ impl FloorExtent { /// Map a D-110 floor index to the inclusive voxel-z range `(min_z, max_z)`. /// /// Returns `None` if `floor_index` is outside the building's extent. + /// + /// The returned range is building-relative: the base floor maps to z = 0. Callers working + /// in world space must add the building's world-base z offset to the returned values. pub fn voxel_range_for_floor(&self, floor_index: i8) -> Option<(i32, i32)> { let base_z = self.voxel_z_for_floor(self.base_floor)?; let relative = floor_index as i16 - self.base_floor as i16; @@ -741,15 +748,24 @@ pub enum DoorInitialState { pub enum DoorCredential { None, /// Door is only accessible during specified hours (0–23, inclusive range). - TemporalWindow { open_hour: u8, close_hour: u8 }, + TemporalWindow { + open_hour: u8, + close_hour: u8, + }, /// Requires an employment credential from this corporation. - Corporate { corp_id: String }, + Corporate { + corp_id: String, + }, /// Requires a residence credential in this block. - Resident { block_id: String }, + Resident { + block_id: String, + }, /// Law-enforcement / government authority only. Authority, /// Social trust score threshold (basis points; D-010 integer, 10 000 = 1.0). - Social { trust_threshold_bps: u32 }, + Social { + trust_threshold_bps: u32, + }, } /// What a door connects to on the other side (D-231). @@ -807,7 +823,7 @@ pub struct DoorSpec { /// Shared by all tiles in a region; constrains street geometry (D-234) /// and acts as a soft weight on cultural-template eligibility (D-232). /// Carried on `CityGenerationContext` (D-233 amend to D-199). -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] pub enum MorphologyZone { /// Steep-sided inlet — ribbon/hub-and-spoke streets only; pier geometry on water edges. Fjord, @@ -816,6 +832,7 @@ pub enum MorphologyZone { /// Meandering river reach — any pattern. MeanderReach, /// Flat alluvial plain — any pattern; primary default for plains settlements. + #[default] AlluvialPlain, /// Open ocean surface (deep-water context) — hub-and-spoke; perimeter access priority. OpenOcean, @@ -835,12 +852,6 @@ pub enum MorphologyZone { Unknown, } -impl Default for MorphologyZone { - fn default() -> Self { - MorphologyZone::AlluvialPlain - } -} - /// Built-form archetype derived from a settlement's dominant commodity (D-233). /// /// 5 archetypes projected from the 8 cargo-type classifications in `commodities.toml`;