From 25fcd1f90c39ce5c7eb4dfab0fedb4388ad4289c Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 9 Apr 2006 22:05:35 +0000 Subject: * Removed CS_SCORE? config strings -- they were unused * Moved server command queuing from game to server -- sv_dequeuePeriod probably needs to be lowered * Added g_friendlyBuildableFire to enable friendly buildable fire --- src/cgame/cg_servercmds.c | 7 -- src/game/bg_public.h | 6 +- src/game/g_active.c | 2 +- src/game/g_client.c | 10 +-- src/game/g_cmds.c | 160 ++++++++++++++++----------------- src/game/g_combat.c | 8 ++ src/game/g_local.h | 24 +---- src/game/g_main.c | 57 ++++-------- src/game/g_svcmds.c | 4 +- src/game/g_target.c | 4 +- src/game/g_team.c | 4 +- src/game/g_utils.c | 204 +----------------------------------------- src/game/g_weapon.c | 2 +- src/server/server.h | 21 +++++ src/server/sv_client.c | 1 + src/server/sv_init.c | 1 + src/server/sv_main.c | 219 +++++++++++++++++++++++++++++++++++++++++++++- 17 files changed, 363 insertions(+), 371 deletions(-) diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 7b7a7b74..b0fcc89b 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -152,9 +152,6 @@ Called on load to set the initial values from configure strings */ void CG_SetConfigValues( void ) { - cgs.scores1 = atoi( CG_ConfigString( CS_SCORES1 ) ); - cgs.scores2 = atoi( CG_ConfigString( CS_SCORES2 ) ); - sscanf( CG_ConfigString( CS_BUILDPOINTS ), "%d %d %d %d %d", &cgs.alienBuildPoints, &cgs.alienBuildPointsTotal, @@ -276,10 +273,6 @@ static void CG_ConfigStringModified( void ) CG_ParseServerinfo( ); else if( num == CS_WARMUP ) CG_ParseWarmup( ); - else if( num == CS_SCORES1 ) - cgs.scores1 = atoi( str ); - else if( num == CS_SCORES2 ) - cgs.scores2 = atoi( str ); else if( num == CS_BUILDPOINTS ) sscanf( str, "%d %d %d %d %d", &cgs.alienBuildPoints, &cgs.alienBuildPointsTotal, diff --git a/src/game/bg_public.h b/src/game/bg_public.h index b7e1411e..2b723421 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -32,8 +32,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define DEFAULT_GRAVITY 800 -#define SCORE_NOT_PRESENT -9999 // for the CS_SCORES[12] when only one player is present - #define VOTE_TIME 30000 // 30 seconds before vote times out #define MINS_Z -24 @@ -51,8 +49,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define CS_MESSAGE 3 // from the map worldspawn's message field #define CS_MOTD 4 // g_motd string for server message of the day #define CS_WARMUP 5 // server time when the match will be restarted -#define CS_SCORES1 6 -#define CS_SCORES2 7 +// 6 UNUSED +// 7 UNUSED #define CS_VOTE_TIME 8 #define CS_VOTE_STRING 9 #define CS_VOTE_YES 10 diff --git a/src/game/g_active.c b/src/game/g_active.c index 9c8f8a1c..d78d4b98 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -447,7 +447,7 @@ qboolean ClientInactivityTimer( gclient_t *client ) if( level.time > client->inactivityTime - 10000 && !client->inactivityWarning ) { client->inactivityWarning = qtrue; - G_SendCommandFromServer( client - level.clients, "cp \"Ten seconds until inactivity drop!\n\"" ); + trap_SendServerCommand( client - level.clients, "cp \"Ten seconds until inactivity drop!\n\"" ); } } diff --git a/src/game/g_client.c b/src/game/g_client.c index 4fb7d37e..f0b33e03 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -995,7 +995,7 @@ void ClientUserinfoChanged( int clientNum ) { if( strcmp( oldname, client->pers.netname ) ) { - G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " renamed to %s\n\"", oldname, + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " renamed to %s\n\"", oldname, client->pers.netname ) ); } } @@ -1164,7 +1164,7 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) // don't do the "xxx connected" messages if they were caried over from previous level if( firstTime ) - G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " connected\n\"", client->pers.netname ) ); + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " connected\n\"", client->pers.netname ) ); // count current clients and rank for scoreboard CalculateRanks( ); @@ -1216,12 +1216,10 @@ void ClientBegin( int clientNum ) ClientSpawn( ent, NULL, NULL, NULL ); - G_InitCommandQueue( clientNum ); - - G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) ); + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) ); // request the clients PTR code - G_SendCommandFromServer( ent - g_entities, "ptrcrequest" ); + trap_SendServerCommand( ent - g_entities, "ptrcrequest" ); G_LogPrintf( "ClientBegin: %i\n", clientNum ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index f5e78069..ecb6ad39 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -74,7 +74,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s ) if( idnum < 0 || idnum >= level.maxclients ) { - G_SendCommandFromServer( to - g_entities, va( "print \"Bad client slot: %i\n\"", idnum ) ); + trap_SendServerCommand( to - g_entities, va( "print \"Bad client slot: %i\n\"", idnum ) ); return -1; } @@ -82,7 +82,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s ) if( cl->pers.connected != CON_CONNECTED ) { - G_SendCommandFromServer( to - g_entities, va( "print \"Client %i is not active\n\"", idnum ) ); + trap_SendServerCommand( to - g_entities, va( "print \"Client %i is not active\n\"", idnum ) ); return -1; } @@ -103,7 +103,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s ) return idnum; } - G_SendCommandFromServer( to - g_entities, va( "print \"User %s is not on the server\n\"", s ) ); + trap_SendServerCommand( to - g_entities, va( "print \"User %s is not on the server\n\"", s ) ); return -1; } @@ -177,7 +177,7 @@ void ScoreboardMessage( gentity_t *ent ) stringlength += j; } - G_SendCommandFromServer( ent-g_entities, va( "scores %i %i %i%s", i, + trap_SendServerCommand( ent-g_entities, va( "scores %i %i %i%s", i, level.alienKills, level.humanKills, string ) ); } @@ -205,13 +205,13 @@ qboolean CheatsOk( gentity_t *ent ) { if( !g_cheats.integer ) { - G_SendCommandFromServer( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) ); return qfalse; } if( ent->health <= 0 ) { - G_SendCommandFromServer( ent-g_entities, va( "print \"You must be alive to use this command\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"You must be alive to use this command\n\"" ) ); return qfalse; } @@ -325,7 +325,7 @@ void Cmd_God_f( gentity_t *ent ) else msg = "godmode ON\n"; - G_SendCommandFromServer( ent - g_entities, va( "print \"%s\"", msg ) ); + trap_SendServerCommand( ent - g_entities, va( "print \"%s\"", msg ) ); } @@ -352,7 +352,7 @@ void Cmd_Notarget_f( gentity_t *ent ) else msg = "notarget ON\n"; - G_SendCommandFromServer( ent - g_entities, va( "print \"%s\"", msg ) ); + trap_SendServerCommand( ent - g_entities, va( "print \"%s\"", msg ) ); } @@ -377,7 +377,7 @@ void Cmd_Noclip_f( gentity_t *ent ) ent->client->noclip = !ent->client->noclip; - G_SendCommandFromServer( ent - g_entities, va( "print \"%s\"", msg ) ); + trap_SendServerCommand( ent - g_entities, va( "print \"%s\"", msg ) ); } @@ -397,7 +397,7 @@ void Cmd_LevelShot_f( gentity_t *ent ) return; BeginIntermission( ); - G_SendCommandFromServer( ent - g_entities, "clientLevelShot" ); + trap_SendServerCommand( ent - g_entities, "clientLevelShot" ); } /* @@ -418,7 +418,7 @@ void Cmd_Kill_f( gentity_t *ent ) if( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) { - G_SendCommandFromServer( ent-g_entities, "print \"Leave the hovel first (use your destroy key)\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Leave the hovel first (use your destroy key)\n\"" ); return; } @@ -435,12 +435,12 @@ void Cmd_Kill_f( gentity_t *ent ) { if( ent->suicideTime == 0 ) { - G_SendCommandFromServer( ent-g_entities, "print \"You will suicide in 20 seconds\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"You will suicide in 20 seconds\n\"" ); ent->suicideTime = level.time + 20000; } else if( ent->suicideTime > level.time ) { - G_SendCommandFromServer( ent-g_entities, "print \"Suicide cancelled\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Suicide cancelled\n\"" ); ent->suicideTime = 0; } } @@ -492,7 +492,7 @@ void Cmd_Team_f( gentity_t *ent ) if( !strlen( s ) ) { - G_SendCommandFromServer( ent-g_entities, va("print \"team: %i\n\"", ent->client->pers.teamSelection ) ); + trap_SendServerCommand( ent-g_entities, va("print \"team: %i\n\"", ent->client->pers.teamSelection ) ); return; } @@ -529,16 +529,16 @@ void Cmd_Team_f( gentity_t *ent ) } else { - G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown team: %s\n\"", s ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"Unknown team: %s\n\"", s ) ); return; } G_ChangeTeam( ent, team ); if( team == PTE_ALIENS ) - G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", ent->client->pers.netname ) ); + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", ent->client->pers.netname ) ); else if( team == PTE_HUMANS ) - G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans\n\"", ent->client->pers.netname ) ); + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans\n\"", ent->client->pers.netname ) ); } @@ -564,7 +564,7 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons if( mode == SAY_TEAM && !OnSameTeam( ent, other ) ) return; - G_SendCommandFromServer( other-g_entities, va( "%s \"%s%c%c%s\"", + trap_SendServerCommand( other-g_entities, va( "%s \"%s%c%c%s\"", mode == SAY_TEAM ? "tchat" : "chat", name, Q_COLOR_ESCAPE, color, message ) ); } @@ -698,7 +698,7 @@ Cmd_Where_f */ void Cmd_Where_f( gentity_t *ent ) { - G_SendCommandFromServer( ent-g_entities, va( "print \"%s\n\"", vtos( ent->s.origin ) ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"%s\n\"", vtos( ent->s.origin ) ) ); } /* @@ -714,25 +714,25 @@ void Cmd_CallVote_f( gentity_t *ent ) if( !g_allowVote.integer ) { - G_SendCommandFromServer( ent-g_entities, "print \"Voting not allowed here\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here\n\"" ); return; } if( level.voteTime ) { - G_SendCommandFromServer( ent-g_entities, "print \"A vote is already in progress\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"A vote is already in progress\n\"" ); return; } if( ent->client->pers.voteCount >= MAX_VOTE_COUNT ) { - G_SendCommandFromServer( ent-g_entities, "print \"You have called the maximum number of votes\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of votes\n\"" ); return; } if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE ) { - G_SendCommandFromServer( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" ); return; } @@ -742,7 +742,7 @@ void Cmd_CallVote_f( gentity_t *ent ) if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) { - G_SendCommandFromServer( ent-g_entities, "print \"Invalid vote string\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); return; } @@ -754,8 +754,8 @@ void Cmd_CallVote_f( gentity_t *ent ) else if( !Q_stricmp( arg1, "timelimit" ) ) { } else { - G_SendCommandFromServer( ent-g_entities, "print \"Invalid vote string\n\"" ); - G_SendCommandFromServer( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map , " + trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map , " "kick , clientkick , " "timelimit