style(simulation): cargo fmt

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 13:19:02 +02:00
co-authored by Claude Fable 5
parent 1ec5cb4fd5
commit 0039bda184
+16 -8
View File
@@ -1156,7 +1156,8 @@ impl RouteGrid {
let (gr0, gc0) = self.to_route_cell(goal);
let (sr, sc, s_ring) = self.nearest_passable_cell(sr0, sc0)?;
let (gr, gc, g_ring) = self.nearest_passable_cell(gr0, gc0)?;
let surcharge = (s_ring as u32 + g_ring as u32).saturating_mul(COASTAL_ACCESS_COST_PER_RING);
let surcharge =
(s_ring as u32 + g_ring as u32).saturating_mul(COASTAL_ACCESS_COST_PER_RING);
let s = sr * self.rw + sc;
let g = gr * self.rw + gc;
if s == g {
@@ -2144,18 +2145,19 @@ mod tests {
let dr = drainage::analyze(&hm.data, hm.width, hm.height, hm.sea_level);
let ta = TerrainAnalysis::analyze(&hm, &dr);
let grid = RouteGrid::build(&ta, &[], w, h);
assert_eq!(grid.scale, 3, "grid_w=180 must downsample at scale=3 for ROUTE_W=64");
assert_eq!(
grid.scale, 3,
"grid_w=180 must downsample at scale=3 for ROUTE_W=64"
);
let majority_water_cell = 3; // row-major (row 0, col 3)
assert_eq!(
grid.cost[majority_water_cell],
IMPASSABLE,
grid.cost[majority_water_cell], IMPASSABLE,
"2-of-3 native cells water (a true majority) must be IMPASSABLE"
);
let minority_water_cell = 6; // row-major (row 0, col 6)
assert_ne!(
grid.cost[minority_water_cell],
IMPASSABLE,
grid.cost[minority_water_cell], IMPASSABLE,
"1-of-3 native cells water (a minority) must stay LAND — the \
strict `>` rule does not treat any water touch as impassable"
);
@@ -2259,11 +2261,17 @@ mod tests {
let dr = drainage::analyze(&hm.data, hm.width, hm.height, hm.sea_level);
let ta = TerrainAnalysis::analyze(&hm, &dr);
let grid = RouteGrid::build(&ta, &[], w, h);
assert_eq!(grid.cost[3], IMPASSABLE, "sanity: cell (0,3) must be water-majority");
assert_eq!(
grid.cost[3], IMPASSABLE,
"sanity: cell (0,3) must be water-majority"
);
let (surrogate_r, surrogate_c, ring) = grid
.nearest_passable_cell(0, 3)
.expect("a passable neighbour must exist");
assert!(ring >= 1, "the impassable cell must need a real search, ring 0 would be a no-op test");
assert!(
ring >= 1,
"the impassable cell must need a real search, ring 0 would be a no-op test"
);
// Route A: settlement anchored INSIDE the impassable cell (native col
// 11) — must go through the surrogate-anchor relaxation.