From 1cd7c3b74764af1bf46e8a81376012dc719ae918 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 19 Aug 2020 17:47:07 -0700 Subject: [PATCH] Rearrange time comparsion on asksent to make it underflow friendly This fixes '-connect'. NEWTICRATE*5 is subtracted from asksent after CL_LOADFILES. If this happens too early, an underflow will occur. --- src/d_clisrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3a7626ef..e947964c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2414,14 +2414,14 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic // but since the network layer doesn't provide ordered packets... CL_PrepareDownloadSaveGame(tmpsave); #endif - if ((*asksent + NEWTICRATE*3) < I_GetTime() && CL_SendJoin()) + if (( I_GetTime() - NEWTICRATE*3 ) >= *asksent && CL_SendJoin()) { *asksent = I_GetTime(); cl_mode = CL_WAITJOINRESPONSE; } break; case CL_WAITJOINRESPONSE: - if ((*asksent + NEWTICRATE*3) < I_GetTime()) + if (( I_GetTime() - NEWTICRATE*3 ) >= *asksent && CL_SendJoin()) { cl_mode = CL_ASKJOIN; }