sorry - swapping from rustfmt to prettier-rust

This commit is contained in:
Llywelwyn 2023-08-23 01:22:09 +01:00
parent 281396f9ce
commit c2c7e0bd52
93 changed files with 2797 additions and 2021 deletions

View file

@ -1,4 +1,4 @@
use super::{BuilderMap, MetaMapBuilder, TileType};
use super::{ BuilderMap, MetaMapBuilder, TileType };
use rltk::RandomNumberGenerator;
pub struct DoorPlacement {}
@ -45,27 +45,35 @@ impl DoorPlacement {
}
}
let x = idx % build_data.map.width as usize;
let y = idx / build_data.map.width as usize;
let x = idx % (build_data.map.width as usize);
let y = idx / (build_data.map.width as usize);
// Check for east-west door possibility
if build_data.map.tiles[idx] == TileType::Floor
&& (x > 1 && build_data.map.tiles[idx - 1] == TileType::Floor)
&& (x < build_data.map.width as usize - 2 && build_data.map.tiles[idx + 1] == TileType::Floor)
&& (y > 1 && build_data.map.tiles[idx - build_data.map.width as usize] == TileType::Wall)
&& (y < build_data.map.height as usize - 2
&& build_data.map.tiles[idx + build_data.map.width as usize] == TileType::Wall)
if
build_data.map.tiles[idx] == TileType::Floor &&
x > 1 &&
build_data.map.tiles[idx - 1] == TileType::Floor &&
x < (build_data.map.width as usize) - 2 &&
build_data.map.tiles[idx + 1] == TileType::Floor &&
y > 1 &&
build_data.map.tiles[idx - (build_data.map.width as usize)] == TileType::Wall &&
y < (build_data.map.height as usize) - 2 &&
build_data.map.tiles[idx + (build_data.map.width as usize)] == TileType::Wall
{
return true;
}
// Check for north-south door possibility
if build_data.map.tiles[idx] == TileType::Floor
&& (x > 1 && build_data.map.tiles[idx - 1] == TileType::Wall)
&& (x < build_data.map.width as usize - 2 && build_data.map.tiles[idx + 1] == TileType::Wall)
&& (y > 1 && build_data.map.tiles[idx - build_data.map.width as usize] == TileType::Floor)
&& (y < build_data.map.height as usize - 2
&& build_data.map.tiles[idx + build_data.map.width as usize] == TileType::Floor)
if
build_data.map.tiles[idx] == TileType::Floor &&
x > 1 &&
build_data.map.tiles[idx - 1] == TileType::Wall &&
x < (build_data.map.width as usize) - 2 &&
build_data.map.tiles[idx + 1] == TileType::Wall &&
y > 1 &&
build_data.map.tiles[idx - (build_data.map.width as usize)] == TileType::Floor &&
y < (build_data.map.height as usize) - 2 &&
build_data.map.tiles[idx + (build_data.map.width as usize)] == TileType::Floor
{
return true;
}