From 2ea0ed5870e3df0866ec37f1d7bc24670022df4d Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Sun, 21 Feb 2021 16:29:23 -0800 Subject: [PATCH] removed warnings from time.cpp --- src/core/time.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/time.cpp b/src/core/time.cpp index 92e911c..a61938a 100644 --- a/src/core/time.cpp +++ b/src/core/time.cpp @@ -1,5 +1,4 @@ #include -#include using namespace Blah; @@ -26,7 +25,9 @@ void Time::pause_for(float duration) bool Time::on_interval(double time, float delta, float interval, float offset) { - return floor((time - offset - delta) / interval) < floor((time - offset) / interval); + auto last = static_cast((time - offset - delta) / interval); + auto next = static_cast((time - offset) / interval); + return last < next; } bool Time::on_interval(float delta, float interval, float offset) @@ -39,14 +40,15 @@ bool Time::on_interval(float interval, float offset) return Time::on_interval(Time::seconds, Time::delta, interval, offset); } -bool Time::on_time(double time, double timestamp) +bool Time::on_time(double time, double timestamp) { - return time >= timestamp && time - Time::delta < timestamp; + float c = static_cast(time) - Time::delta; + return time >= timestamp && c < timestamp; } bool Time::between_interval(double time, float interval, float offset) { - return modf(time - offset, interval * 2) >= interval; + return modf(time - offset, ((double)interval) * 2) >= interval; } bool Time::between_interval(float interval, float offset)