1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-12-04 19:03:28 +00:00

Compare commits

...

2 commits

Author SHA1 Message Date
Alula 3c5f5c7496
get_weapon_type_mut -> get_weapon_by_type_mut 2020-12-19 17:30:27 +01:00
Alula 87591f4a3d
add get_weapon_type_mut 2020-12-19 17:29:59 +01:00

View file

@ -110,6 +110,10 @@ impl Inventory {
self.weapons.get(idx)
}
pub fn get_weapon_by_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)
}