1
0
Fork 0
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:
Alula 2020-12-19 17:29:59 +01:00
parent 94cb7039a8
commit 87591f4a3d
No known key found for this signature in database
GPG key ID: 3E00485503A1D8BA

View file

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