mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
fix possible crash with download demonum/, fix typo with texture downloads
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2625 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2a7e707dc4
commit
1d6fa5f0a3
1 changed files with 34 additions and 6 deletions
|
@ -1844,8 +1844,8 @@ qboolean SV_AllowDownload (char *name)
|
||||||
if (strncmp(name, "skins/", 6) == 0)
|
if (strncmp(name, "skins/", 6) == 0)
|
||||||
return !!allow_download_skins.value;
|
return !!allow_download_skins.value;
|
||||||
//models
|
//models
|
||||||
if ((strncmp(name, "progs/", 6) == 0||
|
if ((strncmp(name, "progs/", 6) == 0) ||
|
||||||
strncmp(name, "models/", 7) == 0))
|
(strncmp(name, "models/", 7) == 0))
|
||||||
return !!allow_download_models.value;
|
return !!allow_download_models.value;
|
||||||
//sound
|
//sound
|
||||||
if (strncmp(name, "sound/", 6) == 0)
|
if (strncmp(name, "sound/", 6) == 0)
|
||||||
|
@ -1855,7 +1855,7 @@ qboolean SV_AllowDownload (char *name)
|
||||||
return !!allow_download_demos.value;
|
return !!allow_download_demos.value;
|
||||||
|
|
||||||
//textures
|
//textures
|
||||||
if (strncmp(name, "texures/", 8) == 0)
|
if (strncmp(name, "textures/", 9) == 0)
|
||||||
return !!allow_download_textures.value;
|
return !!allow_download_textures.value;
|
||||||
|
|
||||||
//wads
|
//wads
|
||||||
|
@ -1895,15 +1895,43 @@ void SV_BeginDownload_f(void)
|
||||||
|
|
||||||
name = Cmd_Argv(1);
|
name = Cmd_Argv(1);
|
||||||
|
|
||||||
if (!strncmp(name, "demonum/", 8))
|
|
||||||
name = SV_MVDNum(atoi(name+8));
|
|
||||||
|
|
||||||
if (ISNQCLIENT(host_client) && host_client->protocol != SCP_DARKPLACES7)
|
if (ISNQCLIENT(host_client) && host_client->protocol != SCP_DARKPLACES7)
|
||||||
{
|
{
|
||||||
SV_PrintToClient(host_client, PRINT_HIGH, "Your client isn't meant to support downloads\n");
|
SV_PrintToClient(host_client, PRINT_HIGH, "Your client isn't meant to support downloads\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strncmp(name, "demonum/", 8))
|
||||||
|
name = SV_MVDNum(atoi(name+8));
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
name = Cmd_Argv(1); // restore given name for cleaner error msg
|
||||||
|
Sys_Printf ("Couldn't download %s to %s\n", name, host_client->name);
|
||||||
|
if (ISNQCLIENT(host_client))
|
||||||
|
{
|
||||||
|
ClientReliableWrite_Begin (host_client, svc_stufftext, 2+strlen(name));
|
||||||
|
ClientReliableWrite_String (host_client, "\nstopdownload\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#ifdef PEXT_CHUNKEDDOWNLOADS
|
||||||
|
if (host_client->fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS)
|
||||||
|
{
|
||||||
|
ClientReliableWrite_Begin (host_client, svc_download, 10+strlen(name));
|
||||||
|
ClientReliableWrite_Long (host_client, -1);
|
||||||
|
ClientReliableWrite_Long (host_client, -1);
|
||||||
|
ClientReliableWrite_String (host_client, name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
ClientReliableWrite_Begin (host_client, ISQ2CLIENT(host_client)?svcq2_download:svc_download, 4);
|
||||||
|
ClientReliableWrite_Short (host_client, -1);
|
||||||
|
ClientReliableWrite_Byte (host_client, 0);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// hacked by zoid to allow more conrol over download
|
// hacked by zoid to allow more conrol over download
|
||||||
if (!SV_AllowDownload(name))
|
if (!SV_AllowDownload(name))
|
||||||
{ // don't allow anything with .. path
|
{ // don't allow anything with .. path
|
||||||
|
|
Loading…
Reference in a new issue