mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
better packet baseline encode?
This commit is contained in:
parent
d00c1a8f32
commit
9d8bf2da63
1 changed files with 10 additions and 3 deletions
|
|
@ -97,10 +97,17 @@ impl PacketEntity {
|
||||||
&'a self,
|
&'a self,
|
||||||
baseline: &'a [SendProp],
|
baseline: &'a [SendProp],
|
||||||
) -> impl Iterator<Item = &'a SendProp> + 'a {
|
) -> impl Iterator<Item = &'a SendProp> + 'a {
|
||||||
|
// self.props.iter().filter(move |prop| {
|
||||||
|
// !baseline
|
||||||
|
// .iter()
|
||||||
|
// .any(|base_prop| base_prop.index == prop.index && base_prop.value == prop.value)
|
||||||
|
// })
|
||||||
self.props.iter().filter(move |prop| {
|
self.props.iter().filter(move |prop| {
|
||||||
!baseline
|
baseline
|
||||||
.iter()
|
.iter()
|
||||||
.any(|base_prop| base_prop.index == prop.index && base_prop.value == prop.value)
|
.find(|base_prop| base_prop.index == prop.index)
|
||||||
|
.map(|base_prop| base_prop.value != prop.value)
|
||||||
|
.unwrap_or(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -299,7 +306,7 @@ impl Encode for PacketEntitiesMessage {
|
||||||
send_table,
|
send_table,
|
||||||
)?;
|
)?;
|
||||||
Self::write_update(
|
Self::write_update(
|
||||||
entity.diff_from_baseline(&baseline),
|
entity.props.iter().skip(baseline.len()),
|
||||||
stream,
|
stream,
|
||||||
send_table,
|
send_table,
|
||||||
)?;
|
)?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue