]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
removed "%s changed model to %s" message on .playermodel changes (it was unintended)
[xonotic/darkplaces.git] / host_cmd.c
index b349af1e11795ce7e6adffb390260c94107a8781..3399b49d88fd7a52493ab1ddbe11ed480df52b67 100644 (file)
@@ -209,8 +209,7 @@ Host_Ping_f
 */
 void Host_Ping_f (void)
 {
-       int             i, j;
-       float   total;
+       int             i;
        client_t        *client;
 
        if (cmd_source == src_command)
@@ -224,7 +223,7 @@ void Host_Ping_f (void)
        {
                if (!client->active)
                        continue;
-               SV_ClientPrintf("%4i %s\n", (int)(client->ping*1000), client->name);
+               SV_ClientPrintf("%4i %s\n", (int)floor(client->ping*1000+0.5), client->name);
        }
 }
 
@@ -370,6 +369,11 @@ This is sent just before a server changes levels
 */
 void Host_Reconnect_f (void)
 {
+       if (cmd_source == src_command)
+       {
+               Con_Print("reconnect is not valid from the console\n");
+               return;
+       }
        if (Cmd_Argc() != 1)
        {
                Con_Print("reconnect : wait for signon messages again\n");
@@ -431,12 +435,14 @@ void Host_SavegameComment (char *text)
 
        for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
                text[i] = ' ';
-       memcpy (text, cl.levelname, strlen(cl.levelname));
+       // LordHavoc: added min() to prevent overflow
+       memcpy (text, cl.levelname, min(strlen(cl.levelname), SAVEGAME_COMMENT_LENGTH));
        sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
        memcpy (text+22, kills, strlen(kills));
-// convert space to _ to make stdio happy
+       // convert space to _ to make stdio happy
+       // LordHavoc: convert control characters to _ as well
        for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
-               if (text[i] == ' ')
+               if (text[i] <= ' ')
                        text[i] = '_';
        text[SAVEGAME_COMMENT_LENGTH] = '\0';
 }
@@ -812,8 +818,6 @@ void Host_Playermodel_f (void)
                PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PRVM_SetEngineString(host_client->playermodel);
        if (strcmp(host_client->old_model, host_client->playermodel))
        {
-               if (host_client->spawned)
-                       SV_BroadcastPrintf("%s changed model to %s\n", host_client->name, host_client->playermodel);
                strcpy(host_client->old_model, host_client->playermodel);
                /*// send notification to all clients
                MSG_WriteByte (&sv.reliable_datagram, svc_updatepmodel);
@@ -1675,9 +1679,9 @@ void Host_Viewmodel_f (void)
                return;
 
        m = Mod_ForName (Cmd_Argv(1), false, true, false);
-       if (!m)
+       if (!m || !m->loaded || !m->Draw)
        {
-               Con_Printf("Can't load %s\n", Cmd_Argv(1));
+               Con_Printf("viewmodel: can't load %s\n", Cmd_Argv(1));
                return;
        }
 
@@ -1795,7 +1799,7 @@ void Host_Startdemos_f (void)
 {
        int             i, c;
 
-       if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
+       if (cls.state == ca_dedicated || COM_CheckParm("-listen") || COM_CheckParm("-benchmark") || COM_CheckParm("-demo") || COM_CheckParm("-demolooponly"))
                return;
 
        c = Cmd_Argc() - 1;