diff options
author | truelight <truelight@openttd.org> | 2007-06-22 20:07:39 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2007-06-22 20:07:39 +0000 |
commit | 44a9fea38808d5414ddbbc9ce6ce1e3f91442112 (patch) | |
tree | 4fac19f0a2133e97a4ff2401980a7679c9962c6a | |
parent | 7bfc7d19e814567bb09acda7406cb437f5e2f213 (diff) | |
download | openttd-44a9fea38808d5414ddbbc9ce6ce1e3f91442112.tar.xz |
(svn r10278) -Fix r10276: make the _realtime_tick less demanding on the CPU
-rw-r--r-- | src/video/cocoa_v.mm | 4 | ||||
-rw-r--r-- | src/video/sdl_v.cpp | 4 | ||||
-rw-r--r-- | src/video/win32_v.cpp | 4 |
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; |