This commit is contained in:
Joachim Lusiardi 2023-11-27 21:24:43 +01:00
parent 677acf771a
commit ee1f11cd1f
4 changed files with 4 additions and 5 deletions

View File

@ -12,7 +12,7 @@ impl Game<'_> {
pub fn new(p: &mut Player) -> Game { pub fn new(p: &mut Player) -> Game {
let mut v: Vec<Level> = Vec::with_capacity(LEVELS); let mut v: Vec<Level> = Vec::with_capacity(LEVELS);
for _ in 0..LEVELS { for _ in 0..LEVELS {
let mut l = Level::new(); let l = Level::new();
v.push(l); v.push(l);
} }
Game { Game {

View File

@ -5,7 +5,7 @@ pub const LEVEL_WIDTH: usize = 50;
pub const LEVEL_HEIGHT: usize = 25; pub const LEVEL_HEIGHT: usize = 25;
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
enum StructureElement { pub enum StructureElement {
Wall, Wall,
Floor, Floor,
StairDown, StairDown,
@ -13,7 +13,7 @@ enum StructureElement {
Unknown, Unknown,
} }
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub struct Level { pub struct Level {
structure: [[StructureElement; LEVEL_HEIGHT]; LEVEL_WIDTH], structure: [[StructureElement; LEVEL_HEIGHT]; LEVEL_WIDTH],
discovered: [[bool; LEVEL_HEIGHT]; LEVEL_WIDTH], discovered: [[bool; LEVEL_HEIGHT]; LEVEL_WIDTH],

View File

@ -1,5 +1,4 @@
use crate::game::Game; use crate::game::Game;
use crate::level::Level;
use crate::player::Player; use crate::player::Player;
mod game; mod game;

View File

@ -1,4 +1,4 @@
use std::cmp::{max, min}; use std::cmp::max;
use crate::position::Position; use crate::position::Position;