This commit is contained in:
parent
d56c6cc5c7
commit
cc4b8751f4
|
@ -33,7 +33,7 @@ derive_more = "0.99"
|
||||||
futures-lite = "1"
|
futures-lite = "1"
|
||||||
gilrs = "0.8"
|
gilrs = "0.8"
|
||||||
here_be_dragons = "0.1"
|
here_be_dragons = "0.1"
|
||||||
maze_generator = "1"
|
maze_generator = "2"
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
pathfinding = "3"
|
pathfinding = "3"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|
|
@ -174,14 +174,17 @@ impl<D: Clone + Default> MapFilter<D> for GridBuilder {
|
||||||
fn modify_map(&self, _rng: &mut StdRng, map: &MapgenMap<D>) -> MapgenMap<D> {
|
fn modify_map(&self, _rng: &mut StdRng, map: &MapgenMap<D>) -> MapgenMap<D> {
|
||||||
let mut map = map.clone();
|
let mut map = map.clone();
|
||||||
let mut generator = RbGenerator::new(None);
|
let mut generator = RbGenerator::new(None);
|
||||||
let maze = generator.generate(self.width_in_rooms as i32, self.height_in_rooms as i32);
|
if let Ok(maze) =
|
||||||
|
generator.generate(self.width_in_rooms as i32, self.height_in_rooms as i32)
|
||||||
|
{
|
||||||
let total_height = (self.room_height + 1) * self.height_in_rooms + 1;
|
let total_height = (self.room_height + 1) * self.height_in_rooms + 1;
|
||||||
let half_width = self.room_width / 2;
|
let half_width = self.room_width / 2;
|
||||||
let half_height = self.room_height / 2;
|
let half_height = self.room_height / 2;
|
||||||
for y in 0..self.height_in_rooms {
|
for y in 0..self.height_in_rooms {
|
||||||
for x in 0..self.width_in_rooms {
|
for x in 0..self.width_in_rooms {
|
||||||
let x_offset = x * (self.room_width + 1);
|
let x_offset = x * (self.room_width + 1);
|
||||||
let y_offset = total_height - (y * (self.room_height + 1)) - self.room_height - 2;
|
let y_offset =
|
||||||
|
total_height - (y * (self.room_height + 1)) - self.room_height - 2;
|
||||||
let room = MRect::new_i32(
|
let room = MRect::new_i32(
|
||||||
x_offset as i32 + 1,
|
x_offset as i32 + 1,
|
||||||
y_offset as i32 + 1,
|
y_offset as i32 + 1,
|
||||||
|
@ -223,6 +226,7 @@ impl<D: Clone + Default> MapFilter<D> for GridBuilder {
|
||||||
(maze.goal.x as usize) * self.room_width + half_width,
|
(maze.goal.x as usize) * self.room_width + half_width,
|
||||||
(maze.goal.y as usize) * self.room_height + half_height,
|
(maze.goal.y as usize) * self.room_height + half_height,
|
||||||
));
|
));
|
||||||
|
}
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user