From 792dfbb243bcbeee644bd096b7bd925a1e5c1e74 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 11 Jul 2006 20:16:55 +0000 Subject: - Fixed clif_parse not checking for func_parse before sending data to the connected clients. This in turn required various code-rewrites in: - duel related messaging functions (added clif targets DUEL/DUEL_WOS). - intif whisper to gm function - day/night timers - Rewrote the parse_console function to stop allocating/deallocating memory on every call. - Modified chrif_charselectreq to receive the player's ip among the data. - Added function clif_disp_message, which is the same as clif_disp_onlyself, except you can specify the targets (it sends a guild-chat packet) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7617 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/intif.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/map/intif.c') diff --git a/src/map/intif.c b/src/map/intif.c index 1acdf9360..35fe41d99 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -831,10 +831,22 @@ int intif_parse_WisEnd(int fd) { return 0; } +static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va) { + int min_gm_level = va_arg(va, int); + char *wisp_name; + char *message; + int len; + if (pc_isGM(sd) < min_gm_level) return 0; + clif_wis_message(sd->fd, wisp_name, message, len); + wisp_name = va_arg(va, char*); + message = va_arg(va, char*); + len = va_arg(va, int); + return 1; +} + // Received wisp message from map-server via char-server for ALL gm int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 .w .24B .w .?B - int i, min_gm_level, mes_len; - struct map_session_data *pl_sd; + int min_gm_level, mes_len; char Wisp_name[NAME_LENGTH]; char mbuf[255]; char *message; @@ -849,14 +861,10 @@ int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 .w .24B memcpy(message, RFIFOP(fd,30), mes_len); message[mes_len-1] = '\0'; // information is sended to all online GM - for (i = 0; i < fd_max; i++) - if (session[i] && (pl_sd = (struct map_session_data *) session[i]->session_data) && pl_sd->state.auth) - if (pc_isGM(pl_sd) >= min_gm_level) - clif_wis_message(i, Wisp_name, message, strlen(message) + 1); + clif_foreachclient(mapif_parse_WisToGM_sub, min_gm_level, Wisp_name, message, mes_len); if (message != mbuf) aFree(message); - return 0; } -- cgit v1.2.3-60-g2f50