fix tavern dialog

This commit is contained in:
Niko Abeler 2023-01-04 14:41:32 +01:00
parent b4d4c47777
commit 03fae90899
1 changed files with 4 additions and 10 deletions

View File

@ -42,16 +42,10 @@ impl<'a> App<'a> {
match &self.status {
AppStatus::Initial => {
// determine guests
self.guest_list = vec![];
// for creature in self.game.state.guests() {
// let creature = self.to_person(&creature);
// let guest = creature.downcast::<Person>().unwrap();
// self.guest_list.push(tui::widgets::ListItem::new(guest.name.clone()));
// }
// self.guest_list = self.game.state.guests().iter().map(|creature: &Box<dyn Any>| {
// let guest = creature.downcast::<Person>().unwrap();
// tui::widgets::ListItem::new(guest.name.clone())
// }).collect();
self.guest_list = self.game.state.guests().iter().map(|creature_id| {
let creature = self.game.state.get_creature(*creature_id).unwrap();
tui::widgets::ListItem::new(creature.name.clone())
}).collect();
self.guest_list_state = tui::widgets::ListState::default();
self.guest_list_state.select(Some(0));
self.status = AppStatus::GuestSelection;