sorry - swapping from rustfmt to prettier-rust
This commit is contained in:
parent
281396f9ce
commit
c2c7e0bd52
93 changed files with 2797 additions and 2021 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use super::{BuilderMap, MetaMapBuilder, Rect, TileType};
|
||||
use super::{ BuilderMap, MetaMapBuilder, Rect, TileType };
|
||||
use rltk::RandomNumberGenerator;
|
||||
|
||||
pub struct RoomDrawer {}
|
||||
|
|
@ -19,7 +19,7 @@ impl RoomDrawer {
|
|||
for y in room.y1 + 1..=room.y2 {
|
||||
for x in room.x1 + 1..=room.x2 {
|
||||
let idx = build_data.map.xy_idx(x, y);
|
||||
if idx > 0 && idx < ((build_data.map.width * build_data.map.height) - 1) as usize {
|
||||
if idx > 0 && idx < ((build_data.map.width * build_data.map.height - 1) as usize) {
|
||||
build_data.map.tiles[idx] = TileType::Floor;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,15 +27,14 @@ impl RoomDrawer {
|
|||
}
|
||||
|
||||
fn circle(&mut self, build_data: &mut BuilderMap, room: &Rect) {
|
||||
let radius = i32::min(room.x2 - room.x1, room.y2 - room.y1) as f32 / 2.0;
|
||||
let radius = (i32::min(room.x2 - room.x1, room.y2 - room.y1) as f32) / 2.0;
|
||||
let center = room.centre();
|
||||
let center_pt = rltk::Point::new(center.0, center.1);
|
||||
for y in room.y1..=room.y2 {
|
||||
for x in room.x1..=room.x2 {
|
||||
let idx = build_data.map.xy_idx(x, y);
|
||||
let distance = rltk::DistanceAlg::Pythagoras.distance2d(center_pt, rltk::Point::new(x, y));
|
||||
if idx > 0 && idx < ((build_data.map.width * build_data.map.height) - 1) as usize && distance <= radius
|
||||
{
|
||||
if idx > 0 && idx < ((build_data.map.width * build_data.map.height - 1) as usize) && distance <= radius {
|
||||
build_data.map.tiles[idx] = TileType::Floor;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue