diff --git a/server/src/atlas/district_profile.rs b/server/src/atlas/district_profile.rs index 909c920ea..15f0cda1a 100644 --- a/server/src/atlas/district_profile.rs +++ b/server/src/atlas/district_profile.rs @@ -2188,7 +2188,9 @@ fn lake_from_hydrology_at(ta: &TerrainAnalysis, px: f64, py: f64) -> (bool, i32) 0 } else { let depth = (filled - original).max(0.0); - ((depth / basin_max_depth) * 100.0).round().clamp(0.0, 100.0) as i32 + ((depth / basin_max_depth) * 100.0) + .round() + .clamp(0.0, 100.0) as i32 } } else { 0 diff --git a/server/src/atlas/hydrology_equilibrium.rs b/server/src/atlas/hydrology_equilibrium.rs index a67207098..3eb8230cd 100644 --- a/server/src/atlas/hydrology_equilibrium.rs +++ b/server/src/atlas/hydrology_equilibrium.rs @@ -417,13 +417,13 @@ pub fn solve( // built from — walked directly here rather than through `basins` to // avoid a second clone of every basin's cell list. let mut basin_max_depth_scaled = vec![0i64; n]; - for b in 0..basin_count { - let max_depth = basin_cells[b] + for cells in basin_cells.iter().take(basin_count) { + let max_depth = cells .iter() .map(|&c| (filled[c] - original[c]).max(0)) .max() .unwrap_or(0); - for &c in &basin_cells[b] { + for &c in cells { basin_max_depth_scaled[c] = max_depth; } }