diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-03 23:13:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-15 11:47:29 +0300 |
commit | 9658066ce2f411375b9876d0c02737752b816e58 (patch) | |
tree | d9d119edf5025b3ab6e5b4fc1c2086d60ac3b829 | |
parent | 54ac1879f8fae06cbca5f2b312700032a97079b2 (diff) | |
download | hercules-9658066ce2f411375b9876d0c02737752b816e58.tar.gz hercules-9658066ce2f411375b9876d0c02737752b816e58.tar.bz2 hercules-9658066ce2f411375b9876d0c02737752b816e58.tar.xz hercules-9658066ce2f411375b9876d0c02737752b816e58.zip |
Split functions in inter.c.
-rw-r--r-- | src/char/inter.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/char/inter.c b/src/char/inter.c index 73bbb8637..83679aa21 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -1105,15 +1105,19 @@ int mapif_wis_message(struct WisData *wd) return 0; } -// Wis sending result -int mapif_wis_end(struct WisData *wd, int flag) +void mapif_wis_response(int fd, unsigned char *src, int flag) { unsigned char buf[27]; - WBUFW(buf, 0)=0x3802; - memcpy(WBUFP(buf, 2),wd->src,24); + memcpy(WBUFP(buf, 2),src,24); WBUFB(buf,26)=flag; - mapif_send(wd->fd,buf,27); + mapif_send(fd,buf,27); +} + +// Wis sending result +int mapif_wis_end(struct WisData *wd, int flag) +{ + mapif_wis_response(wd->fd, wd->src, flag); return 0; } @@ -1223,11 +1227,7 @@ int mapif_parse_WisRequest(int fd) // search if character exists before to ask all map-servers if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) { - unsigned char buf[27]; - WBUFW(buf, 0) = 0x3802; - memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), NAME_LENGTH); - WBUFB(buf,26) = 1; // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target - mapif_send(fd, buf, 27); + mapif_wis_response(fd, RFIFOP(fd, 4), 1); } else {// Character exists. So, ask all map-servers @@ -1238,15 +1238,10 @@ int mapif_parse_WisRequest(int fd) // if source is destination, don't ask other servers. if( strncmp((const char*)RFIFOP(fd,4), name, NAME_LENGTH) == 0 ) { - uint8 buf[27]; - WBUFW(buf, 0) = 0x3802; - memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), NAME_LENGTH); - WBUFB(buf,26) = 1; // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target - mapif_send(fd, buf, 27); + mapif_wis_response(fd, RFIFOP(fd, 4), 1); } else { - CREATE(wd, struct WisData, 1); // Whether the failure of previous wisp/page transmission (timeout) |