Add basic benchmarks and CI

This commit is contained in:
Lol3rrr
2024-10-17 17:43:11 +02:00
parent 195d2fbc15
commit 52d58efa23
8 changed files with 209 additions and 14 deletions

View File

@@ -12,9 +12,9 @@ macro_rules! define_event {
impl $name {
#[allow(unused_mut)]
fn parse(keys: &[crate::csgo_proto::csvc_msg_game_event_list::KeyT], event: crate::csgo_proto::CMsgSource1LegacyGameEvent) -> Result<GameEvent, ParseGameEventError> {
$(let mut $field: Option<RawValue> = None;)*
let mut remaining = std::collections::HashMap::new();
let mut remaining = std::collections::HashMap::new();
for (k, f) in keys.iter().zip(event.keys.into_iter()) {
let name = k.name();

View File

@@ -135,10 +135,13 @@ impl PropController {
prop_name: "my_weapons_offset".into(),
},
),
(ITEM_PURCHASE_COST, PropInfo {
id: ITEM_PURCHASE_COST,
prop_name: "item_purchase_cost".into(),
}),
(
ITEM_PURCHASE_COST,
PropInfo {
id: ITEM_PURCHASE_COST,
prop_name: "item_purchase_cost".into(),
},
),
]
.into_iter()
.collect(),

View File

@@ -37,16 +37,19 @@ pub mod ccsteam {
}
pub fn team_name(&self) -> Option<&str> {
self.0.get_prop("CCSTeam.m_szTeamname").map(|p| {
match &p.value {
self.0
.get_prop("CCSTeam.m_szTeamname")
.map(|p| match &p.value {
crate::parser::Variant::String(v) => Some(v.as_str()),
_ => None,
}
}).flatten()
})
.flatten()
}
pub fn player_pawns(&self) -> Vec<super::pawnid::PawnID> {
self.0.props.iter()
self.0
.props
.iter()
.filter(|p| p.prop_info.prop_name.as_ref() == "CCSTeam.m_aPawns")
.filter_map(|p| p.value.as_u32())
.map(|v| super::pawnid::PawnID::from(v))
@@ -54,11 +57,17 @@ pub mod ccsteam {
}
pub fn score(&self) -> Option<i32> {
self.0.get_prop("CCSTeam.m_iScore").map(|p| p.value.as_i32()).flatten()
self.0
.get_prop("CCSTeam.m_iScore")
.map(|p| p.value.as_i32())
.flatten()
}
pub fn team_number(&self) -> Option<u32> {
self.0.get_prop("CCSTeam.m_iTeamNum").map(|p| p.value.as_u32()).flatten()
self.0
.get_prop("CCSTeam.m_iTeamNum")
.map(|p| p.value.as_u32())
.flatten()
}
}
}