Merge branch 'xvar/fix-stackable-item-pickup' into 'master'

Fixed a bug which prevented picking up stackable items with a full inventory

Closes #921

See merge request veloren/veloren!1683
This commit is contained in:
Joshua Barretto 2021-01-09 01:23:14 +00:00
commit 3d46d51871

View File

@ -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);
}