added cl_dlemptyterminate, when set to 1 the client will assume downloads are finished when a empty (0 size) svc_download is received (defaults to 1), ensure server treats percent value properly with downloads
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2368 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
fc3af4e938
commit
5c0b773111
3 changed files with 21 additions and 4 deletions
|
@ -141,6 +141,8 @@ cvar_t msg_filter = SCVAR("msg_filter", "0"); //0 for neither, 1 for mm1, 2 for
|
||||||
cvar_t cl_standardmsg = SCVARF("cl_standardmsg", "0", CVAR_ARCHIVE);
|
cvar_t cl_standardmsg = SCVARF("cl_standardmsg", "0", CVAR_ARCHIVE);
|
||||||
cvar_t cl_parsewhitetext = SCVAR("cl_parsewhitetext", "1");
|
cvar_t cl_parsewhitetext = SCVAR("cl_parsewhitetext", "1");
|
||||||
|
|
||||||
|
cvar_t cl_dlemptyterminate = SCVAR("cl_dlemptyterminate", "1");
|
||||||
|
|
||||||
cvar_t host_mapname = FCVAR("host_mapname", "mapname", "", 0);
|
cvar_t host_mapname = FCVAR("host_mapname", "mapname", "", 0);
|
||||||
|
|
||||||
extern cvar_t cl_hightrack;
|
extern cvar_t cl_hightrack;
|
||||||
|
|
|
@ -1155,6 +1155,7 @@ A download message has been received from the server
|
||||||
*/
|
*/
|
||||||
void CL_ParseDownload (void)
|
void CL_ParseDownload (void)
|
||||||
{
|
{
|
||||||
|
extern cvar_t cl_dlemptyterminate;
|
||||||
int size, percent;
|
int size, percent;
|
||||||
qbyte name[1024];
|
qbyte name[1024];
|
||||||
|
|
||||||
|
@ -1255,6 +1256,12 @@ void CL_ParseDownload (void)
|
||||||
if (cls.downloadmethod == DL_QWPENDING)
|
if (cls.downloadmethod == DL_QWPENDING)
|
||||||
cls.downloadmethod = DL_QW;
|
cls.downloadmethod = DL_QW;
|
||||||
|
|
||||||
|
if (size == 0 && cl_dlemptyterminate.value)
|
||||||
|
{
|
||||||
|
Con_Printf("Client received empty svc_download, assuming EOF\n");
|
||||||
|
percent = 100;
|
||||||
|
}
|
||||||
|
|
||||||
if (percent != 100)
|
if (percent != 100)
|
||||||
{
|
{
|
||||||
// change display routines by zoid
|
// change display routines by zoid
|
||||||
|
|
|
@ -1475,9 +1475,17 @@ void SV_NextDownload_f (void)
|
||||||
|
|
||||||
host_client->downloadcount += r;
|
host_client->downloadcount += r;
|
||||||
size = host_client->downloadsize;
|
size = host_client->downloadsize;
|
||||||
|
|
||||||
|
if (host_client->downloadcount < size)
|
||||||
|
{
|
||||||
if (!size)
|
if (!size)
|
||||||
size = 1;
|
size = 1;
|
||||||
percent = host_client->downloadcount*100/size;
|
|
||||||
|
percent = (double)host_client->downloadcount*100.0/size;
|
||||||
|
percent = bound(0, percent, 99);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
percent = 100;
|
||||||
|
|
||||||
#ifdef PEXT_ZLIBDL
|
#ifdef PEXT_ZLIBDL
|
||||||
if (host_client->fteprotocolextensions & PEXT_ZLIBDL)
|
if (host_client->fteprotocolextensions & PEXT_ZLIBDL)
|
||||||
|
@ -1492,7 +1500,7 @@ void SV_NextDownload_f (void)
|
||||||
ClientReliableWrite_SZ (host_client, buffer, r);
|
ClientReliableWrite_SZ (host_client, buffer, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host_client->downloadcount != host_client->downloadsize)
|
if (host_client->downloadcount < host_client->downloadsize)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VFS_CLOSE (host_client->download);
|
VFS_CLOSE (host_client->download);
|
||||||
|
|
Loading…
Reference in a new issue