1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-11-30 10:40:50 +01:00

formatting

This commit is contained in:
Robin Appelman 2026-11-07 16:54:25 +01:00
commit 471f89a155
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE
3 changed files with 9 additions and 11 deletions

View file

@ -1,6 +1,6 @@
use crate::Stream;
/// Messages that consists only of primitives and string and can be derived /// Messages that consists only of primitives and string and can be derived
use crate::demo::data::{MaybeUtf8String, ServerTick}; use crate::demo::data::{MaybeUtf8String, ServerTick};
use crate::Stream;
#[cfg(feature = "write")] #[cfg(feature = "write")]
use bitbuffer::BitWrite; use bitbuffer::BitWrite;
use bitbuffer::{BitRead, LittleEndian}; use bitbuffer::{BitRead, LittleEndian};

View file

@ -323,7 +323,8 @@ impl ParserState {
pub fn handle_string_entry(&mut self, table: &str, _index: usize, entry: &StringTableEntry) { pub fn handle_string_entry(&mut self, table: &str, _index: usize, entry: &StringTableEntry) {
if table == "instancebaseline" if table == "instancebaseline"
&& let (Some(extra), Ok(class_id)) = (&entry.extra_data, entry.text().parse()) { && let (Some(extra), Ok(class_id)) = (&entry.extra_data, entry.text().parse())
{
let baseline = StaticBaseline::new(class_id, extra.data.to_owned()); let baseline = StaticBaseline::new(class_id, extra.data.to_owned());
self.static_baselines.insert(class_id, baseline); self.static_baselines.insert(class_id, baseline);
self.parsed_static_baselines.borrow_mut().remove(&class_id); self.parsed_static_baselines.borrow_mut().remove(&class_id);
@ -507,9 +508,6 @@ fn test_static_baseline_reencode() {
assert_ne!(misread, props); assert_ne!(misread, props);
} }
let fixed = StaticBaseline::new( let fixed = StaticBaseline::new(ClassId::from(0u16), baseline.reencode(&from, &to).unwrap());
ClassId::from(0u16),
baseline.reencode(&from, &to).unwrap(),
);
assert_eq!(fixed.parse(&to).unwrap(), props); assert_eq!(fixed.parse(&to).unwrap(), props);
} }

View file

@ -356,7 +356,7 @@ pub enum SendPropFlag {
impl SendPropFlags { impl SendPropFlags {
pub fn with_non_networked_flags(self, name: &SendPropName) -> SendPropFlags { pub fn with_non_networked_flags(self, name: &SendPropName) -> SendPropFlags {
const AGAINST_TICKCOUNT_PROPS: &[&'static str] = &["m_flSimulationTime", "m_flAnimTime"]; const AGAINST_TICKCOUNT_PROPS: &[&str] = &["m_flSimulationTime", "m_flAnimTime"];
if AGAINST_TICKCOUNT_PROPS.contains(&name.as_str()) if AGAINST_TICKCOUNT_PROPS.contains(&name.as_str())
&& self.contains(SendPropFlag::ChangesOften) && self.contains(SendPropFlag::ChangesOften)
{ {