From 296d1cc0eacd52ccde64c2127d75e62a9da5bcdc Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 13 Oct 2021 23:58:32 -0600 Subject: [PATCH] InventoryItem::{stacked, mag} --- src/ship/items/inventory.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ship/items/inventory.rs b/src/ship/items/inventory.rs index 9589849..50d161d 100644 --- a/src/ship/items/inventory.rs +++ b/src/ship/items/inventory.rs @@ -220,6 +220,20 @@ impl InventoryItem { _ => None } } + + pub fn stacked(&self) -> Option<&StackedInventoryItem> { + match self { + InventoryItem::Stacked(ref stacked_inventory_item) => Some(stacked_inventory_item), + _ => None + } + } + + pub fn mag(&self) -> Option<&Mag> { + match self { + InventoryItem::Individual(individual_inventory_item) => individual_inventory_item.mag(), + _ => None + } + } }