off by one errors sure are nice

the item gets added to the vec before len is calculated, and since its
0-indexed we want to subtract 1
This commit is contained in:
jake 2020-09-27 17:47:21 -06:00
parent e387bfafba
commit 32d30d38ec

View File

@ -494,7 +494,7 @@ impl CharacterInventory {
self.items.push(new_stacked_item);
if let Some(InventoryItem::Stacked(new_item)) = self.items.last() {
Some((new_item, InventorySlot(self.count())))
Some((new_item, InventorySlot(self.count()-1)))
}
else {
None