---
src/game/stopwatch.cpp | 7 ++++---
src/game/stopwatch.h | 3 ++-
src/game/time.cpp | 5 ++++-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/game/stopwatch.cpp b/src/game/stopwatch.cpp
index c64dad8..e09e743 100644
--- a/src/game/stopwatch.cpp
+++ b/src/game/stopwatch.cpp
@@ -28,8 +28,9 @@ Stopwatch::Stopwatch()
Reset();
}
-void Stopwatch::Reset()
+void Stopwatch::Reset(double speed_value)
{
+ speed = speed_value;
paused = false;
start_time = SDL_GetTicks();
paused_time = 0;
@@ -63,9 +64,9 @@ void Stopwatch::SetPause(bool value)
uint Stopwatch::GetValue()
{
if (paused)
- return pause_begin - start_time - paused_time;
+ return static_cast<uint>(speed * (pause_begin - start_time - paused_time));
else
- return SDL_GetTicks() - start_time - paused_time;
+ return static_cast<uint>(speed * (SDL_GetTicks() - start_time -
paused_time));
}
bool Stopwatch::IsPaused()
diff --git a/src/game/stopwatch.h b/src/game/stopwatch.h
index 9341b03..ba5caa4 100644
--- a/src/game/stopwatch.h
+++ b/src/game/stopwatch.h
@@ -31,12 +31,13 @@ private:
uint paused_time;
uint pause_begin;
bool paused;
+ double speed;
private:
void Stop();
void Resume();
public:
Stopwatch();
- void Reset();
+ void Reset(double speed = 1);
void SetPause(bool value);
uint GetValue();
bool IsPaused();
diff --git a/src/game/time.cpp b/src/game/time.cpp
index c30879e..f9984a4 100644
--- a/src/game/time.cpp
+++ b/src/game/time.cpp
@@ -39,7 +39,10 @@ void Time::Reset()
current_time = 0;
waiting_for_user = false;
waiting_for_network = false;
- stopwatch.Reset();
+ if (IsLOGGING("slow"))
+ stopwatch.Reset(0.25);
+ else
+ stopwatch.Reset();
}
void Time::Increase()
--
1.5.4.3
_______________________________________________
Wormux-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-dev