mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Send the rest of the file list
This commit is contained in:
parent
0e2bef3f1a
commit
b59645e1b1
2 changed files with 73 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
|
#include "d_netfil.h" // fileneedednum
|
||||||
#include "d_main.h"
|
#include "d_main.h"
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
@ -1140,6 +1141,7 @@ static void GetPackets(void);
|
||||||
static cl_mode_t cl_mode = CL_SEARCHING;
|
static cl_mode_t cl_mode = CL_SEARCHING;
|
||||||
static boolean cl_needsdownload = false;
|
static boolean cl_needsdownload = false;
|
||||||
|
|
||||||
|
static UINT16 cl_lastcheckedfilecount = 0;
|
||||||
static UINT8 cl_challengenum = 0;
|
static UINT8 cl_challengenum = 0;
|
||||||
static UINT8 cl_challengequestion[MD5_LEN+1];
|
static UINT8 cl_challengequestion[MD5_LEN+1];
|
||||||
static char cl_challengepassword[65];
|
static char cl_challengepassword[65];
|
||||||
|
@ -1316,6 +1318,14 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static boolean CL_AskFileList(INT32 firstfile)
|
||||||
|
{
|
||||||
|
netbuffer->packettype = PT_TELLFILESNEEDED;
|
||||||
|
netbuffer->u.filesneedednum = firstfile;
|
||||||
|
|
||||||
|
return HSendPacket(servernode, true, 0, sizeof (INT32));
|
||||||
|
}
|
||||||
|
|
||||||
/** Sends a special packet to declare how many players in local
|
/** Sends a special packet to declare how many players in local
|
||||||
* Used only in arbitratrenetstart()
|
* Used only in arbitratrenetstart()
|
||||||
* Sends a PT_CLIENTJOIN packet to the server
|
* Sends a PT_CLIENTJOIN packet to the server
|
||||||
|
@ -2032,6 +2042,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
|
||||||
if (serverlist[i].info.kartvars & SV_LOTSOFADDONS)
|
if (serverlist[i].info.kartvars & SV_LOTSOFADDONS)
|
||||||
{
|
{
|
||||||
cl_mode = CL_ASKFULLFILELIST;
|
cl_mode = CL_ASKFULLFILELIST;
|
||||||
|
cl_lastcheckedfilecount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2087,6 +2098,22 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CL_ASKFULLFILELIST:
|
||||||
|
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
|
||||||
|
{
|
||||||
|
if (!CL_FinishedFileList())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (fileneedednum != cl_lastcheckedfilecount || *asksent + NEWTICRATE < I_GetTime())
|
||||||
|
{
|
||||||
|
if (CL_AskFileList(fileneedednum))
|
||||||
|
{
|
||||||
|
cl_lastcheckedfilecount = fileneedednum;
|
||||||
|
*asksent = I_GetTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case CL_DOWNLOADFILES:
|
case CL_DOWNLOADFILES:
|
||||||
waitmore = false;
|
waitmore = false;
|
||||||
for (i = 0; i < fileneedednum; i++)
|
for (i = 0; i < fileneedednum; i++)
|
||||||
|
@ -3969,6 +3996,39 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PT_TELLFILESNEEDED:
|
||||||
|
if (server && serverrunning)
|
||||||
|
{
|
||||||
|
UINT8 *p;
|
||||||
|
INT32 firstfile = netbuffer->u.filesneedednum;
|
||||||
|
|
||||||
|
netbuffer->packettype = PT_MOREFILESNEEDED;
|
||||||
|
netbuffer->u.filesneededcfg.first = firstfile;
|
||||||
|
netbuffer->u.filesneededcfg.more = 0;
|
||||||
|
|
||||||
|
p = PutFileNeeded(firstfile);
|
||||||
|
|
||||||
|
HSendPacket(node, false, 0, p - ((UINT8 *)&netbuffer->u));
|
||||||
|
}
|
||||||
|
else // Shouldn't get this if you aren't the server...?
|
||||||
|
Net_CloseConnection(node);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PT_MOREFILESNEEDED:
|
||||||
|
if (server && serverrunning)
|
||||||
|
{ // But wait I thought I'm the server?
|
||||||
|
Net_CloseConnection(node);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SERVERONLY
|
||||||
|
if (cl_mode == CL_ASKFULLFILELIST && netbuffer->u.filesneededcfg.first == fileneedednum)
|
||||||
|
{
|
||||||
|
D_ParseFileneeded(netbuffer->u.filesneededcfg.num, netbuffer->u.filesneededcfg.files, netbuffer->u.filesneededcfg.first);
|
||||||
|
if (!netbuffer->u.filesneededcfg.more)
|
||||||
|
cl_lastcheckedfilecount = UINT16_MAX; // Got the whole file list
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case PT_ASKINFO:
|
case PT_ASKINFO:
|
||||||
if (server && serverrunning)
|
if (server && serverrunning)
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,6 +93,9 @@ typedef enum
|
||||||
PT_NODETIMEOUT, // Packet sent to self if the connection times out.
|
PT_NODETIMEOUT, // Packet sent to self if the connection times out.
|
||||||
PT_RESYNCHING, // Packet sent to resync players.
|
PT_RESYNCHING, // Packet sent to resync players.
|
||||||
// Blocks game advance until synched.
|
// Blocks game advance until synched.
|
||||||
|
|
||||||
|
PT_TELLFILESNEEDED, // Client, to server: "what other files do I need starting from this number?"
|
||||||
|
PT_MOREFILESNEEDED, // Server, to client: "you need these (+ more on top of those)"
|
||||||
#ifdef NEWPING
|
#ifdef NEWPING
|
||||||
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
||||||
#endif
|
#endif
|
||||||
|
@ -442,6 +445,14 @@ typedef struct
|
||||||
UINT8 ctfteam;
|
UINT8 ctfteam;
|
||||||
} ATTRPACK plrconfig;
|
} ATTRPACK plrconfig;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
INT32 first;
|
||||||
|
UINT8 num;
|
||||||
|
UINT8 more;
|
||||||
|
UINT8 files[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
|
||||||
|
} ATTRPACK filesneededconfig_pak;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Network packet data
|
// Network packet data
|
||||||
//
|
//
|
||||||
|
@ -474,6 +485,8 @@ typedef struct
|
||||||
msaskinfo_pak msaskinfo; // 22 bytes
|
msaskinfo_pak msaskinfo; // 22 bytes
|
||||||
plrinfo playerinfo[MAXPLAYERS]; // 576 bytes(?)
|
plrinfo playerinfo[MAXPLAYERS]; // 576 bytes(?)
|
||||||
plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?)
|
plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?)
|
||||||
|
INT32 filesneedednum; // 4 bytes
|
||||||
|
filesneededconfig_pak filesneededcfg; // ??? bytes
|
||||||
#ifdef NEWPING
|
#ifdef NEWPING
|
||||||
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
|
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue