summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-04-09 22:05:35 +0000
committerTim Angus <tim@ngus.net>2006-04-09 22:05:35 +0000
commit25fcd1f90c39ce5c7eb4dfab0fedb4388ad4289c (patch)
tree9680d9ae32cd6fb4cfcfc175a2c4446d237c969c /src/game
parentcf9b7835e0f7021739bc620ac51c6081036faaee (diff)
* 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
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_public.h6
-rw-r--r--src/game/g_active.c2
-rw-r--r--src/game/g_client.c10
-rw-r--r--src/game/g_cmds.c160
-rw-r--r--src/game/g_combat.c8
-rw-r--r--src/game/g_local.h24
-rw-r--r--src/game/g_main.c57
-rw-r--r--src/game/g_svcmds.c4
-rw-r--r--src/game/g_target.c4
-rw-r--r--src/game/g_team.c4
-rw-r--r--src/game/g_utils.c204
-rw-r--r--src/game/g_weapon.c2
12 files changed, 123 insertions, 362 deletions
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 <mapname>, "
+ trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map <mapname>, "
"kick <player>, clientkick <clientnum>, "
"timelimit <time>\n\"" );
return;
@@ -791,7 +791,7 @@ void Cmd_CallVote_f( gentity_t *ent )
if( !*s )
{
- G_SendCommandFromServer( ent-g_entities, "print \"nextmap not set\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"nextmap not set\n\"" );
return;
}
@@ -804,7 +804,7 @@ void Cmd_CallVote_f( gentity_t *ent )
Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
}
- G_SendCommandFromServer( -1, va( "print \"%s called a vote\n\"", ent->client->pers.netname ) );
+ trap_SendServerCommand( -1, va( "print \"%s called a vote\n\"", ent->client->pers.netname ) );
// start the voting, the caller autoamtically votes yes
level.voteTime = level.time;
@@ -833,23 +833,23 @@ void Cmd_Vote_f( gentity_t *ent )
if( !level.voteTime )
{
- G_SendCommandFromServer( ent-g_entities, "print \"No vote in progress\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"No vote in progress\n\"" );
return;
}
if( ent->client->ps.eFlags & EF_VOTED )
{
- G_SendCommandFromServer( ent-g_entities, "print \"Vote already cast\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Vote already cast\n\"" );
return;
}
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE )
{
- G_SendCommandFromServer( ent-g_entities, "print \"Not allowed to vote as spectator\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator\n\"" );
return;
}
- G_SendCommandFromServer( ent-g_entities, "print \"Vote cast\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Vote cast\n\"" );
ent->client->ps.eFlags |= EF_VOTED;
@@ -892,25 +892,25 @@ void Cmd_CallTeamVote_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.teamVoteTime[ cs_offset ] )
{
- G_SendCommandFromServer( ent-g_entities, "print \"A team vote is already in progress\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"A team vote is already in progress\n\"" );
return;
}
if( ent->client->pers.teamVoteCount >= MAX_VOTE_COUNT )
{
- G_SendCommandFromServer( ent-g_entities, "print \"You have called the maximum number of team votes\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of team 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;
}
@@ -920,7 +920,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
if( strchr( arg1, ';' ) || strchr( arg2, ';' ) )
{
- G_SendCommandFromServer( ent-g_entities, "print \"Invalid team vote string\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Invalid team vote string\n\"" );
return;
}
@@ -948,14 +948,14 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
if( i >= level.maxclients )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"%s is not a valid player on your team\n\"", arg2 ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"%s is not a valid player on your team\n\"", arg2 ) );
return;
}
}
else
{
- G_SendCommandFromServer( ent-g_entities, "print \"Invalid vote string\n\"" );
- G_SendCommandFromServer( ent-g_entities, "print \"Team vote commands are: teamkick <player>\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Team vote commands are: teamkick <player>\n\"" );
return;
}
@@ -968,7 +968,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
continue;
if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team )
- G_SendCommandFromServer( i, va("print \"%s called a team vote\n\"", ent->client->pers.netname ) );
+ trap_SendServerCommand( i, va("print \"%s called a team vote\n\"", ent->client->pers.netname ) );
}
// start the voting, the caller autoamtically votes yes
@@ -1011,23 +1011,23 @@ void Cmd_TeamVote_f( gentity_t *ent )
if( !level.teamVoteTime[ cs_offset ] )
{
- G_SendCommandFromServer( ent-g_entities, "print \"No team vote in progress\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"No team vote in progress\n\"" );
return;
}
if( ent->client->ps.eFlags & EF_TEAMVOTED )
{
- G_SendCommandFromServer( ent-g_entities, "print \"Team vote already cast\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Team vote already cast\n\"" );
return;
}
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE )
{
- G_SendCommandFromServer( ent-g_entities, "print \"Not allowed to vote as spectator\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator\n\"" );
return;
}
- G_SendCommandFromServer( ent-g_entities, "print \"Team vote cast\n\"" );
+ trap_SendServerCommand( ent-g_entities, "print \"Team vote cast\n\"" );
ent->client->ps.eFlags |= EF_TEAMVOTED;
@@ -1062,13 +1062,13 @@ void Cmd_SetViewpos_f( 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;
}
if( trap_Argc( ) != 5 )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"usage: setviewpos x y z yaw\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"usage: setviewpos x y z yaw\n\"" ) );
return;
}
@@ -1170,7 +1170,7 @@ void Cmd_Class_f( gentity_t *ent )
currentClass == PCL_ALIEN_BUILDER0_UPG ) &&
ent->client->ps.stats[ STAT_MISC ] > 0 )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"Cannot evolve until build timer expires\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Cannot evolve until build timer expires\n\"" ) );
return;
}
@@ -1179,7 +1179,7 @@ void Cmd_Class_f( gentity_t *ent )
if( ent->client->pers.classSelection == PCL_NONE )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown class\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Unknown class\n\"" ) );
return;
}
@@ -1237,7 +1237,7 @@ void Cmd_Class_f( gentity_t *ent )
else
{
ent->client->pers.classSelection = PCL_NONE;
- G_SendCommandFromServer( ent-g_entities,
+ trap_SendServerCommand( ent-g_entities,
va( "print \"You cannot evolve from your current class\n\"" ) );
return;
}
@@ -1269,11 +1269,11 @@ void Cmd_Class_f( gentity_t *ent )
}
ent->client->pers.classSelection = PCL_NONE;
- G_SendCommandFromServer( ent-g_entities, va( "print \"You cannot spawn as this class\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You cannot spawn as this class\n\"" ) );
}
else
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown class\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Unknown class\n\"" ) );
return;
}
}
@@ -1283,7 +1283,7 @@ void Cmd_Class_f( gentity_t *ent )
//humans cannot use this command whilst alive
if( ent->client->pers.classSelection != PCL_NONE )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You must be dead to use the class command\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You must be dead to use the class command\n\"" ) );
return;
}
@@ -1301,7 +1301,7 @@ void Cmd_Class_f( gentity_t *ent )
else
{
ent->client->pers.classSelection = PCL_NONE;
- G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown starting item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Unknown starting item\n\"" ) );
return;
}
@@ -1313,7 +1313,7 @@ void Cmd_Class_f( gentity_t *ent )
ent->client->pers.classSelection = PCL_NONE;
ent->client->sess.sessionTeam = TEAM_FREE;
ClientSpawn( ent, NULL, NULL, NULL );
- G_SendCommandFromServer( ent-g_entities, va( "print \"Join a team first\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Join a team first\n\"" ) );
}
}
@@ -1391,7 +1391,7 @@ void Cmd_ActivateItem_f( gentity_t *ent )
else if( weapon != WP_NONE && BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) )
G_ForceWeaponChange( ent, weapon );
else
- G_SendCommandFromServer( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) );
}
@@ -1419,7 +1419,7 @@ void Cmd_DeActivateItem_f( gentity_t *ent )
if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) )
BG_DeactivateUpgrade( upgrade, ent->client->ps.stats );
else
- G_SendCommandFromServer( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) );
}
@@ -1476,7 +1476,7 @@ void Cmd_ToggleItem_f( gentity_t *ent )
BG_ActivateUpgrade( upgrade, ent->client->ps.stats );
}
else
- G_SendCommandFromServer( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) );
}
/*
@@ -1523,7 +1523,7 @@ void Cmd_Buy_f( gentity_t *ent )
if( ( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REACTOR ) &&
!G_BuildableRange( ent->client->ps.origin, 100, BA_H_REPEATER ) ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a reactor or repeater\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a reactor or repeater\n\"" ) );
return;
}
}
@@ -1532,7 +1532,7 @@ void Cmd_Buy_f( gentity_t *ent )
//no armoury nearby
if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) );
return;
}
}
@@ -1563,21 +1563,21 @@ void Cmd_Buy_f( gentity_t *ent )
if( BG_FindTeamForWeapon( weapon ) != WUT_HUMANS )
{
//shouldn't need a fancy dialog
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy alien items\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy alien items\n\"" ) );
return;
}
//are we /allowed/ to buy this?
if( !BG_FindPurchasableForWeapon( weapon ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
//are we /allowed/ to buy this?
if( !BG_FindStagesForWeapon( weapon, g_humanStage.integer ) || !BG_WeaponIsAllowed( weapon ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
@@ -1626,21 +1626,21 @@ void Cmd_Buy_f( gentity_t *ent )
if( BG_FindTeamForUpgrade( upgrade ) != WUT_HUMANS )
{
//shouldn't need a fancy dialog
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy alien items\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy alien items\n\"" ) );
return;
}
//are we /allowed/ to buy this?
if( !BG_FindPurchasableForUpgrade( upgrade ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
//are we /allowed/ to buy this?
if( !BG_FindStagesForUpgrade( upgrade, g_humanStage.integer ) || !BG_UpgradeIsAllowed( upgrade ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
@@ -1660,7 +1660,7 @@ void Cmd_Buy_f( gentity_t *ent )
}
else
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) );
}
if( trap_Argc( ) >= 2 )
@@ -1697,7 +1697,7 @@ void Cmd_Sell_f( gentity_t *ent )
//no armoury nearby
if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) );
return;
}
@@ -1709,7 +1709,7 @@ void Cmd_Sell_f( gentity_t *ent )
//are we /allowed/ to sell this?
if( !BG_FindPurchasableForWeapon( weapon ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't sell this weapon\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't sell this weapon\n\"" ) );
return;
}
@@ -1720,7 +1720,7 @@ void Cmd_Sell_f( gentity_t *ent )
if( ( weapon == WP_HBUILD || weapon == WP_HBUILD2 ) &&
ent->client->ps.stats[ STAT_MISC ] > 0 )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) );
return;
}
@@ -1739,7 +1739,7 @@ void Cmd_Sell_f( gentity_t *ent )
//are we /allowed/ to sell this?
if( !BG_FindPurchasableForUpgrade( upgrade ) )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"You can't sell this item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"You can't sell this item\n\"" ) );
return;
}
//remove upgrade if carried
@@ -1762,7 +1762,7 @@ void Cmd_Sell_f( gentity_t *ent )
if( ( i == WP_HBUILD || i == WP_HBUILD2 ) &&
ent->client->ps.stats[ STAT_MISC ] > 0 )
{
- G_SendCommandFromServer( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) );
continue;
}
@@ -1812,7 +1812,7 @@ void Cmd_Sell_f( gentity_t *ent )
}
}
else
- G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) );
if( trap_Argc( ) >= 2 )
{
@@ -1907,7 +1907,7 @@ void Cmd_Build_f( gentity_t *ent )
}
}
else
- G_SendCommandFromServer( ent-g_entities, va( "print \"Cannot build this item\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va( "print \"Cannot build this item\n\"" ) );
}
@@ -2120,7 +2120,7 @@ void Cmd_PTRCVerify_f( gentity_t *ent )
// valid code
if( connection->clientTeam != PTE_NONE )
- G_SendCommandFromServer( ent->client->ps.clientNum, "ptrcconfirm" );
+ trap_SendServerCommand( ent->client->ps.clientNum, "ptrcconfirm" );
// restore mapping
ent->client->pers.connection = connection;
@@ -2132,7 +2132,7 @@ void Cmd_PTRCVerify_f( gentity_t *ent )
if( connection )
{
- G_SendCommandFromServer( ent->client->ps.clientNum,
+ trap_SendServerCommand( ent->client->ps.clientNum,
va( "ptrcissue %d", connection->ptrCode ) );
}
}
@@ -2162,7 +2162,7 @@ void Cmd_PTRCRestore_f( gentity_t *ent )
{
if( ent->client->pers.joinedATeam )
{
- G_SendCommandFromServer( ent - g_entities,
+ trap_SendServerCommand( ent - g_entities,
"print \"You cannot use a PTR code after joining a team\n\"" );
}
else
@@ -2183,7 +2183,7 @@ void Cmd_PTRCRestore_f( gentity_t *ent )
}
else
{
- G_SendCommandFromServer( ent - g_entities,
+ trap_SendServerCommand( ent - g_entities,
va( "print \"\"%d\" is not a valid PTR code\n\"", code ) );
}
}
@@ -2201,7 +2201,7 @@ void Cmd_Test_f( gentity_t *ent )
/* ent->client->ps.stats[ STAT_STATE ] |= SS_POISONCLOUDED;
ent->client->lastPoisonCloudedTime = level.time;
ent->client->lastPoisonCloudedClient = ent;
- G_SendCommandFromServer( ent->client->ps.clientNum, "poisoncloud" );*/
+ trap_SendServerCommand( ent->client->ps.clientNum, "poisoncloud" );*/
/* ent->client->ps.stats[ STAT_STATE ] |= SS_POISONED;
ent->client->lastPoisonTime = level.time;
@@ -2314,5 +2314,5 @@ void ClientCommand( int clientNum )
else if( Q_stricmp( cmd, "test" ) == 0 )
Cmd_Test_f( ent );
else
- G_SendCommandFromServer( clientNum, va( "print \"unknown cmd %s\n\"", cmd ) );
+ trap_SendServerCommand( clientNum, va( "print \"unknown cmd %s\n\"", cmd ) );
}
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 7e38f119..6d8e5c1c 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -1022,6 +1022,14 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
return;
}
+ // If target is buildable on the same team as the attacking client
+ if( targ->s.eType == ET_BUILDABLE && attacker->client &&
+ targ->biteam == attacker->client->pers.teamSelection )
+ {
+ if( !g_friendlyBuildableFire.integer )
+ return;
+ }
+
// check for godmode
if ( targ->flags & FL_GODMODE )
return;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 82f294b0..874afeee 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -717,30 +717,7 @@ void AddRemap(const char *oldShader, const char *newShader, float timeOff
const char *BuildShaderStateConfig( void );
-#define MAX_QUEUE_COMMANDS 64 //should be MAX_RELIABLE_COMMANDS/server.h
-
-typedef struct commandQueueElement_s
-{
- qboolean used;
- struct commandQueueElement_s *next;
- char command[ MAX_TOKEN_CHARS ];
-} commandQueueElement_t;
-
-typedef struct commandQueue_s
-{
- int nextCommandTime; //next time that the queue can be popped
-
- int numElements;
- commandQueueElement_t *front;
- commandQueueElement_t *back;
-
- commandQueueElement_t pool[ MAX_QUEUE_COMMANDS ];
-} commandQueue_t;
-
qboolean G_ClientIsLagging( gclient_t *client );
-void G_ProcessCommandQueues( void );
-void G_SendCommandFromServer( int clientNum, const char *cmd );
-void G_InitCommandQueue( int clientNum );
void G_TriggerMenu( int clientNum, dynMenu_t menu );
void G_CloseMenus( int clientNum );
@@ -1034,6 +1011,7 @@ extern vmCvar_t g_minCommandPeriod;
extern vmCvar_t g_timelimit;
extern vmCvar_t g_suddenDeathTime;
extern vmCvar_t g_friendlyFire;
+extern vmCvar_t g_friendlyBuildableFire;
extern vmCvar_t g_password;
extern vmCvar_t g_needpass;
extern vmCvar_t g_gravity;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 06241b80..b07afc75 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -44,6 +44,7 @@ vmCvar_t g_timelimit;
vmCvar_t g_suddenDeathTime;
vmCvar_t g_capturelimit;
vmCvar_t g_friendlyFire;
+vmCvar_t g_friendlyBuildableFire;
vmCvar_t g_password;
vmCvar_t g_needpass;
vmCvar_t g_maxclients;
@@ -129,6 +130,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_synchronousClients, "g_synchronousClients", "0", CVAR_SYSTEMINFO, 0, qfalse },
{ &g_friendlyFire, "g_friendlyFire", "0", CVAR_ARCHIVE, 0, qtrue },
+ { &g_friendlyBuildableFire, "g_friendlyBuildableFire", "0", CVAR_ARCHIVE, 0, qtrue },
{ &g_teamAutoJoin, "g_teamAutoJoin", "0", CVAR_ARCHIVE },
{ &g_teamForceBalance, "g_teamForceBalance", "0", CVAR_ARCHIVE },
@@ -413,7 +415,7 @@ void G_UpdateCvars( void )
cv->modificationCount = cv->vmCvar->modificationCount;
if( cv->trackChange )
- G_SendCommandFromServer( -1, va( "print \"Server: %s changed to %s\n\"",
+ trap_SendServerCommand( -1, va( "print \"Server: %s changed to %s\n\"",
cv->cvarName, cv->vmCvar->string ) );
if( cv->teamShader )
@@ -971,12 +973,10 @@ void G_CalculateBuildPoints( void )
level.alienBuildPoints = 0;
}
- trap_SetConfigstring( CS_BUILDPOINTS,
- va( "%d %d %d %d %d", level.alienBuildPoints,
- localATP,
- level.humanBuildPoints,
- localHTP,
- level.humanBuildPointsPowered ) );
+ trap_SetConfigstring( CS_BUILDPOINTS, va( "%d %d %d %d %d",
+ level.alienBuildPoints, localATP,
+ level.humanBuildPoints, localHTP,
+ level.humanBuildPointsPowered ) );
//may as well pump the stages here too
{
@@ -1211,26 +1211,6 @@ void CalculateRanks( void )
score = newScore;
}
- // set the CS_SCORES1/2 configstrings, which will be visible to everyone
- if( level.numConnectedClients == 0 )
- {
- trap_SetConfigstring( CS_SCORES1, va( "%i", SCORE_NOT_PRESENT ) );
- trap_SetConfigstring( CS_SCORES2, va( "%i", SCORE_NOT_PRESENT ) );
- }
- else if( level.numConnectedClients == 1 )
- {
- trap_SetConfigstring( CS_SCORES1, va( "%i",
- level.clients[ level.sortedClients[ 0 ] ].ps.persistant[ PERS_SCORE ] ) );
- trap_SetConfigstring( CS_SCORES2, va( "%i", SCORE_NOT_PRESENT ) );
- }
- else
- {
- trap_SetConfigstring( CS_SCORES1, va( "%i",
- level.clients[ level.sortedClients[ 0 ] ].ps.persistant[ PERS_SCORE ] ) );
- trap_SetConfigstring( CS_SCORES2, va( "%i",
- level.clients[ level.sortedClients[ 1 ] ].ps.persistant[ PERS_SCORE ] ) );
- }
-
// see if it is time to end the level
CheckExitRules( );
@@ -1737,7 +1717,7 @@ void CheckExitRules( void )
if( level.time - level.startTime >= g_timelimit.integer * 60000 )
{
level.lastWin = PTE_NONE;
- G_SendCommandFromServer( -1, "print \"Timelimit hit\n\"" );
+ trap_SendServerCommand( -1, "print \"Timelimit hit\n\"" );
LogExit( "Timelimit hit." );
return;
}
@@ -1750,7 +1730,7 @@ void CheckExitRules( void )
{
//humans win
level.lastWin = PTE_HUMANS;
- G_SendCommandFromServer( -1, "print \"Humans win\n\"");
+ trap_SendServerCommand( -1, "print \"Humans win\n\"");
LogExit( "Humans win." );
}
else if( level.uncondAlienWin ||
@@ -1760,7 +1740,7 @@ void CheckExitRules( void )
{
//aliens win
level.lastWin = PTE_ALIENS;
- G_SendCommandFromServer( -1, "print \"Aliens win\n\"");
+ trap_SendServerCommand( -1, "print \"Aliens win\n\"");
LogExit( "Aliens win." );
}
}
@@ -1805,13 +1785,13 @@ void CheckVote( void )
if( level.voteYes > level.voteNo )
{
// execute the command, then remove the vote
- G_SendCommandFromServer( -1, "print \"Vote passed\n\"" );
+ trap_SendServerCommand( -1, "print \"Vote passed\n\"" );
level.voteExecuteTime = level.time + 3000;
}
else
{
// same behavior as a timeout
- G_SendCommandFromServer( -1, "print \"Vote failed\n\"" );
+ trap_SendServerCommand( -1, "print \"Vote failed\n\"" );
}
}
else
@@ -1819,13 +1799,13 @@ void CheckVote( void )
if( level.voteYes > level.numConnectedClients / 2 )
{
// execute the command, then remove the vote
- G_SendCommandFromServer( -1, "print \"Vote passed\n\"" );
+ trap_SendServerCommand( -1, "print \"Vote passed\n\"" );
level.voteExecuteTime = level.time + 3000;
}
else if( level.voteNo >= level.numConnectedClients / 2 )
{
// same behavior as a timeout
- G_SendCommandFromServer( -1, "print \"Vote failed\n\"" );
+ trap_SendServerCommand( -1, "print \"Vote failed\n\"" );
}
else
{
@@ -1860,21 +1840,21 @@ void CheckTeamVote( int team )
if( level.time - level.teamVoteTime[ cs_offset ] >= VOTE_TIME )
{
- G_SendCommandFromServer( -1, "print \"Team vote failed\n\"" );
+ trap_SendServerCommand( -1, "print \"Team vote failed\n\"" );
}
else
{
if( level.teamVoteYes[ cs_offset ] > level.numteamVotingClients[ cs_offset ] / 2 )
{
// execute the command, then remove the vote
- G_SendCommandFromServer( -1, "print \"Team vote passed\n\"" );
+ trap_SendServerCommand( -1, "print \"Team vote passed\n\"" );
//
trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) );
}
else if( level.teamVoteNo[ cs_offset ] >= level.numteamVotingClients[ cs_offset ] / 2 )
{
// same behavior as a timeout
- G_SendCommandFromServer( -1, "print \"Team vote failed\n\"" );
+ trap_SendServerCommand( -1, "print \"Team vote failed\n\"" );
}
else
{
@@ -2090,9 +2070,6 @@ void G_RunFrame( int levelTime )
G_CalculateAvgPlayers( );
G_UpdateZaps( msec );
- //send any pending commands
- G_ProcessCommandQueues( );
-
// see if it is time to end the level
CheckExitRules( );
diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c
index 367953d8..ca093c8e 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -574,12 +574,12 @@ qboolean ConsoleCommand( void )
{
if( Q_stricmp( cmd, "say" ) == 0 )
{
- G_SendCommandFromServer( -1, va( "print \"server: %s\n\"", ConcatArgs( 1 ) ) );
+ trap_SendServerCommand( -1, va( "print \"server: %s\n\"", ConcatArgs( 1 ) ) );
return qtrue;
}
// everything else will also be printed as a say command
- G_SendCommandFromServer( -1, va( "print \"server: %s\n\"", ConcatArgs( 0 ) ) );
+ trap_SendServerCommand( -1, va( "print \"server: %s\n\"", ConcatArgs( 0 ) ) );
return qtrue;
}
diff --git a/src/game/g_target.c b/src/game/g_target.c
index 60a090b6..1a32ce77 100644
--- a/src/game/g_target.c
+++ b/src/game/g_target.c
@@ -85,7 +85,7 @@ void Use_Target_Print( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
if( activator->client && ( ent->spawnflags & 4 ) )
{
- G_SendCommandFromServer( activator-g_entities, va( "cp \"%s\"", ent->message ) );
+ trap_SendServerCommand( activator-g_entities, va( "cp \"%s\"", ent->message ) );
return;
}
@@ -99,7 +99,7 @@ void Use_Target_Print( gentity_t *ent, gentity_t *other, gentity_t *activator )
return;
}
- G_SendCommandFromServer( -1, va("cp \"%s\"", ent->message ) );
+ trap_SendServerCommand( -1, va("cp \"%s\"", ent->message ) );
}
void SP_target_print( gentity_t *ent )
diff --git a/src/game/g_team.c b/src/game/g_team.c
index 2f65d816..881ed35a 100644
--- a/src/game/g_team.c
+++ b/src/game/g_team.c
@@ -41,7 +41,7 @@ void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... )
while( ( p = strchr( msg, '"' ) ) != NULL )
*p = '\'';
- G_SendCommandFromServer( ( ( ent == NULL ) ? -1 : ent-g_entities ), va( "print \"%s\"", msg ) );
+ trap_SendServerCommand( ( ( ent == NULL ) ? -1 : ent-g_entities ), va( "print \"%s\"", msg ) );
}
@@ -211,7 +211,7 @@ void TeamplayInfoMessage( gentity_t *ent )
}
}
- G_SendCommandFromServer( ent - g_entities, va( "tinfo %i %s", cnt, string ) );
+ trap_SendServerCommand( ent - g_entities, va( "tinfo %i %s", cnt, string ) );
}
void CheckTeamStatus( void )
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index 78c50a1a..9caaba76 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -163,7 +163,7 @@ void G_TeamCommand( pTeam_t team, char *cmd )
if( level.clients[ i ].pers.connected == CON_CONNECTED )
{
if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team )
- G_SendCommandFromServer( i, va( "%s", cmd ) );
+ trap_SendServerCommand( i, va( "%s", cmd ) );
}
}
}
@@ -709,204 +709,6 @@ qboolean G_ClientIsLagging( gclient_t *client )
return qfalse; //is a non-existant client lagging? woooo zen
}
-
-static commandQueue_t queuedCommands[ MAX_CLIENTS ];
-
-/*
-===============
-G_PopCommandQueue
-
-Return the front of a command queue
-Must use immediately or copy to a buffer
-===============
-*/
-static const char *G_PopCommandQueue( commandQueue_t *cq )
-{
- if( cq->front )
- {
- commandQueueElement_t *cqe = cq->front;
-
- cq->front = cqe->next;
-
- // last element in the queue
- if( cq->front == NULL )
- cq->back = NULL;
-
- cq->nextCommandTime = level.time + g_minCommandPeriod.integer;
- cqe->used = qfalse;
-
- return cqe->command;
- }
- else
- return NULL;
-}
-
-/*
-===============
-G_PushCommandQueue
-
-Put a command on a command queue
-===============
-*/
-static void G_PushCommandQueue( commandQueue_t *cq, const char *cmd )
-{
- int i;
-
- for( i = 0; i < MAX_QUEUE_COMMANDS; i++ )
- {
- commandQueueElement_t *cqe = &cq->pool[ i ];
-
- if( !cqe->used )
- {
- cqe->used = qtrue;
- cqe->next = NULL;
- Q_strncpyz( cqe->command, cmd, MAX_TOKEN_CHARS );
-
- if( cq->back )
- {
- cq->back->next = cqe;
- cq->back = cqe;
- }
- else
- {
- cq->front = cqe;
- cq->back = cqe;
- }
-
- return;
- }
- }
-
- //drop the command
-}
-
-/*
-===============
-G_PrintCommandQueue
-===============
-*/
-#if 0 //quiet compiler
-static void G_PrintCommandQueue( commandQueue_t *cq )
-{
- commandQueueElement_t *cqe;
-
- if( cq->front )
- {
- cqe = cq->front;
-
- do
- {
- G_Printf( "->\"%s\"", cqe->command );
- } while( ( cqe = cqe->next ) );
-
- G_Printf( "\n" );
- }
-}
-#endif
-
-/*
-===============
-G_ReadyToDequeue
-===============
-*/
-static qboolean G_ReadyToDequeue( commandQueue_t *cq )
-{
- if( !cq )
- return qfalse;
-
- return cq->front && cq->nextCommandTime <= level.time;
-}
-
-/*
-===============
-G_ProcessCommandQueues
-
-Check for any outstanding commands to be sent
-===============
-*/
-void G_ProcessCommandQueues( void )
-{
- int i;
-
- for( i = 0; i < MAX_CLIENTS; i++ )
- {
- gclient_t *cl = &level.clients[ i ];
- commandQueue_t *cq = &queuedCommands[ i ];
-
- if( !G_ClientIsLagging( cl ) && G_ReadyToDequeue( cq ) )
- {
- const char *command = G_PopCommandQueue( cq );
-
- if( command )
- trap_SendServerCommand( i, command );
- }
- }
-}
-
-/*
-===============
-G_InitCommandQueue
-===============
-*/
-void G_InitCommandQueue( int clientNum )
-{
- int i;
- commandQueue_t *cq = &queuedCommands[ clientNum ];
-
- if( clientNum >= 0 && clientNum < MAX_CLIENTS )
- {
- cq->front = cq->back = NULL;
- cq->nextCommandTime = 0;
-
- for( i = 0; i < MAX_QUEUE_COMMANDS; i++ )
- {
- commandQueueElement_t *cqe = &cq->pool[ i ];
-
- cqe->used = qfalse;
- }
- }
-}
-
-/*
-===============
-G_SendCommandFromServer
-
-Sends a command to a client
-===============
-*/
-void G_SendCommandFromServer( int clientNum, const char *cmd )
-{
- commandQueue_t *cq = &queuedCommands[ clientNum ];
-
- if( clientNum < 0 )
- cq = NULL;
-
- if( strlen( cmd ) > 1022 )
- {
- G_LogPrintf( "G_SendCommandFromServer( %d, ... ) length exceeds 1022.\n", clientNum );
- G_LogPrintf( "cmd [%s]\n", cmd );
- return;
- }
-
- if( cq )
- {
- gclient_t *cl = &level.clients[ clientNum ];
-
- if( cq->nextCommandTime > level.time || G_ClientIsLagging( cl ) )
- {
- //can't send yet, so queue the command up
- G_PushCommandQueue( cq, cmd );
- }
- else
- {
- cq->nextCommandTime = level.time + g_minCommandPeriod.integer;
- trap_SendServerCommand( clientNum, cmd );
- }
- }
- else //no queue exists for this client
- trap_SendServerCommand( clientNum, cmd );
-}
-
//==============================================================================
@@ -1017,7 +819,7 @@ void G_TriggerMenu( int clientNum, dynMenu_t menu )
char buffer[ 32 ];
Com_sprintf( buffer, 32, "servermenu %d", menu );
- G_SendCommandFromServer( clientNum, buffer );
+ trap_SendServerCommand( clientNum, buffer );
}
@@ -1033,7 +835,7 @@ void G_CloseMenus( int clientNum )
char buffer[ 32 ];
Com_sprintf( buffer, 32, "serverclosemenus" );
- G_SendCommandFromServer( clientNum, buffer );
+ trap_SendServerCommand( clientNum, buffer );
}
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 11cc4f6a..ed7dea10 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -951,7 +951,7 @@ void poisonCloud( gentity_t *ent )
humanPlayer->client->ps.stats[ STAT_STATE ] |= SS_POISONCLOUDED;
humanPlayer->client->lastPoisonCloudedTime = level.time;
humanPlayer->client->lastPoisonCloudedClient = ent;
- G_SendCommandFromServer( humanPlayer->client->ps.clientNum, "poisoncloud" );
+ trap_SendServerCommand( humanPlayer->client->ps.clientNum, "poisoncloud" );
}
}
}