From: bones_was_here Date: Fri, 24 Nov 2023 05:18:57 +0000 (+1000) Subject: cl_nettimesyncboundmode: use default if invalid X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d2f40d8056704a776baf0b5f3bf99ba8a10e78f4;p=xonotic%2Fdarkplaces.git cl_nettimesyncboundmode: use default if invalid Signed-off-by: bones_was_here --- diff --git a/cl_parse.c b/cl_parse.c index d0f39723..374b6ed6 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -3307,27 +3307,32 @@ static void CL_NetworkTimeReceived(double newtime) Con_DPrintf("--- cl.time > cl.mtime[0] (%f > %f ... %f)\n", cl.time, cl.mtime[1], cl.mtime[0]); } - if (cl_nettimesyncboundmode.integer < 4) - { - // doesn't make sense for modes > 3 - cl.time += (cl.mtime[1] - cl.time) * bound(0, cl_nettimesyncfactor.value, 1); - timehigh = cl.mtime[1] + (cl.mtime[0] - cl.mtime[1]) * cl_nettimesyncboundtolerance.value; - } - +selectmode: switch (cl_nettimesyncboundmode.integer) { + default: + Cvar_SetQuick(&cl_nettimesyncboundmode, cl_nettimesyncboundmode.defstring); + goto selectmode; case 1: - cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]); - break; - case 2: - if (cl.time < cl.mtime[1] || cl.time > timehigh) - cl.time = cl.mtime[1]; - break; - case 3: - if ((cl.time < cl.mtime[1] && cl.oldtime < cl.mtime[1]) || (cl.time > timehigh && cl.oldtime > timehigh)) - cl.time = cl.mtime[1]; + // doesn't make sense for modes > 3 + cl.time += (cl.mtime[1] - cl.time) * bound(0, cl_nettimesyncfactor.value, 1); + timehigh = cl.mtime[1] + (cl.mtime[0] - cl.mtime[1]) * cl_nettimesyncboundtolerance.value; + switch (cl_nettimesyncboundmode.integer) + { + case 1: + cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]); + break; + case 2: + if (cl.time < cl.mtime[1] || cl.time > timehigh) + cl.time = cl.mtime[1]; + break; + case 3: + if ((cl.time < cl.mtime[1] && cl.oldtime < cl.mtime[1]) || (cl.time > timehigh && cl.oldtime > timehigh)) + cl.time = cl.mtime[1]; + break; + } break; case 4: