From f1945105d1a138b831bd9f14f14c14cb86b0212c Mon Sep 17 00:00:00 2001 From: cBournhonesque Date: Mon, 13 Jan 2025 18:19:41 -0500 Subject: [PATCH] avoid panics when history tick is older than last history tick --- lightyear/src/client/prediction/history.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lightyear/src/client/prediction/history.rs b/lightyear/src/client/prediction/history.rs index 0cbdf6e38..23658c795 100644 --- a/lightyear/src/client/prediction/history.rs +++ b/lightyear/src/client/prediction/history.rs @@ -3,7 +3,7 @@ use bevy::prelude::{Component, Reflect, Resource}; use bevy::prelude::{ReflectComponent, ReflectResource}; use std::collections::VecDeque; use std::fmt::Debug; -use tracing::{error, info}; +use tracing::{debug, info}; /// Stores a past value in the history buffer #[derive(Debug, PartialEq, Clone, Default, Reflect)] @@ -71,12 +71,12 @@ impl HistoryBuffer { /// The tick must be strictly more recent than the most recent update in the buffer pub(crate) fn add(&mut self, tick: Tick, value: Option) { if let Some(last_tick) = self.peek().map(|(tick, _)| tick) { - assert!( - tick >= *last_tick, - "Tick must be more recent than the last update in the buffer" - ); + // assert!( + // tick >= *last_tick, + // "Tick must be more recent than the last update in the buffer" + // ); if *last_tick == tick { - error!("Adding update to history buffer for tick: {:?} but it already had a value for that tick!", tick); + debug!("Adding update to history buffer for tick: {:?} but it already had a value for that tick!", tick); // in this case, let's pop back the update to replace it with the new value self.buffer.pop_back(); }