mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed a bug which prevented picking up stackable items with a full inventory
This commit is contained in:
parent
4507ebda80
commit
d7cbf479e3
@ -443,6 +443,10 @@ impl Inventory {
|
||||
/// containing items aren't inserted into the inventory as this is not
|
||||
/// currently supported.
|
||||
pub fn pickup_item(&mut self, mut item: Item) -> Result<(), Item> {
|
||||
if item.is_stackable() {
|
||||
return self.push(item).map_or(Ok(()), Err);
|
||||
}
|
||||
|
||||
if self.free_slots() < item.populated_slots() + 1 {
|
||||
return Err(item);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user