style(simulation): cargo fmt on the T-1174 batch (gate bounce)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -336,10 +336,7 @@ pub fn analyze(
|
|||||||
);
|
);
|
||||||
let (mut relief_lo, mut relief_hi, mut relief_dry) = (i32::MAX, i32::MIN, 0i32);
|
let (mut relief_lo, mut relief_hi, mut relief_dry) = (i32::MAX, i32::MIN, 0i32);
|
||||||
for &co in &RELIEF_TRANSECT_CHUNK_OFFSETS {
|
for &co in &RELIEF_TRANSECT_CHUNK_OFFSETS {
|
||||||
let cpos = (
|
let cpos = (district_origin_chunk.0 + co, district_origin_chunk.1 + co);
|
||||||
district_origin_chunk.0 + co,
|
|
||||||
district_origin_chunk.1 + co,
|
|
||||||
);
|
|
||||||
let cctx = derive_chunk_context(world_seed, body_id, prof, cpos, None);
|
let cctx = derive_chunk_context(world_seed, body_id, prof, cpos, None);
|
||||||
let tx = cpos.0 * CHUNK_M + CHUNK_M / 2;
|
let tx = cpos.0 * CHUNK_M + CHUNK_M / 2;
|
||||||
let ty = cpos.1 * CHUNK_M + CHUNK_M / 2;
|
let ty = cpos.1 * CHUNK_M + CHUNK_M / 2;
|
||||||
|
|||||||
@@ -2240,10 +2240,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(districts[&cell_east].basin_direction, BasinDirection::East);
|
||||||
districts[&cell_east].basin_direction,
|
|
||||||
BasinDirection::East
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
districts[&cell_south].basin_direction,
|
districts[&cell_south].basin_direction,
|
||||||
BasinDirection::South
|
BasinDirection::South
|
||||||
@@ -3147,7 +3144,11 @@ mod tests {
|
|||||||
let districts = derive_all_districts(test_seed(), ¶ms, &ta, 8, "test_body", None, None);
|
let districts = derive_all_districts(test_seed(), ¶ms, &ta, 8, "test_body", None, None);
|
||||||
// BTreeMap iterates in sorted key order — verify the first key is (0,0).
|
// BTreeMap iterates in sorted key order — verify the first key is (0,0).
|
||||||
let first = districts.keys().next().expect("at least one district");
|
let first = districts.keys().next().expect("at least one district");
|
||||||
assert_eq!(*first, SurveyCellPos(0, 0), "first district must be at origin");
|
assert_eq!(
|
||||||
|
*first,
|
||||||
|
SurveyCellPos(0, 0),
|
||||||
|
"first district must be at origin"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -756,7 +756,10 @@ pub(crate) fn resolve_settlement_morphology_zone(
|
|||||||
heightmap: &crate::atlas::heightmap::BodyHeightmap,
|
heightmap: &crate::atlas::heightmap::BodyHeightmap,
|
||||||
) -> Option<crate::simulation::generator::MorphologyZone> {
|
) -> Option<crate::simulation::generator::MorphologyZone> {
|
||||||
let params = body_params?;
|
let params = body_params?;
|
||||||
let (_l1, ta) = terrain_cache.lock().unwrap().get_or_derive(body_id, heightmap);
|
let (_l1, ta) = terrain_cache
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.get_or_derive(body_id, heightmap);
|
||||||
let climate = ClimateConstants::default();
|
let climate = ClimateConstants::default();
|
||||||
let profile = crate::atlas::district_profile::derive_at_metres(
|
let profile = crate::atlas::district_profile::derive_at_metres(
|
||||||
body_seed,
|
body_seed,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use crate::atlas::body_world_state::{DrainageBasin, RiverNetwork};
|
|||||||
use crate::atlas::drainage::{self, DrainageResult};
|
use crate::atlas::drainage::{self, DrainageResult};
|
||||||
use crate::atlas::features::{self, TerrainAnalysis};
|
use crate::atlas::features::{self, TerrainAnalysis};
|
||||||
use crate::atlas::heightmap::BodyHeightmap;
|
use crate::atlas::heightmap::BodyHeightmap;
|
||||||
use crate::atlas::scale::{BasinDirection, HEIGHTMAP_CELLS_PER_DISTRICT, SurveyCellPos};
|
use crate::atlas::scale::{BasinDirection, SurveyCellPos, HEIGHTMAP_CELLS_PER_DISTRICT};
|
||||||
use crate::atlas::subbiome;
|
use crate::atlas::subbiome;
|
||||||
use crate::simulation::generator::{AttractorType, GeographicAttractor};
|
use crate::simulation::generator::{AttractorType, GeographicAttractor};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|||||||
@@ -675,20 +675,8 @@ pub fn build_district_grid(
|
|||||||
if state.districts.is_empty() {
|
if state.districts.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let cols = state
|
let cols = state.districts.keys().map(|p| p.0).max().unwrap_or(0) as u32 + 1;
|
||||||
.districts
|
let rows = state.districts.keys().map(|p| p.1).max().unwrap_or(0) as u32 + 1;
|
||||||
.keys()
|
|
||||||
.map(|p| p.0)
|
|
||||||
.max()
|
|
||||||
.unwrap_or(0) as u32
|
|
||||||
+ 1;
|
|
||||||
let rows = state
|
|
||||||
.districts
|
|
||||||
.keys()
|
|
||||||
.map(|p| p.1)
|
|
||||||
.max()
|
|
||||||
.unwrap_or(0) as u32
|
|
||||||
+ 1;
|
|
||||||
let n = (cols * rows) as usize;
|
let n = (cols * rows) as usize;
|
||||||
let mut morphology = vec![0u8; n];
|
let mut morphology = vec![0u8; n];
|
||||||
let mut elev_q = vec![0u8; n];
|
let mut elev_q = vec![0u8; n];
|
||||||
@@ -2840,8 +2828,13 @@ mod tests {
|
|||||||
|
|
||||||
// The SAME survey-cell-centre world metres, resolved via the SAME
|
// The SAME survey-cell-centre world metres, resolved via the SAME
|
||||||
// D-256(b) bridge function derive_district_profile uses internally.
|
// D-256(b) bridge function derive_district_profile uses internally.
|
||||||
let (world_x_m, world_y_m) =
|
let (world_x_m, world_y_m) = district_profile::survey_cell_centre_world_m(
|
||||||
district_profile::survey_cell_centre_world_m(cell, gcpr, ta.w, ta.h, params.body_radius_km);
|
cell,
|
||||||
|
gcpr,
|
||||||
|
ta.w,
|
||||||
|
ta.h,
|
||||||
|
params.body_radius_km,
|
||||||
|
);
|
||||||
|
|
||||||
// Riparian equivalent: near_perennial_water_at against the same
|
// Riparian equivalent: near_perennial_water_at against the same
|
||||||
// RiverNetwork, same station spacing/cutoff derive_district_profile
|
// RiverNetwork, same station spacing/cutoff derive_district_profile
|
||||||
@@ -2891,9 +2884,18 @@ mod tests {
|
|||||||
// returns the default; the wrapper post-call-overrides it.
|
// returns the default; the wrapper post-call-overrides it.
|
||||||
expected.basin_direction = basin;
|
expected.basin_direction = basin;
|
||||||
|
|
||||||
assert_eq!(batch_profile.morphology_zone as u8, expected.morphology_zone as u8);
|
assert_eq!(
|
||||||
assert_eq!(batch_profile.tectonic_class as u8, expected.tectonic_class as u8);
|
batch_profile.morphology_zone as u8,
|
||||||
assert_eq!(batch_profile.glaciation_grade as u8, expected.glaciation_grade as u8);
|
expected.morphology_zone as u8
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
batch_profile.tectonic_class as u8,
|
||||||
|
expected.tectonic_class as u8
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
batch_profile.glaciation_grade as u8,
|
||||||
|
expected.glaciation_grade as u8
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
batch_profile.precipitation_class as u8,
|
batch_profile.precipitation_class as u8,
|
||||||
expected.precipitation_class as u8
|
expected.precipitation_class as u8
|
||||||
@@ -2908,7 +2910,10 @@ mod tests {
|
|||||||
batch_profile.vegetation_class as u8,
|
batch_profile.vegetation_class as u8,
|
||||||
expected.vegetation_class as u8
|
expected.vegetation_class as u8
|
||||||
);
|
);
|
||||||
assert_eq!(batch_profile.basin_direction as u8, expected.basin_direction as u8);
|
assert_eq!(
|
||||||
|
batch_profile.basin_direction as u8,
|
||||||
|
expected.basin_direction as u8
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// D-256(c) invariant: the wrapper (`derive_district_profile`) ≡ core
|
/// D-256(c) invariant: the wrapper (`derive_district_profile`) ≡ core
|
||||||
|
|||||||
@@ -1507,7 +1507,10 @@ mod tests {
|
|||||||
SeedChain::for_body(0, "BodyX"),
|
SeedChain::for_body(0, "BodyX"),
|
||||||
&heightmap,
|
&heightmap,
|
||||||
);
|
);
|
||||||
assert_eq!(zone, None, "no body_params → no resolution, caller keeps the stub");
|
assert_eq!(
|
||||||
|
zone, None,
|
||||||
|
"no body_params → no resolution, caller keeps the stub"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// D-256(d): with real `body_params`, `resolve_settlement_morphology_zone`
|
/// D-256(d): with real `body_params`, `resolve_settlement_morphology_zone`
|
||||||
|
|||||||
Reference in New Issue
Block a user