X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=host_cmd.c;h=7014c01eb7d6f98f1296181671c141009ca94996;hb=ebfcb03c31ffdcec0f091af0f66a66c9d30fb689;hp=ab073c684bc4af6881f186769ec9b5aed2d030f7;hpb=f5b7fe803746486111c16946c49798346810e0c8;p=xonotic%2Fdarkplaces.git diff --git a/host_cmd.c b/host_cmd.c index ab073c68..7014c01e 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -72,7 +72,7 @@ void Host_Status_f (void) client_t *client; int seconds = 0, minutes = 0, hours = 0, i, j, k, in, players, ping = 0, packetloss = 0; void (*print) (const char *fmt, ...); - char ip[22]; + char ip[48]; // can contain a full length v6 address with [] and a port int frags; if (cmd_source == src_command) @@ -174,16 +174,26 @@ void Host_Status_f (void) if (in == 0) // default layout { - print ("#%-3u %-16.16s %3i %2i:%02i:%02i\n", i+1, client->name, frags, hours, minutes, seconds); - print (" %s\n", ip); + if (sv.protocol == PROTOCOL_QUAKE && svs.maxclients <= 99) + { + // LordHavoc: this is very touchy because we must maintain ProQuake compatible status output + print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", i+1, client->name, frags, hours, minutes, seconds); + print (" %s\n", ip); + } + else + { + // LordHavoc: no real restrictions here, not a ProQuake-compatible protocol anyway... + print ("#%-3u %-16.16s %4i %2i:%02i:%02i\n", i+1, client->name, frags, hours, minutes, seconds); + print (" %s\n", ip); + } } else if (in == 1) // extended layout { - print ("%s%-21s %2i %4i %2i:%02i:%02i %4i #%-3u ^7%s\n", k%2 ? "^3" : "^7", ip, packetloss, ping, hours, minutes, seconds, frags, i+1, client->name); + print ("%s%-47s %2i %4i %2i:%02i:%02i %4i #%-3u ^7%s\n", k%2 ? "^3" : "^7", ip, packetloss, ping, hours, minutes, seconds, frags, i+1, client->name); } else if (in == 2) // reduced layout { - print ("%s%-21s #%-3u ^7%s\n", k%2 ? "^3" : "^7", ip, i+1, client->name); + print ("%s%-47s #%-3u ^7%s\n", k%2 ? "^3" : "^7", ip, i+1, client->name); } } @@ -368,6 +378,8 @@ void Host_Map_f (void) } // remove menu + if (key_dest == key_menu || key_dest == key_menu_grabbed) + MR_ToggleMenu(0); key_dest = key_game; svs.serverflags = 0; // haven't completed an episode yet @@ -375,7 +387,7 @@ void Host_Map_f (void) strlcpy(level, Cmd_Argv(1), sizeof(level)); SV_SpawnServer(level); if (sv.active && cls.state == ca_disconnected) - CL_EstablishConnection("local:1"); + CL_EstablishConnection("local:1", -2); } /* @@ -401,6 +413,8 @@ void Host_Changelevel_f (void) } // remove menu + if (key_dest == key_menu || key_dest == key_menu_grabbed) + MR_ToggleMenu(0); key_dest = key_game; SV_VM_Begin(); @@ -410,7 +424,7 @@ void Host_Changelevel_f (void) strlcpy(level, Cmd_Argv(1), sizeof(level)); SV_SpawnServer(level); if (sv.active && cls.state == ca_disconnected) - CL_EstablishConnection("local:1"); + CL_EstablishConnection("local:1", -2); } /* @@ -436,13 +450,15 @@ void Host_Restart_f (void) } // remove menu + if (key_dest == key_menu || key_dest == key_menu_grabbed) + MR_ToggleMenu(0); key_dest = key_game; allowcheats = sv_cheats.integer != 0; strlcpy(mapname, sv.name, sizeof(mapname)); SV_SpawnServer(mapname); if (sv.active && cls.state == ca_disconnected) - CL_EstablishConnection("local:1"); + CL_EstablishConnection("local:1", -2); } /* @@ -463,7 +479,7 @@ void Host_Reconnect_f (void) // will still contain its IP address, so get the address... InfoString_GetValue(cls.userinfo, "*ip", temp, sizeof(temp)); if (temp[0]) - CL_EstablishConnection(temp); + CL_EstablishConnection(temp, -1); else Con_Printf("Reconnect to what server? (you have not connected to a server yet)\n"); return; @@ -510,15 +526,15 @@ User command to connect to server */ void Host_Connect_f (void) { - if (Cmd_Argc() != 2) + if (Cmd_Argc() < 2) { - Con_Print("connect : connect to a multiplayer game\n"); + Con_Print("connect [ ...]: connect to a multiplayer game\n"); return; } // clear the rcon password, to prevent vulnerability by stuffcmd-ing a connect command if(rcon_secure.integer <= 0) Cvar_SetQuick(&rcon_password, ""); - CL_EstablishConnection(Cmd_Argv(1)); + CL_EstablishConnection(Cmd_Argv(1), 2); } @@ -768,6 +784,8 @@ void Host_Loadgame_f (void) CL_Disconnect (); // remove menu + if (key_dest == key_menu || key_dest == key_menu_grabbed) + MR_ToggleMenu(0); key_dest = key_game; cls.demonum = -1; // stop demo loop in case this fails @@ -910,6 +928,9 @@ void Host_Loadgame_f (void) // parse the global vars PRVM_ED_ParseGlobals (start); + + // restore the autocvar globals + Cvar_UpdateAllAutoCvars(); } else { @@ -985,7 +1006,7 @@ void Host_Loadgame_f (void) if (i >= 0 && i < MAX_MODELS) { strlcpy(sv.model_precache[i], com_token, sizeof(sv.model_precache[i])); - sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, sv.model_precache[i][0] == '*' ? sv.modelname : NULL); + sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, sv.model_precache[i][0] == '*' ? sv.worldname : NULL); } else Con_Printf("unsupported model %i \"%s\"\n", i, com_token); @@ -1055,7 +1076,7 @@ void Host_Loadgame_f (void) // make sure we're connected to loopback if (sv.active && cls.state == ca_disconnected) - CL_EstablishConnection("local:1"); + CL_EstablishConnection("local:1", -2); } //============================================================================ @@ -1192,7 +1213,7 @@ void Host_Name_f (void) Host_Playermodel_f ====================== */ -cvar_t cl_playermodel = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playermodel", "", "internal storage cvar for current player model in Nexuiz (changed by playermodel command)"}; +cvar_t cl_playermodel = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playermodel", "", "internal storage cvar for current player model in Nexuiz/Xonotic (changed by playermodel command)"}; // the old cl_playermodel in cl_main has been renamed to __cl_playermodel void Host_Playermodel_f (void) { @@ -1250,7 +1271,7 @@ void Host_Playermodel_f (void) Host_Playerskin_f ====================== */ -cvar_t cl_playerskin = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playerskin", "", "internal storage cvar for current player skin in Nexuiz (changed by playerskin command)"}; +cvar_t cl_playerskin = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playerskin", "", "internal storage cvar for current player skin in Nexuiz/Xonotic (changed by playerskin command)"}; void Host_Playerskin_f (void) { int i, j; @@ -1920,7 +1941,7 @@ Kicks a user off of the server */ void Host_Kick_f (void) { - char *who; + const char *who; const char *message = NULL; client_t *save; int i; @@ -2474,7 +2495,8 @@ void Host_PQRcon_f (void) SZ_Clear(&net_message); MSG_WriteLong (&net_message, 0); MSG_WriteByte (&net_message, CCREQ_RCON); - SZ_Write(&net_message, (void*)rcon_password.string, n); + SZ_Write(&net_message, (const unsigned char*)rcon_password.string, n); + MSG_WriteByte (&net_message, 0); // terminate the (possibly partial) string MSG_WriteString (&net_message, Cmd_Args()); StoreBigLong(net_message.data, NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); NetConn_Write(mysocket, net_message.data, net_message.cursize, &to);