X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=host_cmd.c;h=7a533d9b2d2893f36670b870d96fdffab238da75;hp=01fcc7d2a4b7d8ad7414a923aa04851d8fa27d5f;hb=9176bd39d627c6c595248482662f50acee8d3942;hpb=1ec7067055fa339ec2053f314fd82d285303e4db diff --git a/host_cmd.c b/host_cmd.c index 01fcc7d2..7a533d9b 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -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,11 +223,7 @@ void Host_Ping_f (void) { if (!client->active) continue; - total = 0; - for (j=0 ; jping_times[j]; - total /= NUM_PING_TIMES; - SV_ClientPrintf("%4i %s\n", (int)(total*1000), client->name); + SV_ClientPrintf("%4i %s\n", (int)floor(client->ping*1000+0.5), client->name); } } @@ -374,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"); @@ -435,12 +435,14 @@ void Host_SavegameComment (char *text) for (i=0 ; iedict, 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); @@ -931,9 +931,9 @@ void Host_Say(qboolean teamonly) p1++; } if (!fromServer) - dpsnprintf (text, sizeof(text), "%c%s: %s", 1, host_client->name, p1); + dpsnprintf (text, sizeof(text), "%c%s" STRING_COLOR_DEFAULT_STR ": %s", 1, host_client->name, p1); else - dpsnprintf (text, sizeof(text), "%c<%s> %s", 1, hostname.string, p1); + dpsnprintf (text, sizeof(text), "%c<%s" STRING_COLOR_DEFAULT_STR "> %s", 1, hostname.string, p1); p2 = text + strlen(text); while ((const char *)p2 > (const char *)text && (p2[-1] == '\r' || p2[-1] == '\n' || (p2[-1] == '\"' && quoted))) { @@ -951,7 +951,8 @@ void Host_Say(qboolean teamonly) SV_ClientPrint(text); host_client = save; - Con_Print(&text[1]); + if (cls.state == ca_dedicated) + Con_Print(&text[1]); } @@ -1416,6 +1417,7 @@ void Host_Kick_f (void) if (cmd_source != src_command || !sv.active) return; + SV_VM_Begin(); save = host_client; if (Cmd_Argc() > 2 && strcmp(Cmd_Argv(1), "#") == 0) @@ -1474,6 +1476,7 @@ void Host_Kick_f (void) } host_client = save; + SV_VM_End(); } /* @@ -1666,14 +1669,19 @@ void Host_Viewmodel_f (void) prvm_edict_t *e; model_t *m; + if (!sv.active) + return; + + SV_VM_Begin(); e = FindViewthing (); + SV_VM_End(); if (!e) 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; } @@ -1692,7 +1700,12 @@ void Host_Viewframe_f (void) int f; model_t *m; + if (!sv.active) + return; + + SV_VM_Begin(); e = FindViewthing (); + SV_VM_End(); if (!e) return; m = cl.model_precache[(int)e->fields.server->modelindex]; @@ -1723,7 +1736,12 @@ void Host_Viewnext_f (void) prvm_edict_t *e; model_t *m; + if (!sv.active) + return; + + SV_VM_Begin(); e = FindViewthing (); + SV_VM_End(); if (!e) return; m = cl.model_precache[(int)e->fields.server->modelindex]; @@ -1745,7 +1763,12 @@ void Host_Viewprev_f (void) prvm_edict_t *e; model_t *m; + if (!sv.active) + return; + + SV_VM_Begin(); e = FindViewthing (); + SV_VM_End(); if (!e) return; @@ -1776,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;