int current_skill;
cvar_t sv_cheats = {0, "sv_cheats", "0", "enables cheat commands in any game, and cheat impulses in dpmod"};
cvar_t sv_adminnick = {CVAR_SAVE, "sv_adminnick", "", "nick name to use for admin messages instead of host name"};
+cvar_t sv_status_privacy = {CVAR_SAVE, "sv_status_privacy", "0", "do not show IP addresses in 'status' replies to clients"};
cvar_t rcon_password = {CVAR_PRIVATE, "rcon_password", "", "password to authenticate rcon commands"};
cvar_t rcon_address = {0, "rcon_address", "", "server address to send rcon commands to (when not connected to a server)"};
cvar_t team = {CVAR_USERINFO | CVAR_SAVE, "team", "none", "QW team (4 character limit, example: blue)"};
else
hours = 0;
print ("#%-3u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, client->frags, hours, minutes, seconds);
- print (" %s\n", client->netconnection ? client->netconnection->address : "botclient");
+ if(sv_status_privacy.integer && cmd_source != src_command)
+ print (" %s\n", client->netconnection ? "hidden" : "botclient");
+ else
+ print (" %s\n", client->netconnection ? client->netconnection->address : "botclient");
}
}
#define SAVEGAME_VERSION 5
+void Host_Savegame_to (const char *name)
+{
+ qfile_t *f;
+ int i;
+ char comment[SAVEGAME_COMMENT_LENGTH+1];
+ qboolean isserver;
+
+ isserver = !strcmp(PRVM_NAME, "server");
+
+ Con_Printf("Saving game to %s...\n", name);
+ f = FS_OpenRealFile(name, "wb", false);
+ if (!f)
+ {
+ Con_Print("ERROR: couldn't open.\n");
+ return;
+ }
+
+ FS_Printf(f, "%i\n", SAVEGAME_VERSION);
+
+ memset(comment, 0, sizeof(comment));
+ if(isserver)
+ dpsnprintf(comment, sizeof(comment), "%-21.21s kills:%3i/%3i", PRVM_GetString(prog->edicts->fields.server->message), (int)prog->globals.server->killed_monsters, (int)prog->globals.server->total_monsters);
+ else
+ dpsnprintf(comment, sizeof(comment), "(crash dump of %s progs)", PRVM_NAME);
+ // convert space to _ to make stdio happy
+ // LordHavoc: convert control characters to _ as well
+ for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
+ if (comment[i] <= ' ')
+ comment[i] = '_';
+ comment[SAVEGAME_COMMENT_LENGTH] = '\0';
+
+ FS_Printf(f, "%s\n", comment);
+ if(isserver)
+ {
+ for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
+ FS_Printf(f, "%f\n", svs.clients[0].spawn_parms[i]);
+ FS_Printf(f, "%d\n", current_skill);
+ FS_Printf(f, "%s\n", sv.name);
+ FS_Printf(f, "%f\n",sv.time);
+ }
+ else
+ {
+ for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
+ FS_Printf(f, "(dummy)\n");
+ FS_Printf(f, "%d\n", 0);
+ FS_Printf(f, "%s\n", "(dummy)");
+ FS_Printf(f, "%f\n", realtime);
+ }
+
+ // write the light styles
+ for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
+ {
+ if (isserver && sv.lightstyles[i][0])
+ FS_Printf(f, "%s\n", sv.lightstyles[i]);
+ else
+ FS_Print(f,"m\n");
+ }
+
+ PRVM_ED_WriteGlobals (f);
+ for (i=0 ; i<prog->num_edicts ; i++)
+ {
+ //Con_Printf("edict %d...\n", i);
+ PRVM_ED_Write (f, PRVM_EDICT_NUM(i));
+ }
+
+ FS_Close (f);
+ Con_Print("done.\n");
+}
+
/*
===============
Host_Savegame_f
void Host_Savegame_f (void)
{
char name[MAX_QPATH];
- qfile_t *f;
- int i;
- char comment[SAVEGAME_COMMENT_LENGTH+1];
if (!sv.active)
{
strlcpy (name, Cmd_Argv(1), sizeof (name));
FS_DefaultExtension (name, ".sav", sizeof (name));
- Con_Printf("Saving game to %s...\n", name);
- f = FS_Open (name, "wb", false, false);
- if (!f)
- {
- Con_Print("ERROR: couldn't open.\n");
- return;
- }
-
SV_VM_Begin();
-
- FS_Printf(f, "%i\n", SAVEGAME_VERSION);
-
- memset(comment, 0, sizeof(comment));
- sprintf(comment, "%-21.21s kills:%3i/%3i", PRVM_GetString(prog->edicts->fields.server->message), (int)prog->globals.server->killed_monsters, (int)prog->globals.server->total_monsters);
- // convert space to _ to make stdio happy
- // LordHavoc: convert control characters to _ as well
- for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
- if (comment[i] <= ' ')
- comment[i] = '_';
- comment[SAVEGAME_COMMENT_LENGTH] = '\0';
-
- FS_Printf(f, "%s\n", comment);
- for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
- FS_Printf(f, "%f\n", svs.clients[0].spawn_parms[i]);
- FS_Printf(f, "%d\n", current_skill);
- FS_Printf(f, "%s\n", sv.name);
- FS_Printf(f, "%f\n",sv.time);
-
- // write the light styles
- for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
- {
- if (sv.lightstyles[i][0])
- FS_Printf(f, "%s\n", sv.lightstyles[i]);
- else
- FS_Print(f,"m\n");
- }
-
- PRVM_ED_WriteGlobals (f);
- for (i=0 ; i<prog->num_edicts ; i++)
- PRVM_ED_Write (f, PRVM_EDICT_NUM(i));
-
+ Host_Savegame_to(name);
SV_VM_End();
-
- FS_Close (f);
- Con_Print("done.\n");
}
host_client->name[j++] = host_client->name[i];
host_client->name[j] = 0;
+ if(host_client->name[0] == 1 || host_client->name[0] == 2)
+ // may interfere with chat area, and will needlessly beep; so let's add a ^7
+ {
+ memmove(host_client->name + 2, host_client->name, sizeof(host_client->name) - 2);
+ host_client->name[sizeof(host_client->name) - 1] = 0;
+ host_client->name[0] = STRING_COLOR_TAG;
+ host_client->name[1] = '0' + STRING_COLOR_DEFAULT;
+ }
+
COM_StringLengthNoColors(host_client->name, 0, &valid_colors);
if(!valid_colors) // NOTE: this also proves the string is not empty, as "" is a valid colored string
{
// note this uses the chat prefix \001
if (!fromServer)
- sprintf (text, "\001%s tells you: ", host_client->name);
+ dpsnprintf (text, sizeof(text), "\001%s tells you: ", host_client->name);
else if(*(sv_adminnick.string))
- sprintf (text, "\001<%s tells you> ", sv_adminnick.string);
+ dpsnprintf (text, sizeof(text), "\001<%s tells you> ", sv_adminnick.string);
else
- sprintf (text, "\001<%s tells you> ", hostname.string);
+ dpsnprintf (text, sizeof(text), "\001<%s tells you> ", hostname.string);
p1 = Cmd_Args();
p2 = p1 + strlen(p1);
Cvar_RegisterVariable(&sv_cheats);
Cvar_RegisterVariable(&sv_adminnick);
+ Cvar_RegisterVariable(&sv_status_privacy);
}
void Host_NoOperation_f(void)