]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
ping command now works from server console
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Nov 2005 06:14:05 +0000 (06:14 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Nov 2005 06:14:05 +0000 (06:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5832 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c

index 265c8d8780be0a316e925eb01bea1c75f5f4a983..be312bf8880529ca51392b623cdcf35c8c4838e1 100644 (file)
@@ -209,21 +209,28 @@ Host_Ping_f
 */
 void Host_Ping_f (void)
 {
-       int             i;
-       client_t        *client;
+       int i;
+       client_t *client;
+       void (*print) (const char *fmt, ...);
 
        if (cmd_source == src_command)
        {
-               Cmd_ForwardToServer ();
-               return;
+               if (!sv.active)
+               {
+                       Cmd_ForwardToServer ();
+                       return;
+               }
+               print = Con_Printf;
        }
+       else
+               print = SV_ClientPrintf;
 
-       SV_ClientPrint("Client ping times:\n");
+       print("Client ping times:\n");
        for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
        {
                if (!client->active)
                        continue;
-               SV_ClientPrintf("%4i %s\n", (int)floor(client->ping*1000+0.5), client->name);
+               print("%4i %s\n", (int)floor(client->ping*1000+0.5), client->name);
        }
 }