mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Read the file list properly
This commit is contained in:
parent
b59645e1b1
commit
014f916040
1 changed files with 15 additions and 9 deletions
|
@ -111,7 +111,7 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
UINT8 count = 0;
|
UINT8 count = 0;
|
||||||
UINT8 *p_start = netbuffer->u.serverinfo.fileneeded;
|
UINT8 *p_start = netbuffer->packettype == PT_MOREFILESNEEDED ? netbuffer->u.filesneededcfg.files : netbuffer->u.serverinfo.fileneeded;
|
||||||
UINT8 *p = p_start;
|
UINT8 *p = p_start;
|
||||||
char wadfilename[MAX_WADPATH] = "";
|
char wadfilename[MAX_WADPATH] = "";
|
||||||
UINT8 filestatus;
|
UINT8 filestatus;
|
||||||
|
@ -133,7 +133,10 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
|
||||||
if (p + 1 + 4 + strlen(wadfilename) + 16 > p_start + MAXFILENEEDED)
|
if (p + 1 + 4 + strlen(wadfilename) + 16 > p_start + MAXFILENEEDED)
|
||||||
{
|
{
|
||||||
// Too many files to send all at once
|
// Too many files to send all at once
|
||||||
netbuffer->u.serverinfo.kartvars |= SV_LOTSOFADDONS;
|
if (netbuffer->packettype == PT_MOREFILESNEEDED)
|
||||||
|
netbuffer->u.filesneededcfg.more = 1;
|
||||||
|
else
|
||||||
|
netbuffer->u.serverinfo.kartvars |= SV_LOTSOFADDONS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +157,10 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
|
||||||
WRITESTRINGN(p, wadfilename, MAX_WADPATH);
|
WRITESTRINGN(p, wadfilename, MAX_WADPATH);
|
||||||
WRITEMEM(p, wadfiles[i]->md5sum, 16);
|
WRITEMEM(p, wadfiles[i]->md5sum, 16);
|
||||||
}
|
}
|
||||||
netbuffer->u.serverinfo.fileneedednum = count;
|
if (netbuffer->packettype == PT_MOREFILESNEEDED)
|
||||||
|
netbuffer->u.filesneededcfg.num = count;
|
||||||
|
else
|
||||||
|
netbuffer->u.serverinfo.fileneedednum = count;
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -354,7 +360,8 @@ INT32 CL_CheckFiles(void)
|
||||||
// the first is the iwad (the main wad file)
|
// the first is the iwad (the main wad file)
|
||||||
// we don't care if it's called srb2.srb or srb2.wad.
|
// we don't care if it's called srb2.srb or srb2.wad.
|
||||||
// Never download the IWAD, just assume it's there and identical
|
// Never download the IWAD, just assume it's there and identical
|
||||||
fileneeded[0].status = FS_OPEN;
|
// ...No! Why were we sending the base wads to begin with??
|
||||||
|
//fileneeded[0].status = FS_OPEN;
|
||||||
|
|
||||||
// Modified game handling -- check for an identical file list
|
// Modified game handling -- check for an identical file list
|
||||||
// must be identical in files loaded AND in order
|
// must be identical in files loaded AND in order
|
||||||
|
@ -362,7 +369,7 @@ INT32 CL_CheckFiles(void)
|
||||||
if (modifiedgame)
|
if (modifiedgame)
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n");
|
CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n");
|
||||||
for (i = 1, j = 1; i < fileneedednum || j < numwadfiles;)
|
for (i = 0, j = mainwads; i < fileneedednum || j < numwadfiles;)
|
||||||
{
|
{
|
||||||
if (j < numwadfiles && !wadfiles[j]->important)
|
if (j < numwadfiles && !wadfiles[j]->important)
|
||||||
{
|
{
|
||||||
|
@ -389,12 +396,12 @@ INT32 CL_CheckFiles(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < fileneedednum; i++)
|
for (i = 0; i < fileneedednum; i++)
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
||||||
|
|
||||||
// Check in already loaded files
|
// Check in already loaded files
|
||||||
for (j = 1; wadfiles[j]; j++)
|
for (j = mainwads; wadfiles[j]; j++)
|
||||||
{
|
{
|
||||||
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
||||||
if (!stricmp(wadfilename, fileneeded[i].filename) &&
|
if (!stricmp(wadfilename, fileneeded[i].filename) &&
|
||||||
|
@ -410,8 +417,7 @@ INT32 CL_CheckFiles(void)
|
||||||
|
|
||||||
packetsize += nameonlylength(fileneeded[i].filename) + 22;
|
packetsize += nameonlylength(fileneeded[i].filename) + 22;
|
||||||
|
|
||||||
if ((numwadfiles+filestoget >= MAX_WADFILES)
|
if (mainwads+filestoget >= MAX_WADFILES)
|
||||||
|| (packetsize > MAXFILENEEDED*sizeof(UINT8)))
|
|
||||||
return 3;
|
return 3;
|
||||||
|
|
||||||
filestoget++;
|
filestoget++;
|
||||||
|
|
Loading…
Reference in a new issue