]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
ping command now works from server console
[xonotic/darkplaces.git] / host_cmd.c
index b98566f6cea337b98932e0a31f6f2563147f3eff..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);
        }
 }
 
@@ -460,7 +467,7 @@ Host_Savegame_f
 */
 void Host_Savegame_f (void)
 {
-       char    name[256];
+       char    name[MAX_QPATH];
        qfile_t *f;
        int             i;
        char    comment[SAVEGAME_COMMENT_LENGTH+1];
@@ -586,7 +593,7 @@ void Host_Loadgame_f (void)
 
        cls.demonum = -1;               // stop demo loop in case this fails
 
-       t = text = (char *)FS_LoadFile (filename, tempmempool, false);
+       t = text = (char *)FS_LoadFile (filename, tempmempool, false, NULL);
        if (!text)
        {
                Con_Print("ERROR: couldn't open.\n");
@@ -680,7 +687,7 @@ void Host_Loadgame_f (void)
                        if (entnum >= MAX_EDICTS)
                        {
                                Mem_Free(text);
-                               Host_Error("Host_PerformLoadGame: too many edicts in save file (reached MAX_EDICTS %i)\n", MAX_EDICTS);
+                               Host_Error("Host_PerformLoadGame: too many edicts in save file (reached MAX_EDICTS %i)", MAX_EDICTS);
                        }
                        while (entnum >= prog->max_edicts)
                                //SV_IncreaseEdicts();
@@ -903,8 +910,8 @@ void Host_Say(qboolean teamonly)
        int j, quoted;
        const char *p1;
        char *p2;
-       // LordHavoc: 256 char say messages
-       char text[256];
+       // LordHavoc: long say messages
+       char text[1024];
        qboolean fromServer = false;
 
        if (cmd_source == src_command)
@@ -978,7 +985,7 @@ void Host_Tell_f(void)
        client_t *save;
        int j;
        const char *p1, *p2;
-       char text[1024]; // LordHavoc: FIXME: temporary buffer overflow fix (was 64)
+       char text[MAX_INPUTLINE]; // LordHavoc: FIXME: temporary buffer overflow fix (was 64)
        qboolean fromServer = false;
 
        if (cmd_source == src_command)
@@ -1303,9 +1310,6 @@ void Host_Spawn_f (void)
        }
        else
        {
-               // set up the edict
-               PRVM_ED_ClearEdict(host_client->edict);
-
                //Con_Printf("Host_Spawn_f: host_client->edict->netname = %s, host_client->edict->netname = %s, host_client->name = %s\n", PRVM_GetString(host_client->edict->fields.server->netname), PRVM_GetString(host_client->edict->fields.server->netname), host_client->name);
 
                // copy spawn parms out of the client_t
@@ -1347,9 +1351,12 @@ void Host_Spawn_f (void)
        // send all current light styles
        for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
        {
-               MSG_WriteByte (&host_client->message, svc_lightstyle);
-               MSG_WriteByte (&host_client->message, (char)i);
-               MSG_WriteString (&host_client->message, sv.lightstyles[i]);
+               if (sv.lightstyles[i][0])
+               {
+                       MSG_WriteByte (&host_client->message, svc_lightstyle);
+                       MSG_WriteByte (&host_client->message, (char)i);
+                       MSG_WriteString (&host_client->message, sv.lightstyles[i]);
+               }
        }
 
        // send some stats