use std::collections::HashMap; use proto::BuddyUnitInfo; use crate::logic::{BaseProperty, BuddyTeamType}; pub struct BuddyUnit { pub buddy_id: u32, pub buddy_team: BuddyTeamType, pub override_property_map: HashMap, } impl BuddyUnit { pub fn to_client(&self) -> BuddyUnitInfo { BuddyUnitInfo { buddy_id: self.buddy_id, r#type: self.buddy_team.to_protocol().into(), mp_property_override_map: self .override_property_map .iter() .map(|(prop, value)| (*prop as u32, *value)) .collect(), } } }