Browse Source

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
pbs
jake 4 years ago
parent
commit
32d30d38ec
  1. 2
      src/ship/items/inventory.rs

2
src/ship/items/inventory.rs

@ -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

Loading…
Cancel
Save