#include "../game/q_shared.h"
#include "../qcommon/qcommon.h"
#include "../game/g_public.h"
#include "../game/bg_public.h"
Include dependency graph for server.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 31 of file server.h. Referenced by CalculateRanks(), CG_DrawOldScoreboard(), CG_GetGameStatusText(), CG_Obituary(), DeathmatchScoreboardMessage(), LogExit(), SV_Status_f(), SVC_Status(), and UpdateTournamentInfo(). |
|
|
|
Referenced by SV_Netchan_Transmit(), and SV_Netchan_TransmitNextFragment(). |
|
|
|
Definition at line 100 of file server.h. 00100 {
00101 CS_FREE, // can be reused for a new connection
00102 CS_ZOMBIE, // client has been disconnected, but don't reuse
00103 // connection for a couple seconds
00104 CS_CONNECTED, // has been assigned to a client_t, but no gamestate yet
00105 CS_PRIMED, // gamestate has been sent, but client hasn't sent a usercmd
00106 CS_ACTIVE // client is fully in game
00107 } clientState_t;
|
|
|
Definition at line 48 of file server.h. 00048 {
00049 SS_DEAD, // no map loaded
00050 SS_LOADING, // spawning level entities
00051 SS_GAME // actively running
00052 } serverState_t;
|
|
||||||||||||||||
|
Definition at line 317 of file sv_bot.c. References bot_debugpoly_t, bot_debugpoly_s::color, Com_Memcpy(), debugpolygons, i, bot_debugpoly_s::inuse, bot_debugpoly_s::numPoints, bot_debugpoly_s::points, points, and vec3_t. Referenced by BotImport_DebugLineCreate(), and SV_GameSystemCalls(). 00317 {
00318 bot_debugpoly_t *poly;
00319 int i;
00320
00321 if (!debugpolygons)
00322 return 0;
00323
00324 for (i = 1; i < bot_maxdebugpolys; i++) {
00325 if (!debugpolygons[i].inuse)
00326 break;
00327 }
00328 if (i >= bot_maxdebugpolys)
00329 return 0;
00330 poly = &debugpolygons[i];
00331 poly->inuse = qtrue;
00332 poly->color = color;
00333 poly->numPoints = numPoints;
00334 Com_Memcpy(poly->points, points, numPoints * sizeof(vec3_t));
00335 //
00336 return i;
00337 }
|
Here is the call graph for this function:

|
|
Definition at line 360 of file sv_bot.c. References debugpolygons, and bot_debugpoly_s::inuse. Referenced by BotImport_DebugLineDelete(), and SV_GameSystemCalls(). 00361 {
00362 if (!debugpolygons) return;
00363 debugpolygons[id].inuse = qfalse;
00364 }
|
|
|
Definition at line 710 of file sv_ccmds.c. References Cmd_AddCommand(), com_dedicated, cvar_s::integer, qboolean, SV_Ban_f(), SV_BanNum_f(), SV_ConSay_f(), SV_DumpUser_f(), SV_Heartbeat_f(), SV_Kick_f(), SV_KickNum_f(), SV_KillServer_f(), SV_Map_f(), SV_MapRestart_f(), SV_SectorList_f(), SV_Serverinfo_f(), SV_Status_f(), and SV_Systeminfo_f(). Referenced by SV_Init(). 00710 {
00711 static qboolean initialized;
00712
00713 if ( initialized ) {
00714 return;
00715 }
00716 initialized = qtrue;
00717
00718 Cmd_AddCommand ("heartbeat", SV_Heartbeat_f);
00719 Cmd_AddCommand ("kick", SV_Kick_f);
00720 Cmd_AddCommand ("banUser", SV_Ban_f);
00721 Cmd_AddCommand ("banClient", SV_BanNum_f);
00722 Cmd_AddCommand ("clientkick", SV_KickNum_f);
00723 Cmd_AddCommand ("status", SV_Status_f);
00724 Cmd_AddCommand ("serverinfo", SV_Serverinfo_f);
00725 Cmd_AddCommand ("systeminfo", SV_Systeminfo_f);
00726 Cmd_AddCommand ("dumpuser", SV_DumpUser_f);
00727 Cmd_AddCommand ("map_restart", SV_MapRestart_f);
00728 Cmd_AddCommand ("sectorlist", SV_SectorList_f);
00729 Cmd_AddCommand ("map", SV_Map_f);
00730 #ifndef PRE_RELEASE_DEMO
00731 Cmd_AddCommand ("devmap", SV_Map_f);
00732 Cmd_AddCommand ("spmap", SV_Map_f);
00733 Cmd_AddCommand ("spdevmap", SV_Map_f);
00734 #endif
00735 Cmd_AddCommand ("killserver", SV_KillServer_f);
00736 if( com_dedicated->integer ) {
00737 Cmd_AddCommand ("say", SV_ConSay_f);
00738 }
00739 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 128 of file sv_main.c. References client_t, Com_Printf(), i, MAX_RELIABLE_COMMANDS, Q_strncpyz(), client_s::reliableAcknowledge, client_s::reliableCommands, client_s::reliableSequence, and SV_DropClient(). Referenced by SV_MapRestart_f(), and SV_SendServerCommand(). 00128 {
00129 int index, i;
00130
00131 // this is very ugly but it's also a waste to for instance send multiple config string updates
00132 // for the same config string index in one snapshot
00133 // if ( SV_ReplacePendingServerCommands( client, cmd ) ) {
00134 // return;
00135 // }
00136
00137 client->reliableSequence++;
00138 // if we would be losing an old command that hasn't been acknowledged,
00139 // we must drop the connection
00140 // we check == instead of >= so a broadcast print added by SV_DropClient()
00141 // doesn't cause a recursive drop client
00142 if ( client->reliableSequence - client->reliableAcknowledge == MAX_RELIABLE_COMMANDS + 1 ) {
00143 Com_Printf( "===== pending server commands =====\n" );
00144 for ( i = client->reliableAcknowledge + 1 ; i <= client->reliableSequence ; i++ ) {
00145 Com_Printf( "cmd %5d: %s\n", i, client->reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
00146 }
00147 Com_Printf( "cmd %5d: %s\n", i, cmd );
00148 SV_DropClient( client, "Server command overflow" );
00149 return;
00150 }
00151 index = client->reliableSequence & ( MAX_RELIABLE_COMMANDS - 1 );
00152 Q_strncpyz( client->reliableCommands[ index ], cmd, sizeof( client->reliableCommands[ index ] ) );
00153 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 430 of file sv_world.c. References areaParms_t::count, areaParms_t::list, areaParms_t::maxcount, areaParms_t::maxs, areaParms_t::mins, SV_AreaEntities_r(), and sv_worldSectors. Referenced by SV_ClipMoveToEntities(), SV_GameSystemCalls(), and SV_PointContents(). 00430 {
00431 areaParms_t ap;
00432
00433 ap.mins = mins;
00434 ap.maxs = maxs;
00435 ap.list = entityList;
00436 ap.count = 0;
00437 ap.maxcount = maxcount;
00438
00439 SV_AreaEntities_r( sv_worldSectors, &ap );
00440
00441 return ap.count;
00442 }
|
Here is the call graph for this function:

|
|
Definition at line 147 of file sv_client.c. References challenge_t::adr, atoi, serverStatic_t::authorizeAddress, challenge_t::challenge, serverStatic_t::challenges, Cmd_Argv(), Com_Memset(), Com_Printf(), Cvar_VariableValue(), i, NET_CompareBaseAdr(), NET_OutOfBandPrint(), NS_SERVER, challenge_t::pingTime, Q_stricmp(), r, s, sprintf(), svs, and serverStatic_t::time. Referenced by SV_ConnectionlessPacket(). 00147 {
00148 int challenge;
00149 int i;
00150 char *s;
00151 char *r;
00152 char ret[1024];
00153
00154 if ( !NET_CompareBaseAdr( from, svs.authorizeAddress ) ) {
00155 Com_Printf( "SV_AuthorizeIpPacket: not from authorize server\n" );
00156 return;
00157 }
00158
00159 challenge = atoi( Cmd_Argv( 1 ) );
00160
00161 for (i = 0 ; i < MAX_CHALLENGES ; i++) {
00162 if ( svs.challenges[i].challenge == challenge ) {
00163 break;
00164 }
00165 }
00166 if ( i == MAX_CHALLENGES ) {
00167 Com_Printf( "SV_AuthorizeIpPacket: challenge not found\n" );
00168 return;
00169 }
00170
00171 // send a packet back to the original client
00172 svs.challenges[i].pingTime = svs.time;
00173 s = Cmd_Argv( 2 );
00174 r = Cmd_Argv( 3 ); // reason
00175
00176 if ( !Q_stricmp( s, "demo" ) ) {
00177 if ( Cvar_VariableValue( "fs_restrict" ) ) {
00178 // a demo client connecting to a demo server
00179 NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr,
00180 "challengeResponse %i", svs.challenges[i].challenge );
00181 return;
00182 }
00183 // they are a demo client trying to connect to a real server
00184 NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, "print\nServer is not a demo server\n" );
00185 // clear the challenge record so it won't timeout and let them through
00186 Com_Memset( &svs.challenges[i], 0, sizeof( svs.challenges[i] ) );
00187 return;
00188 }
00189 if ( !Q_stricmp( s, "accept" ) ) {
00190 NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr,
00191 "challengeResponse %i", svs.challenges[i].challenge );
00192 return;
00193 }
00194 if ( !Q_stricmp( s, "unknown" ) ) {
00195 if (!r) {
00196 NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, "print\nAwaiting CD key authorization\n" );
00197 } else {
00198 sprintf(ret, "print\n%s\n", r);
00199 NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, ret );
00200 }
00201 // clear the challenge record so it won't timeout and let them through
00202 Com_Memset( &svs.challenges[i], 0, sizeof( svs.challenges[i] ) );
00203 return;
00204 }
00205
00206 // authorization failed
00207 if (!r) {
00208 NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, "print\nSomeone is using this CD Key\n" );
00209 } else {
00210 sprintf(ret, "print\n%s\n", r);
00211 NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, ret );
00212 }
00213
00214 // clear the challenge record so it won't timeout and let them through
00215 Com_Memset( &svs.challenges[i], 0, sizeof( svs.challenges[i] ) );
00216 }
|
Here is the call graph for this function:

|
|
Definition at line 47 of file sv_bot.c. References cl, client_t, serverStatic_t::clients, i, cvar_s::integer, SV_GentityNum(), sv_maxclients, svs, and serverStatic_t::time. Referenced by SV_GameSystemCalls(). 00047 {
00048 int i;
00049 client_t *cl;
00050
00051 // find a client slot
00052 for ( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ ) {
00053 if ( cl->state == CS_FREE ) {
00054 break;
00055 }
00056 }
00057
00058 if ( i == sv_maxclients->integer ) {
00059 return -1;
00060 }
00061
00062 cl->gentity = SV_GentityNum( i );
00063 cl->gentity->s.number = i;
00064 cl->state = CS_ACTIVE;
00065 cl->lastPacketTime = svs.time;
00066 cl->netchan.remoteAddress.type = NA_BOT;
00067 cl->rate = 16384;
00068
00069 return i;
00070 }
|
Here is the call graph for this function:

|
|
Definition at line 432 of file sv_bot.c. References BOTAI_START_FRAME, gvm, time(), and VM_Call(). Referenced by SV_Frame(), and SV_SpawnServer(). 00432 {
00433 if (!bot_enable) return;
00434 //NOTE: maybe the game is already shutdown
00435 if (!gvm) return;
00436 VM_Call( gvm, BOTAI_START_FRAME, time );
00437 }
|
Here is the call graph for this function:

|
|
Definition at line 77 of file sv_bot.c. References cl, client_t, serverStatic_t::clients, Com_Error(), ERR_DROP, cvar_s::integer, sv_maxclients, and svs. Referenced by SV_DropClient(), and SV_GameSystemCalls(). 00077 {
00078 client_t *cl;
00079
00080 if ( clientNum < 0 || clientNum >= sv_maxclients->integer ) {
00081 Com_Error( ERR_DROP, "SV_BotFreeClient: bad clientNum: %i", clientNum );
00082 }
00083 cl = &svs.clients[clientNum];
00084 cl->state = CS_FREE;
00085 cl->name[0] = 0;
00086 if ( cl->gentity ) {
00087 cl->gentity->r.svFlags &= ~SVF_BOT;
00088 }
00089 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 574 of file sv_bot.c. References cl, client_t, serverStatic_t::clients, MAX_RELIABLE_COMMANDS, Q_strncpyz(), svs, and serverStatic_t::time. Referenced by SV_GameSystemCalls(). 00575 {
00576 client_t *cl;
00577 int index;
00578
00579 cl = &svs.clients[client];
00580 cl->lastPacketTime = svs.time;
00581
00582 if ( cl->reliableAcknowledge == cl->reliableSequence ) {
00583 return qfalse;
00584 }
00585
00586 cl->reliableAcknowledge++;
00587 index = cl->reliableAcknowledge & ( MAX_RELIABLE_COMMANDS - 1 );
00588
00589 if ( !cl->reliableCommands[index][0] ) {
00590 return qfalse;
00591 }
00592
00593 Q_strncpyz( buf, cl->reliableCommands[index], size );
00594 return qtrue;
00595 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 624 of file sv_bot.c. References cl, client_t, serverStatic_t::clients, clientSnapshot_t::first_entity, clientSnapshot_t::num_entities, entityState_s::number, serverStatic_t::numSnapshotEntities, serverStatic_t::snapshotEntities, and svs. Referenced by SV_GameSystemCalls(). 00624 {
00625 client_t *cl;
00626 clientSnapshot_t *frame;
00627
00628 cl = &svs.clients[client];
00629 frame = &cl->frames[cl->netchan.outgoingSequence & PACKET_MASK];
00630 if (sequence < 0 || sequence >= frame->num_entities) {
00631 return -1;
00632 }
00633 return svs.snapshotEntities[(frame->first_entity + sequence) % svs.numSnapshotEntities].number;
00634 }
|
|
|
Definition at line 479 of file sv_bot.c. References CVAR_CHEAT, and Cvar_Get(). Referenced by SV_Init(). 00479 {
00480
00481 Cvar_Get("bot_enable", "1", 0); //enable the bot
00482 Cvar_Get("bot_developer", "0", CVAR_CHEAT); //bot developer mode
00483 Cvar_Get("bot_debug", "0", CVAR_CHEAT); //enable bot debugging
00484 Cvar_Get("bot_maxdebugpolys", "2", 0); //maximum number of debug polys
00485 Cvar_Get("bot_groundonly", "1", 0); //only show ground faces of areas
00486 Cvar_Get("bot_reachability", "0", 0); //show all reachabilities to other areas
00487 Cvar_Get("bot_visualizejumppads", "0", CVAR_CHEAT); //show jumppads
00488 Cvar_Get("bot_forceclustering", "0", 0); //force cluster calculations
00489 Cvar_Get("bot_forcereachability", "0", 0); //force reachability calculations
00490 Cvar_Get("bot_forcewrite", "0", 0); //force writing aas file
00491 Cvar_Get("bot_aasoptimize", "0", 0); //no aas file optimisation
00492 Cvar_Get("bot_saveroutingcache", "0", 0); //save routing cache
00493 Cvar_Get("bot_thinktime", "100", CVAR_CHEAT); //msec the bots thinks
00494 Cvar_Get("bot_reloadcharacters", "0", 0); //reload the bot characters each time
00495 Cvar_Get("bot_testichat", "0", 0); //test ichats
00496 Cvar_Get("bot_testrchat", "0", 0); //test rchats
00497 Cvar_Get("bot_testsolid", "0", CVAR_CHEAT); //test for solid areas
00498 Cvar_Get("bot_testclusters", "0", CVAR_CHEAT); //test the AAS clusters
00499 Cvar_Get("bot_fastchat", "0", 0); //fast chatting bots
00500 Cvar_Get("bot_nochat", "0", 0); //disable chats
00501 Cvar_Get("bot_pause", "0", CVAR_CHEAT); //pause the bots thinking
00502 Cvar_Get("bot_report", "0", CVAR_CHEAT); //get a full report in ctf
00503 Cvar_Get("bot_grapple", "0", 0); //enable grapple
00504 Cvar_Get("bot_rocketjump", "1", 0); //enable rocket jumping
00505 Cvar_Get("bot_challenge", "0", 0); //challenging bot
00506 Cvar_Get("bot_minplayers", "0", 0); //minimum players in a team or the game
00507 Cvar_Get("bot_interbreedchar", "", CVAR_CHEAT); //bot character used for interbreeding
00508 Cvar_Get("bot_interbreedbots", "10", CVAR_CHEAT); //number of bots used for interbreeding
00509 Cvar_Get("bot_interbreedcycle", "20", CVAR_CHEAT); //bot interbreeding cycle
00510 Cvar_Get("bot_interbreedwrite", "", CVAR_CHEAT); //write interbreeded bots to this file
00511 }
|
Here is the call graph for this function:

|
|
Definition at line 444 of file sv_bot.c. References botlib_export, botlib_export_s::BotLibSetup, Com_Printf(), and S_COLOR_RED. Referenced by SV_GameSystemCalls(). 00444 {
00445 if (!bot_enable) {
00446 return 0;
00447 }
00448
00449 if ( !botlib_export ) {
00450 Com_Printf( S_COLOR_RED "Error: SV_BotLibSetup without SV_BotInitBotLib\n" );
00451 return -1;
00452 }
00453
00454 return botlib_export->BotLibSetup();
00455 }
|
Here is the call graph for this function:

|
|
Definition at line 465 of file sv_bot.c. References botlib_export, and botlib_export_s::BotLibShutdown. Referenced by SV_GameSystemCalls(). 00465 {
00466
00467 if ( !botlib_export ) {
00468 return -1;
00469 }
00470
00471 return botlib_export->BotLibShutdown();
00472 }
|
|
|
Definition at line 243 of file sv_init.c. References client_t, serverStatic_t::clients, com_dedicated, Com_Memset(), count, Hunk_AllocateTempMemory(), Hunk_FreeTempMemory(), i, cvar_s::integer, serverStatic_t::numSnapshotEntities, PACKET_BACKUP, client_s::state, SV_BoundMaxClients(), sv_maxclients, svs, Z_Free(), and Z_Malloc(). Referenced by SV_SpawnServer(). 00243 {
00244 int oldMaxClients;
00245 int i;
00246 client_t *oldClients;
00247 int count;
00248
00249 // get the highest client number in use
00250 count = 0;
00251 for ( i = 0 ; i < sv_maxclients->integer ; i++ ) {
00252 if ( svs.clients[i].state >= CS_CONNECTED ) {
00253 if (i > count)
00254 count = i;
00255 }
00256 }
00257 count++;
00258
00259 oldMaxClients = sv_maxclients->integer;
00260 // never go below the highest client number in use
00261 SV_BoundMaxClients( count );
00262 // if still the same
00263 if ( sv_maxclients->integer == oldMaxClients ) {
00264 return;
00265 }
00266
00267 oldClients = Hunk_AllocateTempMemory( count * sizeof(client_t) );
00268 // copy the clients to hunk memory
00269 for ( i = 0 ; i < count ; i++ ) {
00270 if ( svs.clients[i].state >= CS_CONNECTED ) {
00271 oldClients[i] = svs.clients[i];
00272 }
00273 else {
00274 Com_Memset(&oldClients[i], 0, sizeof(client_t));
00275 }
00276 }
00277
00278 // free old clients arrays
00279 Z_Free( svs.clients );
00280
00281 // allocate new clients
00282 svs.clients = Z_Malloc ( sv_maxclients->integer * sizeof(client_t) );
00283 Com_Memset( svs.clients, 0, sv_maxclients->integer * sizeof(client_t) );
00284
00285 // copy the clients over
00286 for ( i = 0 ; i < count ; i++ ) {
00287 if ( oldClients[i].state >= CS_CONNECTED ) {
00288 svs.clients[i] = oldClients[i];
00289 }
00290 }
00291
00292 // free the old clients on the hunk
00293 Hunk_FreeTempMemory( oldClients );
00294
00295 // allocate new snapshot entities
00296 if ( com_dedicated->integer ) {
00297 svs.numSnapshotEntities = sv_maxclients->integer * PACKET_BACKUP * 64;
00298 } else {
00299 // we don't need nearly as many when playing locally
00300 svs.numSnapshotEntities = sv_maxclients->integer * 4 * 64;
00301 }
00302 }
|
Here is the call graph for this function:

|
|
Definition at line 147 of file sv_world.c. References clipHandle_t, CM_InlineModel(), CM_ModelBounds(), Com_Memset(), h(), SV_CreateworldSector(), sv_numworldSectors, sv_worldSectors, and vec3_t. Referenced by SV_SpawnServer(). 00147 {
00148 clipHandle_t h;
00149 vec3_t mins, maxs;
00150
00151 Com_Memset( sv_worldSectors, 0, sizeof(sv_worldSectors) );
00152 sv_numworldSectors = 0;
00153
00154 // get world map bounds
00155 h = CM_InlineModel( 0 );
00156 CM_ModelBounds( h, mins, maxs );
00157 SV_CreateworldSector( 0, mins, maxs );
00158 }
|
Here is the call graph for this function: