Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 07ee378

Browse files
probably better compare logic
1 parent d5dbf62 commit 07ee378

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/binary_space_partition.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ fn bsp_gen(width_as_str: &str,
2828
let default_hash: u64 = rand::thread_rng().gen();
2929
let width = width_as_str.parse::<i32>()?;
3030
let height = height_as_str.parse::<i32>()?;
31-
let mut map_subsection_min_size = map_subsection_min_size_as_str.parse::<i32>()?;
3231
let map_subsection_min_room_width = map_subsection_min_room_width_as_str.parse::<i32>()?;
3332
let map_subsection_min_room_height = map_subsection_min_room_height_as_str.parse::<i32>()?;
3433

35-
if map_subsection_min_size < map_subsection_min_room_width || map_subsection_min_size < map_subsection_min_room_height{
36-
map_subsection_min_size = cmp::max(map_subsection_min_room_width, map_subsection_min_room_height) + 1
37-
}
34+
let map_subsection_min_size = cmp::max(
35+
map_subsection_min_size_as_str.parse::<i32>()?,
36+
cmp::max(map_subsection_min_room_width, map_subsection_min_room_height) + 1
37+
);
38+
3839
//let seed: &str = Alphanumeric.sample_string(&mut rand::thread_rng(), 32).as_str();
3940

4041
let mut rng: StdRng = SeedableRng::seed_from_u64(hash_as_str.parse::<usize>()?.try_into().unwrap_or(default_hash));

0 commit comments

Comments
 (0)