summaryrefslogtreecommitdiff
path: root/src/video/dedicated_v.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/video/dedicated_v.c')
-rw-r--r--src/video/dedicated_v.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/video/dedicated_v.c b/src/video/dedicated_v.c
index caa1c8963..764df3afd 100644
--- a/src/video/dedicated_v.c
+++ b/src/video/dedicated_v.c
@@ -223,10 +223,8 @@ static void DedicatedHandleKeyInput(void)
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 @@ static void DedicatedVideoMainLoop(void)
}
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;