diff --git a/src/inventory.rs b/src/inventory.rs index 38190de..6cfa523 100644 --- a/src/inventory.rs +++ b/src/inventory.rs @@ -110,6 +110,10 @@ impl Inventory { self.weapons.get(idx) } + pub fn get_weapon_type_mut(&mut self, wtype: WeaponType) -> Option<&mut Weapon> { + self.weapons.iter_mut().find(|weapon| weapon.wtype == wtype) + } + pub fn get_current_weapon(&self) -> Option<&Weapon> { self.weapons.get(self.current_weapon as usize) }