--- a/src/video/dedicated_v.c Wed Jan 03 20:00:29 2007 +0000
+++ b/src/video/dedicated_v.c Thu Jan 11 13:16:26 2007 +0000
@@ -223,10 +223,8 @@
static void DedicatedVideoMainLoop(void)
{
- uint32 next_tick;
- uint32 cur_ticks;
-
- next_tick = GetTime() + 30;
+ uint32 cur_ticks = GetTime();
+ uint32 next_tick = cur_ticks + 30;
/* Signal handlers */
#ifdef UNIX
@@ -268,15 +266,15 @@
}
while (!_exit_game) {
+ uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
InteractiveRandom(); // randomness
if (!_dedicated_forks)
DedicatedHandleKeyInput();
cur_ticks = GetTime();
-
- if (cur_ticks >= next_tick) {
- next_tick += 30;
+ if (cur_ticks >= next_tick || cur_ticks < prev_cur_ticks) {
+ next_tick = cur_ticks + 30;
GameLoop();
_screen.dst_ptr = _dedicated_video_mem;