mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-12-02 18:03:09 +00:00
add get_weapon_type_mut
This commit is contained in:
parent
94cb7039a8
commit
87591f4a3d
|
@ -110,6 +110,10 @@ impl Inventory {
|
||||||
self.weapons.get(idx)
|
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> {
|
pub fn get_current_weapon(&self) -> Option<&Weapon> {
|
||||||
self.weapons.get(self.current_weapon as usize)
|
self.weapons.get(self.current_weapon as usize)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue