limit inventory to 10 slots
This commit is contained in:
@@ -69,8 +69,13 @@ impl Player {
|
||||
rand::thread_rng().gen_range(1..4)
|
||||
}
|
||||
|
||||
pub fn add_to_inventory(&mut self, potion: &Potion) {
|
||||
self.inventory.push(*potion);
|
||||
pub fn add_to_inventory(&mut self, potion: &Potion) -> bool {
|
||||
if self.inventory.len() < 10 {
|
||||
self.inventory.push(*potion);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn inventory_size(&self) -> usize {
|
||||
|
||||
Reference in New Issue
Block a user