X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=host_cmd.c;h=79665d2e3193205899450516071c7fcfa364229f;hb=c4a838be83912939fc4a88ec96a4bda4611e571c;hp=355ad472a0968a1cea0aef33ccd25b94eb2ca7d3;hpb=56007293d8852e100a98ac3b555e67ba1f5f4224;p=xonotic%2Fdarkplaces.git diff --git a/host_cmd.c b/host_cmd.c index 355ad472..79665d2e 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); } } @@ -356,7 +351,7 @@ void Host_Restart_f (void) allowcheats = sv_cheats.integer != 0; strcpy(mapname, sv.name); SV_SpawnServer(mapname); - if (sv.active && cls.state == ca_disconnected) + if (sv.active && cls.state == ca_disconnected) { SV_VM_Begin(); CL_EstablishConnection("local:1"); @@ -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 ; i 2 && strcmp(Cmd_Argv(1), "#") == 0) @@ -1474,6 +1478,7 @@ void Host_Kick_f (void) } host_client = save; + SV_VM_End(); } /* @@ -1666,14 +1671,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 +1702,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 +1738,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 +1765,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 +1801,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;