X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=server.h;h=fdc94cd2187d28b53c59c1e6dfa54776082cc9bf;hb=7baa89eb79dceb9c02213028c8c6598e17348916;hp=47e917c24e6171bbdf8a5c22dbf2b5579c96bfa1;hpb=3b559840aaf1e5a218052d893881c1dd8c1b0780;p=xonotic%2Fdarkplaces.git diff --git a/server.h b/server.h index 47e917c2..fdc94cd2 100644 --- a/server.h +++ b/server.h @@ -24,8 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { + // number of svs.clients slots (updated by maxplayers command) int maxclients; - // [maxclients] + // client slots struct client_s *clients; // episode completion information int serverflags; @@ -67,13 +68,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,7 +101,7 @@ typedef struct typedef struct client_s { - // false = client is free + // false = empty client slot qboolean active; // false = don't send datagrams qboolean spawned; @@ -104,20 +109,16 @@ typedef struct client_s 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.clients 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 +128,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,10 +249,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 mempool_t *sv_clients_mempool; +extern mempool_t *sv_edicts_mempool; + // persistant server info extern server_static_t svs; // local server @@ -277,6 +279,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 +288,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 +301,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