mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 05:11:34 +00:00
Load one file per tic
Prevents game from locking up when loading large file lists
This commit is contained in:
parent
f856f18233
commit
12d40a07cc
3 changed files with 16 additions and 9 deletions
|
@ -1095,6 +1095,7 @@ typedef enum
|
||||||
CL_SEARCHING,
|
CL_SEARCHING,
|
||||||
CL_DOWNLOADFILES,
|
CL_DOWNLOADFILES,
|
||||||
CL_ASKJOIN,
|
CL_ASKJOIN,
|
||||||
|
CL_LOADFILES,
|
||||||
CL_WAITJOINRESPONSE,
|
CL_WAITJOINRESPONSE,
|
||||||
#ifdef JOININGAME
|
#ifdef JOININGAME
|
||||||
CL_DOWNLOADSAVEGAME,
|
CL_DOWNLOADSAVEGAME,
|
||||||
|
@ -1202,7 +1203,10 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case CL_ASKFULLFILELIST:
|
case CL_ASKFULLFILELIST:
|
||||||
cltext = M_GetText("This server has a LOT of files!");
|
cltext = M_GetText("This server has a LOT of addons!");
|
||||||
|
break;
|
||||||
|
case CL_LOADFILES:
|
||||||
|
cltext = M_GetText("Loading server addons...");
|
||||||
break;
|
break;
|
||||||
case CL_ASKJOIN:
|
case CL_ASKJOIN:
|
||||||
case CL_WAITJOINRESPONSE:
|
case CL_WAITJOINRESPONSE:
|
||||||
|
@ -1933,7 +1937,7 @@ static boolean CL_FinishedFileList(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (i == 1)
|
else if (i == 1)
|
||||||
cl_mode = CL_ASKJOIN;
|
cl_mode = CL_LOADFILES;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// must download something
|
// must download something
|
||||||
|
@ -2143,7 +2147,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!curl_transfers)
|
if (!curl_transfers)
|
||||||
cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now
|
cl_mode = CL_LOADFILES; // don't break case continue to cljoin request now
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2159,11 +2163,12 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
||||||
if (waitmore)
|
if (waitmore)
|
||||||
break; // exit the case
|
break; // exit the case
|
||||||
|
|
||||||
cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now
|
cl_mode = CL_LOADFILES; // don't break case continue to cljoin request now
|
||||||
/* FALLTHRU */
|
break;
|
||||||
|
case CL_LOADFILES:
|
||||||
|
if (!CL_LoadServerFiles())
|
||||||
|
break;
|
||||||
case CL_ASKJOIN:
|
case CL_ASKJOIN:
|
||||||
CL_LoadServerFiles();
|
|
||||||
#ifdef JOININGAME
|
#ifdef JOININGAME
|
||||||
// prepare structures to save the file
|
// prepare structures to save the file
|
||||||
// WARNING: this can be useless in case of server not in GS_LEVEL
|
// WARNING: this can be useless in case of server not in GS_LEVEL
|
||||||
|
|
|
@ -457,7 +457,7 @@ INT32 CL_CheckFiles(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load it now
|
// Load it now
|
||||||
void CL_LoadServerFiles(void)
|
boolean CL_LoadServerFiles(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
@ -473,6 +473,7 @@ void CL_LoadServerFiles(void)
|
||||||
P_AddWadFile(fileneeded[i].filename);
|
P_AddWadFile(fileneeded[i].filename);
|
||||||
G_SetGameModified(true, false);
|
G_SetGameModified(true, false);
|
||||||
fileneeded[i].status = FS_OPEN;
|
fileneeded[i].status = FS_OPEN;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else if (fileneeded[i].status == FS_MD5SUMBAD)
|
else if (fileneeded[i].status == FS_MD5SUMBAD)
|
||||||
I_Error("Wrong version of file %s", fileneeded[i].filename);
|
I_Error("Wrong version of file %s", fileneeded[i].filename);
|
||||||
|
@ -498,6 +499,7 @@ void CL_LoadServerFiles(void)
|
||||||
fileneeded[i].status, s);
|
fileneeded[i].status, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of files to send
|
// Number of files to send
|
||||||
|
|
|
@ -65,7 +65,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
||||||
void CL_PrepareDownloadSaveGame(const char *tmpsave);
|
void CL_PrepareDownloadSaveGame(const char *tmpsave);
|
||||||
|
|
||||||
INT32 CL_CheckFiles(void);
|
INT32 CL_CheckFiles(void);
|
||||||
void CL_LoadServerFiles(void);
|
boolean CL_LoadServerFiles(void);
|
||||||
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
||||||
UINT8 fileid);
|
UINT8 fileid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue