Better inventory counter

This commit is contained in:
timokoesters 2020-03-24 00:38:00 +01:00
parent 1c145e8d3a
commit 43d4e8aad2
2 changed files with 2 additions and 9 deletions

View File

@ -34,14 +34,7 @@ impl Inventory {
self.amount = 0;
for item in self.slots.iter() {
if let Some(item) = item {
match item.kind {
ItemKind::Tool(_) | ItemKind::Armor { .. } => self.amount += 1,
ItemKind::Utility { amount, .. }
| ItemKind::Ingredient { amount, .. }
| ItemKind::Consumable { amount, .. } => {
self.amount += amount;
},
}
self.amount += 1;
}
}
}

View File

@ -185,7 +185,7 @@ impl<'a> Widget for Bag<'a> {
&self.localized_strings.get("hud.bag.exp")
);
let space_used = inventory.amount;
let space_max = 0;
let space_max = inventory.slots.len();
let bag_space = format!("{}/{}", space_used, space_max);
let level = (self.stats.level.level()).to_string();
let currency = 0; // TODO: Add as a Stat maybe?