mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
* Make wads that don't modify the game not count towards the internal packet size tally in w_wad.c, like they wouldn't in d_netfil.c.
* Now that it's consistent, removed the redundant packet size tally check in d_netfil.c.
This commit is contained in:
parent
74c4ad4bad
commit
c2705b4662
2 changed files with 18 additions and 20 deletions
|
@ -59,6 +59,7 @@
|
||||||
#include "m_menu.h"
|
#include "m_menu.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "filesrch.h"
|
#include "filesrch.h"
|
||||||
|
#include "d_clisrv.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -103,6 +104,7 @@ INT32 lastfilenum = -1;
|
||||||
/** Fills a serverinfo packet with information about wad files loaded.
|
/** Fills a serverinfo packet with information about wad files loaded.
|
||||||
*
|
*
|
||||||
* \todo Give this function a better name since it is in global scope.
|
* \todo Give this function a better name since it is in global scope.
|
||||||
|
* Used to have size limiting built in - now handled via W_LoadWadFile in w_wad.c
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UINT8 *PutFileNeeded(void)
|
UINT8 *PutFileNeeded(void)
|
||||||
|
@ -111,7 +113,6 @@ UINT8 *PutFileNeeded(void)
|
||||||
UINT8 *p = netbuffer->u.serverinfo.fileneeded;
|
UINT8 *p = netbuffer->u.serverinfo.fileneeded;
|
||||||
char wadfilename[MAX_WADPATH] = "";
|
char wadfilename[MAX_WADPATH] = "";
|
||||||
UINT8 filestatus;
|
UINT8 filestatus;
|
||||||
size_t bytesused = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < numwadfiles; i++)
|
for (i = 0; i < numwadfiles; i++)
|
||||||
{
|
{
|
||||||
|
@ -129,12 +130,6 @@ UINT8 *PutFileNeeded(void)
|
||||||
else
|
else
|
||||||
filestatus += (1 << 4); // Will send if requested
|
filestatus += (1 << 4); // Will send if requested
|
||||||
|
|
||||||
bytesused += (nameonlylength(wadfilename) + 22);
|
|
||||||
|
|
||||||
// Don't write too far...
|
|
||||||
if (bytesused > sizeof(netbuffer->u.serverinfo.fileneeded))
|
|
||||||
I_Error("Too many wad files added to host a game. (%s, stopped on %s)\n", sizeu1(bytesused), wadfilename);
|
|
||||||
|
|
||||||
WRITEUINT8(p, filestatus);
|
WRITEUINT8(p, filestatus);
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
29
src/w_wad.c
29
src/w_wad.c
|
@ -319,21 +319,24 @@ UINT16 W_LoadWadFile(const char *filename)
|
||||||
|
|
||||||
// Check if wad files will overflow fileneededbuffer. Only the filename part
|
// Check if wad files will overflow fileneededbuffer. Only the filename part
|
||||||
// is send in the packet; cf.
|
// is send in the packet; cf.
|
||||||
packetsize = packetsizetally;
|
// see PutFileNeeded in d_netfil.c
|
||||||
|
if (!W_VerifyNMUSlumps(filename))
|
||||||
packetsize += nameonlylength(filename);
|
|
||||||
packetsize += 22;
|
|
||||||
|
|
||||||
if (packetsize > MAXFILENEEDED*sizeof(UINT8))
|
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Maximum wad files reached\n"));
|
packetsize = packetsizetally;
|
||||||
refreshdirmenu |= REFRESHDIR_MAX;
|
|
||||||
if (handle)
|
|
||||||
fclose(handle);
|
|
||||||
return INT16_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
packetsizetally = packetsize;
|
packetsize += nameonlylength(filename) + 22;
|
||||||
|
|
||||||
|
if (packetsize > MAXFILENEEDED*sizeof(UINT8))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_ERROR, M_GetText("Maximum wad files reached\n"));
|
||||||
|
refreshdirmenu |= REFRESHDIR_MAX;
|
||||||
|
if (handle)
|
||||||
|
fclose(handle);
|
||||||
|
return INT16_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
packetsizetally = packetsize;
|
||||||
|
}
|
||||||
|
|
||||||
// detect dehacked file with the "soc" extension
|
// detect dehacked file with the "soc" extension
|
||||||
if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
|
if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
|
||||||
|
|
Loading…
Reference in a new issue