Browse Source

remove item from inventory by id

pbs
jake 4 years ago
parent
commit
d263bf4caa
  1. 8
      src/ship/items/inventory.rs

8
src/ship/items/inventory.rs

@ -655,6 +655,14 @@ impl CharacterInventory {
self.items = sorted_items;
}
pub fn remove_by_id(&mut self, id: ClientItemId) -> Option<InventoryItem> {
self.items.iter()
.position(|i| i.item_id() == id)
.map(|position| {
self.items.remove(position)
})
}
pub fn equip(&mut self, id: &ClientItemId, equip_slot: u8) {
for item in &self.items {
if let InventoryItem::Individual(inventory_item) = item {

Loading…
Cancel
Save