diff options
author | shennetsind <ind@henn.et> | 2013-05-02 17:14:01 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-05-02 17:14:01 -0300 |
commit | a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d (patch) | |
tree | 710a44f94cceff2f0198211d21ddfbe99b66f02c /src/map/clif.c | |
parent | 219a4f5267b33349649f952266532a132a48c2a3 (diff) | |
download | hercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.tar.gz hercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.tar.bz2 hercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.tar.xz hercules-a2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d.zip |
Introducing Hercules Plugin Mananger
http://hercules.ws/board/topic/549-introducing-hercules-plugin-manager/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 10c1a0d47..160de3adc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5640,38 +5640,27 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val p.val2 = val2; p.val3 = val3; #endif - + ShowDebug("Sending type %d; aid %d; state %d; total %d; left %d; v1 %d; v2 %d; v3 %d;\n",p.index,p.AID,p.state,p.Total,p.Left,p.val1,p.val2,p.val3); clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); } /// Send message (modified by [Yor]) (ZC_NOTIFY_PLAYERCHAT). /// 008e <packet len>.W <message>.?B -void clif_displaymessage(const int fd, const char* mes) -{ +void clif_displaymessage(const int fd, const char* mes) { nullpo_retv(mes); - //Scrapped, as these are shared by disconnected players =X [Skotlex] - if (fd == 0) - ; - else { - char *message, *line; - - message = aStrdup(mes); - line = strtok(message, "\n"); - while(line != NULL) { - // Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client) - int len = strnlen(line, 255); - - if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. - WFIFOHEAD(fd, 5 + len); - WFIFOW(fd,0) = 0x8e; - WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate - safestrncpy((char *)WFIFOP(fd,4), line, len + 1); - WFIFOSET(fd, 5 + len); - } - line = strtok(NULL, "\n"); + if( fd == -2 ) { + ShowInfo("HCP: %s\n",mes); + } else if ( fd > 0 ) { + int len; + + if ( ( len = strnlen(mes, 255) ) > 0 ) { // don't send a void message (it's not displaying on the client chat). @help can send void line. + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate + safestrncpy((char *)WFIFOP(fd,4), mes, len + 1); + WFIFOSET(fd, 5 + len); } - aFree(message); } } @@ -16873,9 +16862,10 @@ int clif_parse(int fd) { set_eof(fd); return 0; } - // determine real packet length packet_len = packet_db[cmd].len; + if(sd) + ShowWarning("clif_parse: Received packet 0x%04x with packet_len = %d (%d).\n", cmd, packet_len,RFIFOREST(fd)); if (packet_len == -1) { // variable-length packet if (RFIFOREST(fd) < 4) return 0; @@ -16892,7 +16882,7 @@ int clif_parse(int fd) { } if ((int)RFIFOREST(fd) < packet_len) return 0; // not enough data received to form the packet - + if( packet_db[cmd].func == clif->pDebug ) packet_db[cmd].func(fd, sd); else if( packet_db[cmd].func != NULL ) { |