From d9f179b980580461d909db23968d9235cfa15caf Mon Sep 17 00:00:00 2001 From: Tanner Donovan Date: Mon, 18 Mar 2019 16:46:37 -0700 Subject: [PATCH] update Duration method calls Former-commit-id: 4343e30583f74094a73365465a1d1ca912b693e6 --- README.md | 12 +++++++++++- common/src/clock.rs | 4 ++-- common/src/state.rs | 6 +++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c8f0e47fab..f2f2dc15ef 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ # Fresh -An experiment \ No newline at end of file +An experiment + +## Compile + +``` +git clone https://gitlab.com/veloren/fresh.git +cd fresh +git submodule update --init --recursive +rustup default nightly +cargo build +``` diff --git a/common/src/clock.rs b/common/src/clock.rs index 437fe77c57..57e71756e8 100644 --- a/common/src/clock.rs +++ b/common/src/clock.rs @@ -25,7 +25,7 @@ impl Clock { pub fn get_last_delta(&self) -> Duration { self.last_delta.unwrap_or(Duration::new(0, 0)) } - pub fn get_avg_delta(&self) -> Duration { Duration::from_float_secs(self.running_tps_average) } + pub fn get_avg_delta(&self) -> Duration { Duration::from_secs_f64(self.running_tps_average) } pub fn tick(&mut self, tgt: Duration) { let delta = SystemTime::now() @@ -45,6 +45,6 @@ impl Clock { self.last_delta = Some(delta); self.running_tps_average = CLOCK_SMOOTHING * self.running_tps_average + - (1.0 - CLOCK_SMOOTHING) * delta.as_float_secs(); + (1.0 - CLOCK_SMOOTHING) * delta.as_secs_f64(); } } diff --git a/common/src/state.rs b/common/src/state.rs index 2e516759e8..663d6b8237 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -168,11 +168,11 @@ impl State { /// Execute a single tick, simulating the game state by the given duration. pub fn tick(&mut self, dt: Duration) { // Change the time accordingly - self.ecs_world.write_resource::().0 += dt.as_float_secs() * DAY_CYCLE_FACTOR; - self.ecs_world.write_resource::