MAX_ENTITIES patch from phrosty

This commit is contained in:
Bill Currie 2007-04-19 07:36:12 +00:00 committed by Jeff Teunissen
parent bf15d0cb6a
commit 52f7bd4bb4
9 changed files with 30 additions and 8 deletions

View file

@ -34,8 +34,12 @@
#include "QF/qdefs.h"
#include "QF/sizebuf.h"
#define MAX_MSGLEN 1450 // max length of a reliable message
#define MAX_DATAGRAM 1450 // max length of unreliable message
//#define MAX_MSGLEN 1450 // max length of a reliable message
//#define MAX_DATAGRAM 1450 // max length of unreliable message
#define MAX_MSGLEN 2900
#define MAX_DATAGRAM 2900
#define MAX_OLD_MSGLEN 1450
#define MAX_OLD_DATAGRAM 1450
#define PORT_ANY -1

View file

@ -322,6 +322,7 @@ typedef struct {
} entity_state_t;
#define MAX_PACKET_ENTITIES 64 // doesn't count nails
#define MAX_EXT_PACKET_ENTITIES 128 // doesn't count nails
#define MAX_DEMO_PACKET_ENTITIES 196 // doesn't count nails
typedef struct {
int num_entities;

View file

@ -53,7 +53,7 @@ typedef struct client_s {
byte datagram_buf[MAX_DATAGRAM];
qboolean send_message;
frame_t frames[UPDATE_BACKUP];
entity_state_t packet_entities[UPDATE_BACKUP][MAX_PACKET_ENTITIES];
entity_state_t packet_entities[UPDATE_BACKUP][MAX_EXT_PACKET_ENTITIES];
int delta_sequence;

View file

@ -1020,7 +1020,7 @@ write_entities (client_t *client, sizebuf_t *msg)
// continue; // added to the special update list
// add to the packetentities
if (pack->num_entities == MAX_PACKET_ENTITIES) {
if (pack->num_entities == MAX_EXT_PACKET_ENTITIES) {
qtv_printf ("mpe overflow\n");
continue; // all full
}

View file

@ -246,6 +246,8 @@ typedef struct client_s {
double last_check;
double cuff_time;
float stdver;
int max_packet_ents; // either MAX_PACKET_ENTITIES or MAX_EXT_PACKET_ENTITIES
} client_t;
// a client can leave the server in one of four ways:

View file

@ -665,7 +665,9 @@ CL_AddQFInfoKeys (void)
// i * irc
// p pogo stick control
// t team messages
static const char *cap = "pt"
// e large entity/packet maximum. (128)
// u large packet support. (2x normal)
static const char *cap = "pteu"
#ifdef HAVE_ZLIB
"z"
#endif

View file

@ -768,7 +768,7 @@ SV_WriteEntitiesToClient (delta_t *delta, sizebuf_t *msg)
packet_entities_t *pack;
if (delta->client) {
max_packet_entities = MAX_PACKET_ENTITIES;
max_packet_entities = delta->client->max_packet_ents;
stdver = delta->client->stdver;
}

View file

@ -102,7 +102,7 @@ cbuf_t *sv_cbuf;
cbuf_args_t *sv_args;
client_t *host_client; // current client
entity_state_t cl_entities[MAX_CLIENTS][UPDATE_BACKUP+1][MAX_PACKET_ENTITIES]; // client entities
entity_state_t cl_entities[MAX_CLIENTS][UPDATE_BACKUP+1][MAX_EXT_PACKET_ENTITIES]; // client entities
double sv_frametime;
double realtime; // without any filtering or bounding
@ -916,9 +916,11 @@ SVC_DirectConnect (void)
newcl->prespawned = false;
newcl->spawned = false;
newcl->max_packet_ents = (strchr(Info_ValueForKey (userinfo, "*cap"), 'e') != 0) ? MAX_EXT_PACKET_ENTITIES : MAX_PACKET_ENTITIES;
newcl->datagram.allowoverflow = true;
newcl->datagram.data = newcl->datagram_buf;
newcl->datagram.maxsize = sizeof (newcl->datagram_buf);
newcl->datagram.maxsize = (strchr(Info_ValueForKey (userinfo, "*cap"), 'u') != 0) ? MAX_DATAGRAM : MAX_OLD_DATAGRAM;
// spectator mode can ONLY be set at join time
newcl->spectator = spectator;
@ -945,6 +947,16 @@ SVC_DirectConnect (void)
NET_AdrToString (adr));
newcl->sendinfo = true;
if(newcl->max_packet_ents == MAX_EXT_PACKET_ENTITIES) {
SV_Printf ("Client %s (%s) supports large entity counts\n", newcl->name,
NET_AdrToString (adr));
}
if(newcl->datagram.maxsize == MAX_DATAGRAM) {
SV_Printf ("Client %s (%s) supports large datagram sizes\n", newcl->name,
NET_AdrToString (adr));
}
// QuakeForge stuff.
newcl->msecs = 0;
newcl->msec_cheating = 0;

View file

@ -643,6 +643,7 @@ SV_SendClientDatagram (client_t *client)
SV_Printf ("WARNING: msg overflowed for %s\n", client->name);
SZ_Clear (&msg);
}
// send the datagram
Netchan_Transmit (&client->netchan, msg.cursize, msg.data);