]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - server.h
fixed loadgame bug with edict references to later edicts (d was pointing at the old...
[xonotic/darkplaces.git] / server.h
index 47e917c24e6171bbdf8a5c22dbf2b5579c96bfa1..490dd52c648080a5d17e7be2f6359cd7fb9a8eb0 100644 (file)
--- a/server.h
+++ b/server.h
@@ -24,9 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 typedef struct
 {
-       int maxclients;
-       // [maxclients]
-       struct client_s *clients;
+       // NULL pointers are non-existent clients
+       struct client_s *connectedclients[MAX_SCOREBOARD];
        // episode completion information
        int serverflags;
        // cleared when at SV_SpawnServer
@@ -67,13 +66,17 @@ typedef struct
        char *lightstyles[MAX_LIGHTSTYLES];
        int num_edicts;
        int max_edicts;
-       // can NOT be array indexed, because edict_t is variable sized, but can be used to reference the world ent
+       // small edict_t structures which just contain pointers
+       // (allocated at server startup only)
        edict_t *edicts;
-       // can be array indexed
-       edict_t **edictstable;
-       // array of QC edict field variables
+       // engine private edict information
+       // (dynamically resized - always access through edict_t!)
+       edict_engineprivate_t *edictsengineprivate;
+       // QuakeC fields array
+       // (dynamically resized - always access through edict_t!)
        void *edictsfields;
        // PushMove sometimes has to move entities back from a failed move
+       // (dynamically resized)
        edict_t **moved_edicts;
        // some actions are only valid during load
        server_state_t state;
@@ -96,28 +99,22 @@ typedef struct
 
 typedef struct client_s
 {
-       // false = client is free
-       qboolean active;
        // false = don't send datagrams
        qboolean spawned;
        // has been told to go to another level
        qboolean dropasap;
        // only valid before spawned
        qboolean sendsignon;
-
-#ifndef NOROUTINGFIX
-       // LordHavoc: to make netquake protocol get through NAT routers, have to wait for client to ack
-       // waiting for connect from client (stage 1)
-       qboolean waitingforconnect;
-       // send server info in next datagram (stage 2)
-       qboolean sendserverinfo;
-#endif
+       // remove this client immediately
+       qboolean deadsocket;
+       // index of this client in the svs.connectedclients pointer array
+       int number;
 
        // reliable messages must be sent periodically
        double last_message;
 
        // communications handle
-       struct qsocket_s *netconnection;
+       netconn_t *netconnection;
 
        // movement
        usercmd_t cmd;
@@ -127,37 +124,36 @@ typedef struct client_s
        // can be added to at any time, copied and clear once per frame
        sizebuf_t message;
        qbyte msgbuf[MAX_DATAGRAM];
-       // (clientnum+1)
-       int edictnumber;
-       // for printing to other people
-       char name[32];
-       int colors;
+       // EDICT_NUM(clientnum+1)
+       edict_t *edict;
 
        float ping_times[NUM_PING_TIMES];
        // ping_times[num_pings%NUM_PING_TIMES]
        int num_pings;
        // LordHavoc: can be used for prediction or whatever...
        float ping;
-       // LordHavoc: specifically used for prediction, accounts for sys_ticrate too
-       float latency;
 
 // spawn parms are carried from level to level
        float spawn_parms[NUM_SPAWN_PARMS];
 
-// client known data for deltas
-       int old_frags;
+       // properties that are sent across the network only when changed
+       char name[64], old_name[64];
+       int colors, old_colors;
+       int frags, old_frags;
+       // other properties not sent across the network
        int pmodel;
 
+       // visibility state
+       float visibletime[MAX_EDICTS];
 #ifdef QUAKEENTITIES
        // delta compression state
        float nextfullupdate[MAX_EDICTS];
-#endif
-       // visibility state
-       float visibletime[MAX_EDICTS];
-
-#ifndef QUAKEENTITIES
+#elif 0
        entity_database_t entitydatabase;
        int entityframenumber; // incremented each time an entity frame is sent
+#else
+       entity_database4_t *entitydatabase4;
+       int entityframenumber; // incremented each time an entity frame is sent
 #endif
 } client_t;
 
@@ -249,9 +245,12 @@ extern cvar_t sv_maxspeed;
 extern cvar_t sv_accelerate;
 extern cvar_t sv_idealpitchscale;
 extern cvar_t sv_aim;
-extern cvar_t sv_predict;
 extern cvar_t sv_stepheight;
 extern cvar_t sv_jumpstep;
+extern cvar_t sv_maxplayers;
+
+extern mempool_t *sv_clients_mempool;
+extern mempool_t *sv_edicts_mempool;
 
 // persistant server info
 extern server_static_t svs;
@@ -277,6 +276,8 @@ void SV_DropClient (qboolean crash);
 void SV_SendClientMessages (void);
 void SV_ClearDatagram (void);
 
+void SV_ReadClientMessage(void);
+
 int SV_ModelIndex (const char *name);
 
 void SV_SetIdealPitch (void);
@@ -284,7 +285,6 @@ void SV_SetIdealPitch (void);
 void SV_AddUpdates (void);
 
 void SV_ClientThink (void);
-void SV_AddClientToServer (struct qsocket_s    *ret);
 
 void SV_ClientPrintf (const char *fmt, ...);
 void SV_BroadcastPrintf (const char *fmt, ...);
@@ -298,13 +298,10 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg);
 
 void SV_MoveToGoal (void);
 
-void SV_CheckForNewClients (void);
 void SV_RunClients (void);
 void SV_SaveSpawnparms (void);
 void SV_SpawnServer (const char *server);
 
-void SV_SetMaxClients(int n);
-
 void SV_CheckVelocity (edict_t *ent);
 
 #endif