mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added Default impl for Inventory
This commit is contained in:
parent
fde6ec35cd
commit
a7fc872f1c
@ -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>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user