summaryrefslogtreecommitdiff
path: root/src/char/inter.c
diff options
context:
space:
mode:
authorGepard <Gepard@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-03 15:56:54 +0000
committerGepard <Gepard@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-03 15:56:54 +0000
commit7adb4c8eab8ba0c4c71eb112bac9cb3df2284c3c (patch)
tree9fbdc34b79577bff7972c1c931964246eaeed387 /src/char/inter.c
parenta9763770c28c1e79cc43a0a43b46745ea3090940 (diff)
downloadhercules-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/inter.c')
-rw-r--r--src/char/inter.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/char/inter.c b/src/char/inter.c
index 796895827..051d8117a 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -296,17 +296,23 @@ int inter_mapif_init(int fd) {
//--------------------------------------------------------
// sended packets to map-server
-// GMメッセージ送信
-int mapif_GMmessage(unsigned char *mes, int len, unsigned long color, int sfd) {
- unsigned char buf[2048];
+// 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 = (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;
}
@@ -445,11 +451,11 @@ int check_ttl_wisdata(void) {
//--------------------------------------------------------
// received packets from map-server
-// GMメッセージ送信
-int mapif_parse_GMmessage(int fd) {
+// broadcast sending
+int mapif_parse_broadcast(int fd)
+{
RFIFOHEAD(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;
}
@@ -690,7 +696,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;