Fixed review comments

This commit is contained in:
Joshua Barretto 2022-01-16 21:13:13 +00:00
parent 0ea1e6862e
commit 3b7ea72a9c
2 changed files with 10 additions and 17 deletions

View File

@ -1458,16 +1458,14 @@ impl<'a> AgentData<'a> {
value as i32 value as i32
}; };
let mut consumables: Vec<_> = self let item = self
.inventory .inventory
.slots_with_id() .slots_with_id()
.filter_map(|(id, slot)| match slot { .filter_map(|(id, slot)| match slot {
Some(item) if healing_value(item) > 0 => Some((id, item)), Some(item) if healing_value(item) > 0 => Some((id, item)),
_ => None, _ => None,
}) })
.collect(); .max_by_key(|(_, item)| {
consumables.sort_by_key(|(_, item)| {
if relaxed { if relaxed {
-healing_value(item) -healing_value(item)
} else { } else {
@ -1475,12 +1473,12 @@ impl<'a> AgentData<'a> {
} }
}); });
if let Some((id, _)) = consumables.last() { if let Some((id, _)) = item {
use comp::inventory::slot::Slot; use comp::inventory::slot::Slot;
controller controller
.actions .actions
.push(ControlAction::InventoryAction(InventoryAction::Use( .push(ControlAction::InventoryAction(InventoryAction::Use(
Slot::Inventory(*id), Slot::Inventory(id),
))); )));
true true
} else { } else {

View File

@ -490,11 +490,6 @@ impl<'a> Widget for Overhead<'a> {
let btn_radius = btn_rect_size / 5.0; let btn_radius = btn_rect_size / 5.0;
let btn_color = Color::Rgba(0.0, 0.0, 0.0, 0.8); let btn_color = Color::Rgba(0.0, 0.0, 0.0, 0.8);
// RoundedRectangle::fill_with([btn_rect_size, btn_rect_size], btn_radius,
// btn_color) .x_y(0.0, btn_rect_pos_y)
// .depth(self.distance_from_player_sqr + 2.0)
// .parent(id)
// .set(state.ids.btn_bg, ui);
let hints_text = Text::new(&text) let hints_text = Text::new(&text)
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.font_size(btn_font_size as u32) .font_size(btn_font_size as u32)