diff options
author | Iago Garrido <iago086@gmail.com> | 2019-11-20 20:12:40 +0100 |
---|---|---|
committer | Iago Garrido <iago086@gmail.com> | 2019-11-20 20:12:40 +0100 |
commit | 6bc22fb1e6ced5ef313baa1f9905d427a377c3ba (patch) | |
tree | ebbf35567bd2154f54d5b988828e1e10758e654a /src/state.rs | |
parent | 15ccde4be6585865d01d9a620778dbcf5d8d998d (diff) |
add support to store tile state, for default hiding purposes
Diffstat (limited to 'src/state.rs')
-rw-r--r-- | src/state.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/state.rs b/src/state.rs index 6e76aee..9939226 100644 --- a/src/state.rs +++ b/src/state.rs @@ -3,7 +3,7 @@ use crossterm::{queue, Output}; use std::io::{stdout, Write}; use crate::entities::{Character, Entity, Player}; -use crate::tiling::{tile_to_str, TileGrid, TileType}; +use crate::tiling::{tile_to_str, Tile, TileGrid, TileType}; use crate::world::{apply_movement, Dungeon, Generatable, Level, Movement}; pub struct State { @@ -59,7 +59,7 @@ impl State { MoveTo(dirt.0 as u16, dirt.1 as u16), Output(tile_to_str(background)), MoveTo(entity.location().0 as u16, entity.location().1 as u16), - Output(tile_to_str(entity.tiletype())) + Output(tile_to_str(entity.tile())) ) .unwrap(); sout.flush().unwrap(); @@ -112,8 +112,8 @@ impl State { &self.dungeon.levels[self.level] } - fn can_step_on(tile: &TileType) -> bool { - match tile { + fn can_step_on(tile: &Tile) -> bool { + match tile.get_type() { TileType::Floor => true, TileType::StairsDown => true, TileType::StairsUp => true, @@ -146,7 +146,7 @@ impl State { } let loc = self.player.location(); - match grid.block_at(loc.0, loc.1) { + match grid.block_at(loc.0, loc.1).get_type() { TileType::StairsDown => { self.switch_level(self.level + 1); self.render_level(); @@ -167,7 +167,7 @@ impl State { } let loc = self.player.location(); - match grid.block_at(loc.0, loc.1) { + match grid.block_at(loc.0, loc.1).get_type() { TileType::StairsUp => { self.switch_level(self.level - 1); self.render_level(); |