From 349e97bc5dc208123d9e48224d3c577723ef58df Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 11 Feb 2013 15:49:47 -0600 Subject: Unify/cleanup max snapshot entities on client and server --- src/client/client.h | 2 +- src/qcommon/qcommon.h | 2 ++ src/server/server.h | 2 +- src/server/sv_init.c | 8 ++++---- src/server/sv_snapshot.c | 1 - 5 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/client.h b/src/client/client.h index bd50fbb6..f3d52a24 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -88,7 +88,7 @@ typedef struct { // the parseEntities array must be large enough to hold PACKET_BACKUP frames of // entities, so that when a delta compressed message arives from the server // it can be un-deltad from the original -#define MAX_PARSE_ENTITIES 2048 +#define MAX_PARSE_ENTITIES ( PACKET_BACKUP * MAX_SNAPSHOT_ENTITIES ) extern int g_console_field_width; diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h index f3a6cad4..430937c5 100644 --- a/src/qcommon/qcommon.h +++ b/src/qcommon/qcommon.h @@ -132,6 +132,8 @@ NET #define MAX_PACKET_USERCMDS 32 // max number of usercmd_t in a packet +#define MAX_SNAPSHOT_ENTITIES 256 + #define PORT_ANY -1 #define MAX_RELIABLE_COMMANDS 128 // max string commands buffered for restransmit diff --git a/src/server/server.h b/src/server/server.h index c4c9edd0..06361190 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -237,7 +237,7 @@ typedef struct { int snapFlagServerBit; // ^= SNAPFLAG_SERVERCOUNT every SV_SpawnServer() client_t *clients; // [sv_maxclients->integer]; - int numSnapshotEntities; // sv_maxclients->integer*PACKET_BACKUP*MAX_PACKET_ENTITIES + int numSnapshotEntities; // sv_maxclients->integer*PACKET_BACKUP*MAX_SNAPSHOT_ENTITIES int nextSnapshotEntities; // next snapshotEntities to use entityState_t *snapshotEntities; // [numSnapshotEntities] int nextHeartbeatTime; diff --git a/src/server/sv_init.c b/src/server/sv_init.c index dd5eef51..1f06b7c4 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -302,10 +302,10 @@ static void SV_Startup( void ) { svs.clients = Z_Malloc (sizeof(client_t) * sv_maxclients->integer ); if ( com_dedicated->integer ) { - svs.numSnapshotEntities = sv_maxclients->integer * PACKET_BACKUP * 64; + svs.numSnapshotEntities = sv_maxclients->integer * PACKET_BACKUP * MAX_SNAPSHOT_ENTITIES; } else { // we don't need nearly as many when playing locally - svs.numSnapshotEntities = sv_maxclients->integer * 4 * 64; + svs.numSnapshotEntities = sv_maxclients->integer * 4 * MAX_SNAPSHOT_ENTITIES; } svs.initialized = qtrue; @@ -380,10 +380,10 @@ void SV_ChangeMaxClients( void ) { // allocate new snapshot entities if ( com_dedicated->integer ) { - svs.numSnapshotEntities = sv_maxclients->integer * PACKET_BACKUP * 64; + svs.numSnapshotEntities = sv_maxclients->integer * PACKET_BACKUP * MAX_SNAPSHOT_ENTITIES; } else { // we don't need nearly as many when playing locally - svs.numSnapshotEntities = sv_maxclients->integer * 4 * 64; + svs.numSnapshotEntities = sv_maxclients->integer * 4 * MAX_SNAPSHOT_ENTITIES; } } diff --git a/src/server/sv_snapshot.c b/src/server/sv_snapshot.c index a16b6b2c..6babe979 100644 --- a/src/server/sv_snapshot.c +++ b/src/server/sv_snapshot.c @@ -236,7 +236,6 @@ Build a client snapshot structure ============================================================================= */ -#define MAX_SNAPSHOT_ENTITIES 1024 typedef struct { int numSnapshotEntities; int snapshotEntities[MAX_SNAPSHOT_ENTITIES]; -- cgit