diff options
Diffstat (limited to 'crates/fparkan-runtime/src/player_weapon.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/player_weapon.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/fparkan-runtime/src/player_weapon.rs b/crates/fparkan-runtime/src/player_weapon.rs index 84408c61..4cc35fcc 100644 --- a/crates/fparkan-runtime/src/player_weapon.rs +++ b/crates/fparkan-runtime/src/player_weapon.rs @@ -719,11 +719,19 @@ fn firing_effect_row<'a>( } pub(super) fn prepare_unit_weapons(controls: &[Option<PreparedComponentControl>]) -> PlayerWeapons { - PlayerWeapons { - weapons: controls + prepare_component_weapons( + controls .iter() .enumerate() - .filter_map(|(index, control)| Some((index, control.as_ref()?))) + .filter_map(|(index, control)| Some((index, control.as_ref()?))), + ) +} + +pub(super) fn prepare_component_weapons<'a>( + controls: impl Iterator<Item = (usize, &'a PreparedComponentControl)>, +) -> PlayerWeapons { + PlayerWeapons { + weapons: controls .flat_map(|(index, control)| prepare_weapons(index, control)) .collect(), ..PlayerWeapons::default() |
