Clear messages every turn
Clear messgaes every turn, preserving the ability to ^P to get the previous message
This commit is contained in:
		
							parent
							
								
									7138d9a0b6
								
							
						
					
					
						commit
						929dac06d0
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		
							
								
								
									
										11
									
								
								src/game.rs
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue