]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added sendcvar patch from [515]
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Jan 2006 14:41:42 +0000 (14:41 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Jan 2006 14:41:42 +0000 (14:41 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5896 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c

index be312bf8880529ca51392b623cdcf35c8c4838e1..e0fbfe0646c3346bc8775f540a232d584cdff084 100644 (file)
@@ -1872,6 +1872,35 @@ void Host_Stopdemo_f (void)
        Host_ShutdownServer (false);
 }
 
+void Host_SendCvar_f (void)
+{
+       int             i;
+       cvar_t  *c;
+       client_t *old;
+
+       if(Cmd_Argc() != 2)
+               return;
+       if(!(c = Cvar_FindVar(Cmd_Argv(1))))
+               return;
+       if (cls.state != ca_dedicated)
+               Cmd_ForwardStringToServer(va("sentcvar %s %s\n", c->name, c->string));
+       if(!sv.active)// || !SV_ParseClientCommandQC)
+               return;
+
+       old = host_client;
+       if (cls.state != ca_dedicated)
+               i = 1;
+       else
+               i = 0;
+       for(;i<svs.maxclients;i++)
+               if(svs.clients[i].active && svs.clients[i].netconnection)
+               {
+                       host_client = &svs.clients[i];
+                       Host_ClientCommands(va("sendcvar %s\n", c->name));
+               }
+       host_client = old;
+}
+
 static void MaxPlayers_f(void)
 {
        int n;
@@ -1977,6 +2006,8 @@ void Host_InitCommands (void)
        Cmd_AddCommand ("begin", Host_Begin_f);
        Cmd_AddCommand ("maxplayers", MaxPlayers_f);
 
+       Cmd_AddCommand ("sendcvar", Host_SendCvar_f);                                   // By [515]
+
        Cvar_RegisterVariable(&sv_cheats);
 }