remove xyz from tiles

This commit is contained in:
zoe 2022-05-06 20:50:54 +02:00
parent e2da38386b
commit 67d1480f35
2 changed files with 4 additions and 7 deletions

View file

@ -19,7 +19,7 @@ impl World {
for x in 0..self.xsize {
for y in 0..self.ysize {
for z in 0..self.zsize {
let tile = tiles::Tile::new(tiles::Tiletypes::Dirt, x, y, z);
let tile = tiles::Tile::new(tiles::Tiletypes::Dirt);
ret.push(Vector3::new(x as f32, y as f32, z as f32));
self.tiles[x][y][z] = tile;
}
@ -39,7 +39,7 @@ impl World {
fn get_vec3(xsize: usize, ysize: usize, zsize: usize) -> Vec<Vec<Vec<tiles::Tile>>> {
let mut zvec: Vec<tiles::Tile> = Vec::with_capacity(zsize);
zvec.resize(zsize, tiles::Tile::new(tiles::Tiletypes::Air, 0, 0, 0));
zvec.resize(zsize, tiles::Tile::new(tiles::Tiletypes::Air));
let mut yvec: Vec<Vec<tiles::Tile>> = Vec::with_capacity(ysize);
yvec.resize(ysize, zvec.clone());

View file

@ -12,14 +12,11 @@ pub enum Tiletypes {
#[derive(Debug, Clone, Copy)]
pub struct Tile {
kind: Tiletypes,
x: usize,
y: usize,
z: usize,
}
impl Tile {
pub fn new(kind: Tiletypes, x: usize, y: usize, z: usize) -> Tile {
Tile { kind, x, y, z }
pub fn new(kind: Tiletypes) -> Tile {
Tile { kind }
}
pub fn kind_to_string(&self) -> &str {
&self.kind.as_ref()