about summary refs log tree commit diff
path: root/src/game/server
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-10-07 20:48:15 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-10-07 20:48:15 +0000
commita1e1fb01eaf7aefa9bb5254893c4395c044f6dec (patch)
tree5080e317e11c68b4d58b66cb838faece076ac4c1 /src/game/server
parentff19d4e077983526436ff820988bd0b927aa2c89 (diff)
downloadzcatch-a1e1fb01eaf7aefa9bb5254893c4395c044f6dec.tar.gz
zcatch-a1e1fb01eaf7aefa9bb5254893c4395c044f6dec.zip
server messages fixed
Diffstat (limited to 'src/game/server')
-rw-r--r--src/game/server/game_server.cpp72
1 files changed, 40 insertions, 32 deletions
diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp
index 517b297b..ff5dbd84 100644
--- a/src/game/server/game_server.cpp
+++ b/src/game/server/game_server.cpp
@@ -1320,6 +1320,40 @@ player* intersect_player(vec2 pos0, vec2 pos1, vec2& new_pos, entity* notthis)
 	return 0;
 }
 
+
+void send_chat(int cid, int team, const char *msg)
+{
+	if(cid >= 0 && cid < MAX_CLIENTS)
+		dbg_msg("chat", "%d:%d:%s: %s", cid, team, players[cid].name, msg);
+	else
+		dbg_msg("chat", "*** %s", msg);
+	
+	if(team == -1)
+	{
+		msg_pack_start(MSG_CHAT, MSGFLAG_VITAL);
+		msg_pack_int(cid);
+		msg_pack_int(0);
+		msg_pack_string(msg, 512);
+		msg_pack_end();
+		server_send_msg(-1);
+	}
+	else
+	{
+		msg_pack_start(MSG_CHAT, MSGFLAG_VITAL);
+		msg_pack_int(cid);
+		msg_pack_int(1);
+		msg_pack_string(msg, 512);
+		msg_pack_end();
+				
+		for(int i = 0; i < MAX_CLIENTS; i++)
+		{
+			if(players[i].client_id != -1 && players[i].team == team)
+				server_send_msg(i);
+		}
+	}
+}
+
+
 // Server hooks
 void mods_tick()
 {
@@ -1339,6 +1373,12 @@ void mods_tick()
 			
 		config.restart = 0;
 	}
+	
+	if(config.sv_msg[0] != 0)
+	{
+		send_chat(-1, 0, config.sv_msg);
+		config.sv_msg[0] = 0;
+	}
 }
 
 void mods_snap(int client_id)
@@ -1359,38 +1399,6 @@ void mods_client_input(int client_id, void *input)
 	}
 }
 
-void send_chat(int cid, int team, const char *msg)
-{
-	if(cid >= 0 && cid < MAX_CLIENTS)
-		dbg_msg("chat", "%d:%d:%s: %s", cid, team, players[cid].name, msg);
-	else
-		dbg_msg("chat", "*** %s", msg);
-	
-	if(team == -1)
-	{
-		msg_pack_start(MSG_CHAT, MSGFLAG_VITAL);
-		msg_pack_int(cid);
-		msg_pack_int(0);
-		msg_pack_string(msg, 512);
-		msg_pack_end();
-		server_send_msg(-1);
-	}
-	else
-	{
-		msg_pack_start(MSG_CHAT, MSGFLAG_VITAL);
-		msg_pack_int(cid);
-		msg_pack_int(1);
-		msg_pack_string(msg, 512);
-		msg_pack_end();
-				
-		for(int i = 0; i < MAX_CLIENTS; i++)
-		{
-			if(players[i].client_id != -1 && players[i].team == team)
-				server_send_msg(i);
-		}
-	}
-}
-
 void send_set_name(int cid, const char *old_name, const char *new_name)
 {
 	msg_pack_start(MSG_SETNAME, MSGFLAG_VITAL);