From 339d6f2a3baa59975a4729182988eaa262e26670 Mon Sep 17 00:00:00 2001 From: "Tormod G. Hellen" Date: Tue, 15 Feb 2022 00:18:49 +0100 Subject: [PATCH] Refactor for clarity. This code was a bit hard to read. The name ought to make it easier. --- world/src/civ/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/world/src/civ/mod.rs b/world/src/civ/mod.rs index 10bc433778..4c01d96f1d 100644 --- a/world/src/civ/mod.rs +++ b/world/src/civ/mod.rs @@ -1006,7 +1006,7 @@ fn loc_suitable_for_site(sim: &WorldSim, loc: Vec2, site_kind: SiteKind) -> } true } - (if let Some(chunk) = sim.get(loc) { + let possible_terrain = if let Some(chunk) = sim.get(loc) { !chunk.river.is_ocean() && !chunk.river.is_lake() && !chunk.river.is_river() @@ -1017,7 +1017,9 @@ fn loc_suitable_for_site(sim: &WorldSim, loc: Vec2, site_kind: SiteKind) -> && site_kind.is_suitable_loc(chunk) } else { false - }) && check_chunk_occupation(sim, loc, site_kind.exclusion_radius()) + }; + let not_occupied = check_chunk_occupation(sim, loc, site_kind.exclusion_radius()); + possible_terrain && not_occupied } /// Attempt to search for a location that's suitable for site construction