summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2015-04-04 16:21:40 +0200
committerPaweł Redman <pawel.redman@gmail.com>2015-04-04 16:21:40 +0200
commitdab8c5f5c46a2f32f1d6e63641bae816850f0cc6 (patch)
tree37ae6c84b58c9b2a4c448580f414b0f74b822ca7
parente71cf2b9d657c112eb3674969a3185957f816d04 (diff)
parent8c6ad4c73c816dbe412e6fac0ad1c0d2837492cc (diff)
Merge branch 'damage-feedback'
-rw-r--r--src/game/g_active.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 2eede6b..7148af0 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -2213,6 +2213,39 @@ void ClientThink_real( gentity_t *ent )
/*
==================
+G_SendPublicServerCommand
+
+Send a server command to a player and everyone following them.
+==================
+*/
+void G_SendPublicServerCommand( int clientNum, const char *cmd )
+{
+ int i;
+ gclient_t *client;
+
+ for( i = 0; i < level.maxclients ; i++ )
+ {
+ client = level.clients + i;
+
+ if( client->pers.connected != CON_CONNECTED )
+ continue;
+
+ if( client->ps.clientNum == clientNum )
+ goto send;
+
+ if( client->sess.spectatorState == SPECTATOR_NOT )
+ continue;
+
+ if( client->sess.spectatorClient != clientNum )
+ continue;
+
+ send:
+ trap_SendServerCommand( client->ps.clientNum, cmd );
+ }
+}
+
+/*
+==================
ClientThink
A new command has arrived from the client
@@ -2261,7 +2294,7 @@ void G_RunClient( gentity_t *ent )
if( p - buffer + len + 1 > sizeof( buffer ) )
{
- trap_SendServerCommand( ent - g_entities, buffer );
+ G_SendPublicServerCommand( ent - g_entities, buffer );
strcpy( buffer, "dblob" );
p = buffer + 5;
}
@@ -2271,7 +2304,7 @@ void G_RunClient( gentity_t *ent )
}
if( p > buffer + 6 )
- trap_SendServerCommand( ent - g_entities, buffer );
+ G_SendPublicServerCommand( ent - g_entities, buffer );
ent->client->bufferedBlobCount = 0;
}