Added Default impl for Inventory

This commit is contained in:
Joshua Barretto 2019-07-25 15:02:05 +01:00
parent fde6ec35cd
commit a7fc872f1c

View File

@ -13,12 +13,6 @@ pub struct Inventory {
}
impl Inventory {
pub fn new() -> Inventory {
Inventory {
slots: vec![None; 24],
}
}
// Get info about an item slot
pub fn get(&self, cell: usize) -> Option<Item> {
self.slots.get(cell).cloned().flatten()
@ -36,6 +30,14 @@ impl Inventory {
}
}
impl Default for Inventory {
fn default() -> Inventory {
Inventory {
slots: vec![None; 24],
}
}
}
impl Component for Inventory {
type Storage = HashMapStorage<Self>;
}