From 9d7ee224d2874902bd1963deca47c1e7ee288fa7 Mon Sep 17 00:00:00 2001 From: Jay Dolan Date: Sun, 15 Jan 2006 16:55:08 +0000 Subject: [PATCH] Fixed info command to print to client, not dedicated console. --- src/sv_init.c | 2 +- src/sv_main.c | 1 - src/sv_send.c | 16 ++++++++-------- src/sv_user.c | 20 +++++++++++++++++--- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/sv_init.c b/src/sv_init.c index d214fdb..2c60cdd 100644 --- a/src/sv_init.c +++ b/src/sv_init.c @@ -295,7 +295,7 @@ void SV_InitGame(void){ // dedicated servers are can't be single player and are usually DM // so unless they explicity set coop, force it to deathmatch if(dedicated->value){ - if(!Cvar_VariableValue("coop")) + if(!coop->value) Cvar_FullSet("deathmatch", "1", CVAR_SERVERINFO | CVAR_LATCH); } diff --git a/src/sv_main.c b/src/sv_main.c index 004ca7f..0e601e7 100644 --- a/src/sv_main.c +++ b/src/sv_main.c @@ -871,7 +871,6 @@ void SV_UserinfoChanged(client_t *cl){ if(strlen(val)){ cl->messagelevel = atoi(val); } - } diff --git a/src/sv_send.c b/src/sv_send.c index 6e5f6bb..fa642a7 100644 --- a/src/sv_send.c +++ b/src/sv_send.c @@ -60,7 +60,7 @@ Sends text across to be displayed if the level passes */ void SV_ClientPrintf(client_t *cl, int level, char *fmt, ...){ va_list argptr; - char string[1024]; + char string[MAX_STRING_CHARS]; if(level < cl->messagelevel) return; @@ -83,7 +83,7 @@ Sends text to all active clients */ void SV_BroadcastPrintf(int level, char *fmt, ...){ va_list argptr; - char string[2048]; + char string[MAX_STRING_CHARS]; client_t *cl; int i; @@ -93,13 +93,13 @@ void SV_BroadcastPrintf(int level, char *fmt, ...){ // echo to console if(dedicated->value){ - char copy[1024]; - int i; + char copy[MAX_STRING_CHARS]; + int j; // mask off high bits - for(i = 0; i < 1023 && string[i]; i++) - copy[i] = string[i] & 127; - copy[i] = 0; + for(j = 0; j < MAX_STRING_CHARS - 1 && string[j]; j++) + copy[j] = string[j] & 127; + copy[j] = 0; Com_Printf("%s", copy); } @@ -123,7 +123,7 @@ Sends text to all active clients */ void SV_BroadcastCommand(char *fmt, ...){ va_list argptr; - char string[1024]; + char string[MAX_STRING_CHARS]; if(!sv.state) return; diff --git a/src/sv_user.c b/src/sv_user.c index e050982..72d23e2 100644 --- a/src/sv_user.c +++ b/src/sv_user.c @@ -358,7 +358,6 @@ The client is going to disconnect, so remove the connection immediately ================= */ void SV_Disconnect_f(void){ - // SV_EndRedirect(); SV_DropClient(sv_client); } @@ -371,7 +370,22 @@ Dumps the serverinfo info string ================== */ void SV_ShowServerinfo_f(void){ - Info_Print(Cvar_Serverinfo()); + cvar_t *cvar; + char line[MAX_STRING_CHARS]; + + if(!sv_client){ //print to server console + Info_Print(Cvar_Serverinfo()); + return; + } + + for(cvar = cvar_vars; cvar; cvar = cvar->next){ + + if(!(cvar->flags & CVAR_SERVERINFO)) + continue; //only print serverinfo cvars + + snprintf(line, MAX_STRING_CHARS, "%s %s\n", cvar->name, cvar->string); + SV_ClientPrintf(sv_client, PRINT_MEDIUM, line); + } } @@ -379,7 +393,7 @@ void SV_Nextserver(void){ char *v; //ZOID, ss_pic can be nextserver'd in coop mode - if(sv.state == ss_game ||(sv.state == ss_pic && !Cvar_VariableValue("coop"))) + if(sv.state == ss_game ||(sv.state == ss_pic && !coop->value)) return; // can't nextserver while playing a normal game svs.spawncount++; // make sure another doesn't sneak in