attempted fix for download demonum/# stuff

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2626 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2007-09-01 01:38:18 +00:00
parent 1d6fa5f0a3
commit 43a38c4639

View file

@ -1889,11 +1889,10 @@ SV_BeginDownload_f
*/ */
void SV_BeginDownload_f(void) void SV_BeginDownload_f(void)
{ {
char *name; char name[MAX_OSPATH];
extern cvar_t allow_download_anymap, allow_download_pakcontents; extern cvar_t allow_download_anymap, allow_download_pakcontents;
Q_strncpyz(name, Cmd_Argv(1), sizeof(name));
name = Cmd_Argv(1);
if (ISNQCLIENT(host_client) && host_client->protocol != SCP_DARKPLACES7) if (ISNQCLIENT(host_client) && host_client->protocol != SCP_DARKPLACES7)
{ {
@ -1902,34 +1901,38 @@ void SV_BeginDownload_f(void)
} }
if (!strncmp(name, "demonum/", 8)) if (!strncmp(name, "demonum/", 8))
name = SV_MVDNum(atoi(name+8));
if (!name)
{ {
name = Cmd_Argv(1); // restore given name for cleaner error msg extern cvar_t sv_demoDir;
Sys_Printf ("Couldn't download %s to %s\n", name, host_client->name); char *mvdname = SV_MVDNum(atoi(name+8));
if (ISNQCLIENT(host_client))
if (!mvdname)
{ {
ClientReliableWrite_Begin (host_client, svc_stufftext, 2+strlen(name)); Sys_Printf ("Couldn't download %s to %s\n", name, host_client->name);
ClientReliableWrite_String (host_client, "\nstopdownload\n"); if (ISNQCLIENT(host_client))
} {
else ClientReliableWrite_Begin (host_client, svc_stufftext, 2+strlen(name));
ClientReliableWrite_String (host_client, "\nstopdownload\n");
}
else
#ifdef PEXT_CHUNKEDDOWNLOADS #ifdef PEXT_CHUNKEDDOWNLOADS
if (host_client->fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS) if (host_client->fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS)
{ {
ClientReliableWrite_Begin (host_client, svc_download, 10+strlen(name)); ClientReliableWrite_Begin (host_client, svc_download, 10+strlen(name));
ClientReliableWrite_Long (host_client, -1); ClientReliableWrite_Long (host_client, -1);
ClientReliableWrite_Long (host_client, -1); ClientReliableWrite_Long (host_client, -1);
ClientReliableWrite_String (host_client, name); ClientReliableWrite_String (host_client, name);
} }
else else
#endif #endif
{ {
ClientReliableWrite_Begin (host_client, ISQ2CLIENT(host_client)?svcq2_download:svc_download, 4); ClientReliableWrite_Begin (host_client, ISQ2CLIENT(host_client)?svcq2_download:svc_download, 4);
ClientReliableWrite_Short (host_client, -1); ClientReliableWrite_Short (host_client, -1);
ClientReliableWrite_Byte (host_client, 0); ClientReliableWrite_Byte (host_client, 0);
}
return;
} }
return;
snprintf(name, sizeof(name), "%s/%s", sv_demoDir.string, mvdname);
} }
// hacked by zoid to allow more conrol over download // hacked by zoid to allow more conrol over download