about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2009-01-11 14:28:35 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2009-01-11 14:28:35 +0000
commit96e65f599a437dd15059f6ed533883c702917551 (patch)
tree3a8f646873aebcc9d7b462a178ec937cfd21db83 /src
parent172463b2bb49608d6b347ffbd67c0bd55ca8a692 (diff)
downloadzcatch-96e65f599a437dd15059f6ed533883c702917551.tar.gz
zcatch-96e65f599a437dd15059f6ed533883c702917551.zip
fixed so that some vote error messages isn't broadcasted to everyone
Diffstat (limited to 'src')
-rw-r--r--src/game/server/gamecontext.cpp12
-rw-r--r--src/game/server/gamecontext.hpp1
-rw-r--r--src/game/server/hooks.cpp10
3 files changed, 18 insertions, 5 deletions
diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp
index 89eae10d..087dd469 100644
--- a/src/game/server/gamecontext.cpp
+++ b/src/game/server/gamecontext.cpp
@@ -158,6 +158,18 @@ void GAMECONTEXT::create_sound_global(int sound, int target)
 	server_send_msg(target);
 }
 
+
+void GAMECONTEXT::send_chat_target(int to, const char *text)
+{
+	NETMSG_SV_CHAT msg;
+	msg.team = 0;
+	msg.cid = -1;
+	msg.message = text;
+	msg.pack(MSGFLAG_VITAL);
+	server_send_msg(to);
+}
+
+
 void GAMECONTEXT::send_chat(int chatter_cid, int team, const char *text)
 {
 	if(chatter_cid >= 0 && chatter_cid < MAX_CLIENTS)
diff --git a/src/game/server/gamecontext.hpp b/src/game/server/gamecontext.hpp
index 90559d26..e98593aa 100644
--- a/src/game/server/gamecontext.hpp
+++ b/src/game/server/gamecontext.hpp
@@ -78,6 +78,7 @@ public:
 	};
 
 	// network
+	void send_chat_target(int to, const char *text);
 	void send_chat(int cid, int team, const char *text);
 	void send_emoticon(int cid, int emoticon);
 	void send_weapon_pickup(int cid, int weapon);
diff --git a/src/game/server/hooks.cpp b/src/game/server/hooks.cpp
index be68e8d9..194fa6e1 100644
--- a/src/game/server/hooks.cpp
+++ b/src/game/server/hooks.cpp
@@ -177,7 +177,7 @@ void mods_message(int msgtype, int client_id)
 		int64 now = time_get();
 		if(game.vote_closetime)
 		{
-			game.send_chat(-1, client_id, "Wait for current vote to end before calling a new one.");
+			game.send_chat_target(client_id, "Wait for current vote to end before calling a new one.");
 			return;
 		}
 		
@@ -186,7 +186,7 @@ void mods_message(int msgtype, int client_id)
 		{
 			char chatmsg[512] = {0};
 			str_format(chatmsg, sizeof(chatmsg), "You must wait %d seconds before making another vote", (timeleft/time_freq())+1);
-			game.send_chat(-1, client_id, chatmsg);
+			game.send_chat_target(client_id, chatmsg);
 			return;
 		}
 		
@@ -213,7 +213,7 @@ void mods_message(int msgtype, int client_id)
 			if(!option)
 			{
 				str_format(chatmsg, sizeof(chatmsg), "'%s' isn't an option on this server", msg->value);
-				game.send_chat(-1, client_id, chatmsg);
+				game.send_chat_target(client_id, chatmsg);
 				return;
 			}
 		}
@@ -221,14 +221,14 @@ void mods_message(int msgtype, int client_id)
 		{
 			if(!config.sv_vote_kick)
 			{
-				game.send_chat(-1, client_id, "Server does not allow voting to kick players");
+				game.send_chat_target(client_id, "Server does not allow voting to kick players");
 				return;
 			}
 			
 			int kick_id = atoi(msg->value);
 			if(kick_id < 0 || kick_id >= MAX_CLIENTS || !game.players[kick_id])
 			{
-				game.send_chat(-1, client_id, "Invalid client id to kick");
+				game.send_chat_target(client_id, "Invalid client id to kick");
 				return;
 			}