mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 23:22:01 +00:00
no false positives with cl_dlemptyterminate, add commands skipdl/finishdl, forces current QW download to end with finishdl saving the file and skipdl deleting it
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2370 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5f4986d3f7
commit
f743070256
2 changed files with 56 additions and 2 deletions
|
@ -2537,6 +2537,57 @@ void CL_Download_f (void)
|
||||||
CL_SendClientCommand("download %s\n",url);*/
|
CL_SendClientCommand("download %s\n",url);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CL_FinishDownload(char *filename, char *tempname);
|
||||||
|
void CL_ForceStopDownload (qboolean finish)
|
||||||
|
{
|
||||||
|
if (Cmd_IsInsecure())
|
||||||
|
{
|
||||||
|
Con_Printf(S_WARNING "Execution from server rejected for %s\n", Cmd_Argv(0));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cls.downloadqw)
|
||||||
|
{
|
||||||
|
Con_Printf("No files downloading by QW protocol\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VFS_CLOSE (cls.downloadqw);
|
||||||
|
|
||||||
|
if (finish)
|
||||||
|
CL_FinishDownload(cls.downloadname, cls.downloadtempname);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *tempname;
|
||||||
|
|
||||||
|
if (*cls.downloadtempname)
|
||||||
|
tempname = cls.downloadtempname;
|
||||||
|
else
|
||||||
|
tempname = cls.downloadname;
|
||||||
|
|
||||||
|
if (strncmp(tempname,"skins/",6))
|
||||||
|
FS_Remove(tempname, FS_GAME);
|
||||||
|
else
|
||||||
|
FS_Remove(tempname+6, FS_SKINS);
|
||||||
|
}
|
||||||
|
*cls.downloadname = '\0';
|
||||||
|
cls.downloadqw = NULL;
|
||||||
|
cls.downloadpercent = 0;
|
||||||
|
|
||||||
|
// get another file if needed
|
||||||
|
CL_RequestNextDownload ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CL_SkipDownload_f (void)
|
||||||
|
{
|
||||||
|
CL_ForceStopDownload(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CL_FinishDownload_f (void)
|
||||||
|
{
|
||||||
|
CL_ForceStopDownload(true);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
@ -2792,6 +2843,9 @@ void CL_Init (void)
|
||||||
Cmd_AddCommand ("nextul", CL_NextUpload);
|
Cmd_AddCommand ("nextul", CL_NextUpload);
|
||||||
Cmd_AddCommand ("stopul", CL_StopUpload);
|
Cmd_AddCommand ("stopul", CL_StopUpload);
|
||||||
|
|
||||||
|
Cmd_AddCommand ("skipdl", CL_SkipDownload_f);
|
||||||
|
Cmd_AddCommand ("finishdl", CL_FinishDownload_f);
|
||||||
|
|
||||||
//
|
//
|
||||||
// forward to server commands
|
// forward to server commands
|
||||||
//
|
//
|
||||||
|
|
|
@ -1256,9 +1256,9 @@ 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)
|
if (percent != 100 && size == 0 && cl_dlemptyterminate.value)
|
||||||
{
|
{
|
||||||
Con_Printf("Client received empty svc_download, assuming EOF\n");
|
Con_Printf(S_WARNING "WARNING: Client received empty svc_download, assuming EOF\n");
|
||||||
percent = 100;
|
percent = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue