]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix host.framecount
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 29 Jul 2023 10:36:21 +0000 (20:36 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 29 Jul 2023 10:36:21 +0000 (20:36 +1000)
It never incremented if sleep was called, and could have eventually
become negative.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
host.c
host.h

diff --git a/host.c b/host.c
index 543ab5a6720731196b8e9cfaae02e231c47202b9..1929ebad3fcdcde9891a956721cf7f94d855a7c5 100644 (file)
--- a/host.c
+++ b/host.c
@@ -744,14 +744,10 @@ void Host_Main(void)
 
                sleeptime = Host_Frame(time);
                oldtime = newtime;
+               ++host.framecount;
 
                if (sleeptime >= 1)
-               {
                        Host_Sleep(sleeptime);
-                       continue;
-               }
-
-               host.framecount++;
        }
 
        return;
diff --git a/host.h b/host.h
index 26465423839b5523830ae599f25370180699f1c6..109948c581205e0eaa793a149e0ca70b0fefde4b 100644 (file)
--- a/host.h
+++ b/host.h
@@ -20,7 +20,7 @@ typedef struct host_static_s
 {
        jmp_buf abortframe;
        int state;
-       int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f)
+       unsigned int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f)
        double realtime; // the accumulated mainloop time since application started (with filtering), without any slowmo or clamping
        double dirtytime; // the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame
        double sleeptime; // time spent sleeping overall