From cfdb383a81bb9bb9349454ec38760774e4150d38 Mon Sep 17 00:00:00 2001 From: skotlex Date: Sat, 3 Jun 2006 15:48:46 +0000 Subject: - Added variable other_mapserver_count to chrif.c which holds total count of connected map-servers. By using this we prevent sending unnecessary packets to the char-server when there's no more map-servers connected. - Affected packets are whispers, announces, party messages, guild messages. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6955 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/intif.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/map/intif.c') diff --git a/src/map/intif.c b/src/map/intif.c index 926d03335..fc7fd6c3d 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -134,6 +134,9 @@ int intif_GMmessage(char* mes,int len,int flag) if (CheckForCharServer()) return 0; + if (other_mapserver_count < 1) + return 0; //No need to send. + WFIFOHEAD(inter_fd,lp + len + 4); WFIFOW(inter_fd,0) = 0x3000; WFIFOW(inter_fd,2) = lp + len + 4; @@ -154,6 +157,10 @@ int intif_announce(char* mes,int len, unsigned long color, int flag) if (CheckForCharServer()) return 0; + + if (other_mapserver_count < 1) + return 0; //No need to send. + WFIFOHEAD(inter_fd, 8 + len); WFIFOW(inter_fd,0) = 0x3000; WFIFOW(inter_fd,2) = 8 + len; @@ -169,6 +176,12 @@ int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int me if (CheckForCharServer()) return 0; + if (other_mapserver_count < 1) + { //Character not found. + clif_wis_end(sd->fd, 1); + return 0; + } + WFIFOHEAD(inter_fd,mes_len + 52); WFIFOW(inter_fd,0) = 0x3001; WFIFOW(inter_fd,2) = mes_len + 52; @@ -467,8 +480,10 @@ int intif_party_message(int party_id,int account_id,char *mes,int len) { if (CheckForCharServer()) return 0; -// if(battle_config.etc_log) -// printf("intif_party_message: %s\n",mes); + + if (other_mapserver_count < 1) + return 0; //No need to send. + WFIFOHEAD(inter_fd,len + 12); WFIFOW(inter_fd,0)=0x3027; WFIFOW(inter_fd,2)=len+12; @@ -608,6 +623,10 @@ int intif_guild_message(int guild_id,int account_id,char *mes,int len) { if (CheckForCharServer()) return 0; + + if (other_mapserver_count < 1) + return 0; //No need to send. + WFIFOHEAD(inter_fd, len + 12); WFIFOW(inter_fd,0)=0x3037; WFIFOW(inter_fd,2)=len+12; -- cgit v1.2.3-70-g09d2