This commit is contained in:
Quaternions 2024-07-25 11:45:05 -07:00
parent d4e3235935
commit c786392275

View File

@ -129,6 +129,15 @@ impl Into<strafesnet_common::gameplay_modes::Zone> for Zone{
} }
} }
} }
impl From<strafesnet_common::gameplay_modes::Zone> for Zone{
fn from(value:strafesnet_common::gameplay_modes::Zone)->Self{
match value{
strafesnet_common::gameplay_modes::Zone::Start=>Zone::Start,
strafesnet_common::gameplay_modes::Zone::Finish=>Zone::Finish,
strafesnet_common::gameplay_modes::Zone::Anticheat=>Zone::Anticheat,
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -165,3 +174,26 @@ impl Into<strafesnet_common::gameplay_modes::Mode> for Mode{
) )
} }
} }
impl From<strafesnet_common::gameplay_modes::Mode> for Mode{
fn from(value:strafesnet_common::gameplay_modes::Mode)->Self{
let (style,start,zones,stages,elements)=value.into_inner();
Self{
header:ModeHeader{
zones:zones.len() as u32,
stages:stages.len() as u32,
elements:elements.len() as u32,
},
style:style.into(),
start:start.get(),
zones:zones.into_iter()
.map(|(model_id,zone)|(model_id.get(),zone.into()))
.collect(),
stages:stages.into_iter()
.map(Into::into)
.collect(),
elements:elements.into_iter()
.map(|(model_id,stage_element)|(model_id.get(),stage_element.into()))
.collect(),
}
}
}