summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-06-22 20:07:39 +0000
committertruelight <truelight@openttd.org>2007-06-22 20:07:39 +0000
commit60f0610a851e52b75ca6317584db2ab2f609f7d5 (patch)
tree4fac19f0a2133e97a4ff2401980a7679c9962c6a /src
parent2e19d3cf78c759e9583ac113c7a66f3e3e16ccb5 (diff)
downloadopenttd-60f0610a851e52b75ca6317584db2ab2f609f7d5.tar.xz
(svn r10278) -Fix r10276: make the _realtime_tick less demanding on the CPU
Diffstat (limited to 'src')
-rw-r--r--src/video/cocoa_v.mm4
-rw-r--r--src/video/sdl_v.cpp4
-rw-r--r--src/video/win32_v.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/video/cocoa_v.mm b/src/video/cocoa_v.mm
index 8e13605d8..1481bc606 100644
--- a/src/video/cocoa_v.mm
+++ b/src/video/cocoa_v.mm
@@ -732,9 +732,9 @@ static void QZ_GameLoop()
}
cur_ticks = GetTick();
- _realtime_tick += cur_ticks - last_cur_ticks;
- last_cur_ticks = cur_ticks;
if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
+ _realtime_tick += cur_ticks - last_cur_ticks;
+ last_cur_ticks = cur_ticks;
next_tick = cur_ticks + 30;
_ctrl_pressed = !!(_cocoa_video_data.current_mods & NSControlKeyMask);
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 782ac1521..bc12edb92 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -472,9 +472,9 @@ static void SdlVideoMainLoop()
}
cur_ticks = SDL_CALL SDL_GetTicks();
- _realtime_tick += cur_ticks - last_cur_ticks;
- last_cur_ticks = cur_ticks;
if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
+ _realtime_tick += cur_ticks - last_cur_ticks;
+ last_cur_ticks = cur_ticks;
next_tick = cur_ticks + 30;
_ctrl_pressed = !!(mod & KMOD_CTRL);
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 583f7f84b..987a4a6ff 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -823,9 +823,9 @@ static void Win32GdiMainLoop()
}
cur_ticks = GetTickCount();
- _realtime_tick += cur_ticks - last_cur_ticks;
- last_cur_ticks = cur_ticks;
if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
+ _realtime_tick += cur_ticks - last_cur_ticks;
+ last_cur_ticks = cur_ticks;
next_tick = cur_ticks + 30;
_ctrl_pressed = _wnd.has_focus && GetAsyncKeyState(VK_CONTROL)<0;
_shift_pressed = _wnd.has_focus && GetAsyncKeyState(VK_SHIFT)<0;