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.
This commit is contained in:
James R 2020-08-19 17:47:07 -07:00
parent cadb4719cf
commit 1cd7c3b747

View file

@ -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... // but since the network layer doesn't provide ordered packets...
CL_PrepareDownloadSaveGame(tmpsave); CL_PrepareDownloadSaveGame(tmpsave);
#endif #endif
if ((*asksent + NEWTICRATE*3) < I_GetTime() && CL_SendJoin()) if (( I_GetTime() - NEWTICRATE*3 ) >= *asksent && CL_SendJoin())
{ {
*asksent = I_GetTime(); *asksent = I_GetTime();
cl_mode = CL_WAITJOINRESPONSE; cl_mode = CL_WAITJOINRESPONSE;
} }
break; break;
case CL_WAITJOINRESPONSE: case CL_WAITJOINRESPONSE:
if ((*asksent + NEWTICRATE*3) < I_GetTime()) if (( I_GetTime() - NEWTICRATE*3 ) >= *asksent && CL_SendJoin())
{ {
cl_mode = CL_ASKJOIN; cl_mode = CL_ASKJOIN;
} }