From 929dac06d0a2df78bbeac5a80c994a38901e5f67 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 3 Aug 2019 12:48:38 -0400 Subject: Clear messages every turn Clear messgaes every turn, preserving the ability to ^P to get the previous message --- src/game.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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, -- cgit 1.4.1