diff options
author | Gepard <Gepard@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-11-03 15:56:54 +0000 |
---|---|---|
committer | Gepard <Gepard@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-11-03 15:56:54 +0000 |
commit | 7adb4c8eab8ba0c4c71eb112bac9cb3df2284c3c (patch) | |
tree | 9fbdc34b79577bff7972c1c931964246eaeed387 /src/char_sql | |
parent | a9763770c28c1e79cc43a0a43b46745ea3090940 (diff) | |
download | hercules-7adb4c8eab8ba0c4c71eb112bac9cb3df2284c3c.tar.gz hercules-7adb4c8eab8ba0c4c71eb112bac9cb3df2284c3c.tar.bz2 hercules-7adb4c8eab8ba0c4c71eb112bac9cb3df2284c3c.tar.xz hercules-7adb4c8eab8ba0c4c71eb112bac9cb3df2284c3c.zip |
Extended broadcast implementation:
- support for font formatting, like font-size
- `bc_woe` flag to allow client-side filtering of WoE announcements
- new broadcast packet 0x40C
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14120 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r-- | src/char_sql/inter.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index 671ff8e5f..2f5c2daff 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -336,17 +336,23 @@ int inter_mapif_init(int fd) //-------------------------------------------------------- -// GM message sending -int mapif_GMmessage(unsigned char *mes, int len, unsigned long color, int sfd) +// broadcast sending +int mapif_broadcast(unsigned char *mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) { - unsigned char buf[2048]; + unsigned char *buf = (unsigned char*)aMallocA((len)*sizeof(unsigned char)); - if (len > 2048) len = 2047; //Make it fit to avoid crashes. [Skotlex] WBUFW(buf,0) = 0x3800; WBUFW(buf,2) = len; - WBUFL(buf,4) = color; - memcpy(WBUFP(buf,8), mes, len - 8); + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len - 16); mapif_sendallwos(sfd, buf, len); + + if (buf) + aFree(buf); return 0; } @@ -465,10 +471,10 @@ int check_ttl_wisdata(void) //-------------------------------------------------------- -// GM message sending -int mapif_parse_GMmessage(int fd) +// broadcast sending +int mapif_parse_broadcast(int fd) { - mapif_GMmessage(RFIFOP(fd,8), RFIFOW(fd,2), RFIFOL(fd,4), fd); + mapif_broadcast(RFIFOP(fd,16), RFIFOW(fd,2), RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), fd); return 0; } @@ -709,7 +715,7 @@ int inter_parse_frommap(int fd) return 2; switch(cmd) { - case 0x3000: mapif_parse_GMmessage(fd); break; + case 0x3000: mapif_parse_broadcast(fd); break; case 0x3001: mapif_parse_WisRequest(fd); break; case 0x3002: mapif_parse_WisReply(fd); break; case 0x3003: mapif_parse_WisToGM(fd); break; |