Skip to content

Commit

Permalink
finish cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
twof committed Dec 22, 2024
1 parent 6681f76 commit 41521b9
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion frontend/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions frontend/app/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,8 @@ impl UI {
let snapshot_index =
(self.physics_time.as_secs_f64() / PHYSICS_TICK_LENGTH).round() as usize;

// snapshots.len - snapshot_index - 1 < SNAPSHOT_PRELOAD
// safe subtraction to avoid crashing
// Reaching the end of the preloaded snapshots, need to preload more
if self
.snapshots
.len()
.checked_sub(snapshot_index)
.and_then(|num| num.checked_sub(1))
.unwrap_or(0)
< SNAPSHOT_PRELOAD
if SNAPSHOT_PRELOAD + 1 + snapshot_index > self.snapshots.len()
&& self.snapshot_requests_in_flight < MAX_SNAPSHOT_REQUESTS_IN_FLIGHT
{
self.request_snapshot.emit(());
Expand All @@ -441,7 +433,6 @@ impl UI {
{
let first_snapshot = self.snapshot.is_none();

assert!(self.snapshots.len() - 1 >= snapshot_index);
self.snapshot = self.snapshots.get(snapshot_index).cloned();
self.uninterpolated_snapshot = self.snapshot.clone();

Expand Down Expand Up @@ -519,7 +510,6 @@ impl UI {
} else if snapshot.time != self.uninterpolated_snapshot.as_ref().unwrap().time {
// TODO: Do we need to do this? Does this ever happen?
// uninterpolated_snapshot is a copy of snapshot
log::info!("Uninterpolated");
*snapshot = self.uninterpolated_snapshot.as_ref().unwrap().clone();
}

Expand Down
1 change: 0 additions & 1 deletion frontend/simulation_worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ publish = false
oort_simulator = { path = "../../shared/simulator", features = ["js"], default-features = false }
yew-agent = "0.2.0"
serde = "1.0.193"
log = "0.4.20"
2 changes: 0 additions & 2 deletions shared/simulator/src/scenario/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ pub enum Status {
impl fmt::Display for Status {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
// or, alternatively:
// fmt::Debug::fmt(self, f)
}
}

Expand Down

0 comments on commit 41521b9

Please sign in to comment.