aboutsummaryrefslogtreecommitdiff
path: root/src/entities.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities.rs')
-rw-r--r--src/entities.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/entities.rs b/src/entities.rs
index 78e5ab9..98c8443 100644
--- a/src/entities.rs
+++ b/src/entities.rs
@@ -41,7 +41,6 @@ pub struct Character {
luck: i32,
xp: i32,
tile: Tile,
- visible: bool,
}
pub trait Enemy {
@@ -114,11 +113,14 @@ impl Entity for Character {
}
fn visibility(&mut self, visible: bool) {
- self.visible = visible;
+ if visible != self.is_visible() {
+ self.dirty = true;
+ }
+ self.tile.visibility(visible)
}
fn is_visible(&self) -> bool {
- self.visible
+ self.tile.is_visible()
}
}
@@ -146,7 +148,6 @@ impl Enemy for Character {
previous_location: location,
tile: Tile::from(TileType::Character(tile_str)),
dirty: false,
- visible: false,
}
}
@@ -182,7 +183,6 @@ impl Player for Character {
false,
),
dirty: false,
- visible: true,
}
}