about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-08-03T16·48-0400
committerGriffin Smith <root@gws.fyi>2019-08-03T16·48-0400
commit929dac06d0a2df78bbeac5a80c994a38901e5f67 (patch)
tree0023086c44a8aeaa36b992a0e4906bcb7e074c0e /src
parent7138d9a0b627b64f31558f0f4820dec7e55fdee4 (diff)
Clear messages every turn
Clear messgaes every turn, preserving the ability to ^P to get the
previous message
Diffstat (limited to 'src')
-rw-r--r--src/game.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/game.rs b/src/game.rs
index 2740b5052d94..add48e8bfd47 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -367,6 +367,16 @@ impl<'a> Game<'a> {
         Ok(())
     }
 
+    fn clear_message(&mut self) -> io::Result<()> {
+        debug!("{:?} {:?}", self.message_idx, self.messages);
+        if self.message_idx == self.messages.len() {
+            return Ok(());
+        }
+        self.viewport.clear_message()?;
+        self.message_idx += 1;
+        Ok(())
+    }
+
     fn creature(&self, creature_id: EntityID) -> Option<&Creature> {
         self.entities
             .get(creature_id)
@@ -500,6 +510,7 @@ impl<'a> Game<'a> {
                         self.viewport.clear(old_pos)?;
                         self.draw_entities_at(old_pos)?;
                         self.draw_entity(self.character_entity_id)?;
+                        self.clear_message()?;
                         self.describe_entities_at(
                             char_pos,
                             EntityDescriptionMode::Walk,