1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 10:14:06 +02:00

don't store baseline in baseline

This commit is contained in:
Robin Appelman 2022-04-21 21:46:07 +02:00
commit 626544b07e
3 changed files with 5 additions and 4 deletions

View file

@ -183,7 +183,7 @@ fn test_bit_var_roundtrip() {
} }
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone, Default)]
pub struct PacketEntitiesMessage { pub struct PacketEntitiesMessage {
pub entities: Vec<PacketEntity>, pub entities: Vec<PacketEntity>,
pub removed_entities: Vec<EntityId>, pub removed_entities: Vec<EntityId>,

View file

@ -8,7 +8,7 @@ use crate::{Parse, ParserState, ReadResult, Result, Stream};
use tracing::{event, span, Level}; use tracing::{event, span, Level};
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Debug, BitRead, BitWrite, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, BitRead, BitWrite, PartialEq, Serialize, Deserialize, Clone, Default)]
pub struct MessagePacketMeta { pub struct MessagePacketMeta {
pub flags: u32, // TODO pub flags: u32, // TODO
pub view_angles: ViewAngles, pub view_angles: ViewAngles,
@ -17,7 +17,7 @@ pub struct MessagePacketMeta {
} }
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone, Default)]
#[serde(bound(deserialize = "'a: 'static"))] #[serde(bound(deserialize = "'a: 'static"))]
pub struct MessagePacket<'a> { pub struct MessagePacket<'a> {
pub tick: u32, pub tick: u32,

View file

@ -235,7 +235,7 @@ impl<'a> ParserState {
for entity in ent_message.entities { for entity in ent_message.entities {
if entity.update_type == UpdateType::Enter { if entity.update_type == UpdateType::Enter {
let updated_baseline = match self.instance_baselines[old_index] let mut updated_baseline = match self.instance_baselines[old_index]
.get(&entity.entity_index) .get(&entity.entity_index)
{ {
Some(baseline_entity) Some(baseline_entity)
@ -248,6 +248,7 @@ impl<'a> ParserState {
} }
_ => entity, _ => entity,
}; };
updated_baseline.baseline_props = Vec::new();
self.instance_baselines[new_index] self.instance_baselines[new_index]
.insert(updated_baseline.entity_index, updated_baseline); .insert(updated_baseline.entity_index, updated_baseline);
} }