From: bones_was_here Date: Sat, 29 Jul 2023 10:36:21 +0000 (+1000) Subject: Fix host.framecount X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=94b0826a045fab935ff81ea2c9ac15f5768d9ff0;p=xonotic%2Fdarkplaces.git Fix host.framecount It never incremented if sleep was called, and could have eventually become negative. Signed-off-by: bones_was_here --- diff --git a/host.c b/host.c index 543ab5a6..1929ebad 100644 --- 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 26465423..109948c5 100644 --- 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