Avoid underflow hacks completely with asktime

This commit is contained in:
James R 2020-08-22 18:38:20 -07:00
parent cc3eb94b26
commit 5daaef7e87
1 changed files with 10 additions and 10 deletions

View File

@ -2270,10 +2270,10 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
} }
// Ask the info to the server (askinfo packet) // Ask the info to the server (askinfo packet)
if ((I_GetTime() - NEWTICRATE) >= *asksent) if (I_GetTime() >= *asksent)
{ {
SendAskInfo(servernode); SendAskInfo(servernode);
*asksent = I_GetTime(); *asksent = I_GetTime() + NEWTICRATE;
} }
#else #else
(void)viams; (void)viams;
@ -2314,12 +2314,12 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
case CL_ASKFULLFILELIST: case CL_ASKFULLFILELIST:
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
cl_mode = CL_CHECKFILES; cl_mode = CL_CHECKFILES;
else if (fileneedednum != cl_lastcheckedfilecount || (I_GetTime() - NEWTICRATE) >= *asksent) else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
{ {
if (CL_AskFileList(fileneedednum)) if (CL_AskFileList(fileneedednum))
{ {
cl_lastcheckedfilecount = fileneedednum; cl_lastcheckedfilecount = fileneedednum;
*asksent = I_GetTime(); *asksent = I_GetTime() + NEWTICRATE;
} }
} }
break; break;
@ -2387,7 +2387,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
case CL_LOADFILES: case CL_LOADFILES:
if (CL_LoadServerFiles()) if (CL_LoadServerFiles())
{ {
*asksent = I_GetTime() - (NEWTICRATE*3); //This ensure the first join ask is right away *asksent = 0; //This ensure the first join ask is right away
firstconnectattempttime = I_GetTime(); firstconnectattempttime = I_GetTime();
cl_mode = CL_ASKJOIN; cl_mode = CL_ASKJOIN;
} }
@ -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 (( I_GetTime() - NEWTICRATE*3 ) >= *asksent && CL_SendJoin()) if (I_GetTime() >= *asksent && CL_SendJoin())
{ {
*asksent = I_GetTime(); *asksent = I_GetTime() + NEWTICRATE*3;
cl_mode = CL_WAITJOINRESPONSE; cl_mode = CL_WAITJOINRESPONSE;
} }
break; break;
case CL_WAITJOINRESPONSE: case CL_WAITJOINRESPONSE:
if (( I_GetTime() - NEWTICRATE*3 ) >= *asksent) if (I_GetTime() >= *asksent)
{ {
cl_mode = CL_ASKJOIN; cl_mode = CL_ASKJOIN;
} }
@ -2555,9 +2555,9 @@ static void CL_ConnectToServer(void)
ClearAdminPlayers(); ClearAdminPlayers();
pnumnodes = 1; pnumnodes = 1;
oldtic = I_GetTime() - 1; oldtic = 0;
#ifndef NONET #ifndef NONET
asksent = I_GetTime() - NEWTICRATE*3; asksent = 0;
firstconnectattempttime = I_GetTime(); firstconnectattempttime = I_GetTime();
i = SL_SearchServer(servernode); i = SL_SearchServer(servernode);