diff options
author | Haru <haru@dotalux.com> | 2018-06-24 22:06:41 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-06-30 01:51:11 +0200 |
commit | f071f91664ac5b6ed31591c33c001bcf6a75a53f (patch) | |
tree | 9092f84f37443c24f0d83cc2860bf9db04a9559d /src | |
parent | ccfd2de6387f7919ef0c83fc3e48eb18b0fc5427 (diff) | |
download | hercules-f071f91664ac5b6ed31591c33c001bcf6a75a53f.tar.gz hercules-f071f91664ac5b6ed31591c33c001bcf6a75a53f.tar.bz2 hercules-f071f91664ac5b6ed31591c33c001bcf6a75a53f.tar.xz hercules-f071f91664ac5b6ed31591c33c001bcf6a75a53f.zip |
Move mapif functions from int_mercenary.c to mapif.c
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/char/int_mercenary.c | 59 | ||||
-rw-r--r-- | src/char/mapif.c | 67 |
2 files changed, 60 insertions, 66 deletions
diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c index 6c94b62c9..52afdcb9f 100644 --- a/src/char/int_mercenary.c +++ b/src/char/int_mercenary.c @@ -185,65 +185,6 @@ bool inter_mercenary_delete(int merc_id) return true; } -void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) -{ - int size = sizeof(struct s_mercenary) + 5; - - nullpo_retv(merc); - WFIFOHEAD(fd,size); - WFIFOW(fd,0) = 0x3870; - WFIFOW(fd,2) = size; - WFIFOB(fd,4) = flag; - memcpy(WFIFOP(fd,5),merc,sizeof(struct s_mercenary)); - WFIFOSET(fd,size); -} - -void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc) -{ - struct s_mercenary merc_; - bool result; - - memcpy(&merc_, merc, sizeof(merc_)); - - result = inter_mercenary->create(&merc_); - mapif->mercenary_send(fd, &merc_, result); -} - -void mapif_parse_mercenary_load(int fd, int merc_id, int char_id) -{ - struct s_mercenary merc; - bool result = inter_mercenary->load(merc_id, char_id, &merc); - mapif->mercenary_send(fd, &merc, result); -} - -void mapif_mercenary_deleted(int fd, unsigned char flag) -{ - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x3871; - WFIFOB(fd,2) = flag; - WFIFOSET(fd,3); -} - -void mapif_parse_mercenary_delete(int fd, int merc_id) -{ - bool result = inter_mercenary->delete(merc_id); - mapif->mercenary_deleted(fd, result); -} - -void mapif_mercenary_saved(int fd, unsigned char flag) -{ - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x3872; - WFIFOB(fd,2) = flag; - WFIFOSET(fd,3); -} - -void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc) -{ - bool result = inter_mercenary->save(merc); - mapif->mercenary_saved(fd, result); -} - int inter_mercenary_sql_init(void) { return 0; diff --git a/src/char/mapif.c b/src/char/mapif.c index 85b0e44dc..b4ad02fd4 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -29,6 +29,7 @@ #include "char/int_homun.h" #include "char/int_elemental.h" #include "char/int_mail.h" +#include "char/int_mercenary.h" #include "char/int_rodex.h" #include "char/inter.h" #include "common/cbasetypes.h" @@ -1128,13 +1129,65 @@ void mapif_parse_mail_send(int fd) mapif->mail_new(&msg); // notify recipient } -void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag); -void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc); -void mapif_parse_mercenary_load(int fd, int merc_id, int char_id); -void mapif_mercenary_deleted(int fd, unsigned char flag); -void mapif_parse_mercenary_delete(int fd, int merc_id); -void mapif_mercenary_saved(int fd, unsigned char flag); -void mapif_parse_mercenary_save(int fd, const struct s_mercenary *merc); +void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) +{ + int size = sizeof(struct s_mercenary) + 5; + + nullpo_retv(merc); + WFIFOHEAD(fd, size); + WFIFOW(fd, 0) = 0x3870; + WFIFOW(fd, 2) = size; + WFIFOB(fd, 4) = flag; + memcpy(WFIFOP(fd, 5), merc, sizeof(struct s_mercenary)); + WFIFOSET(fd,size); +} + +void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc) +{ + struct s_mercenary merc_; + bool result; + + memcpy(&merc_, merc, sizeof(merc_)); + + result = inter_mercenary->create(&merc_); + mapif->mercenary_send(fd, &merc_, result); +} + +void mapif_parse_mercenary_load(int fd, int merc_id, int char_id) +{ + struct s_mercenary merc; + bool result = inter_mercenary->load(merc_id, char_id, &merc); + mapif->mercenary_send(fd, &merc, result); +} + +void mapif_mercenary_deleted(int fd, unsigned char flag) +{ + WFIFOHEAD(fd, 3); + WFIFOW(fd, 0) = 0x3871; + WFIFOB(fd, 2) = flag; + WFIFOSET(fd, 3); +} + +void mapif_parse_mercenary_delete(int fd, int merc_id) +{ + bool result = inter_mercenary->delete(merc_id); + mapif->mercenary_deleted(fd, result); +} + +void mapif_mercenary_saved(int fd, unsigned char flag) +{ + WFIFOHEAD(fd, 3); + WFIFOW(fd, 0) = 0x3872; + WFIFOB(fd, 2) = flag; + WFIFOSET(fd, 3); +} + +void mapif_parse_mercenary_save(int fd, const struct s_mercenary *merc) +{ + bool result = inter_mercenary->save(merc); + mapif->mercenary_saved(fd, result); +} + int mapif_party_created(int fd, int account_id, int char_id, struct party *p); void mapif_party_noinfo(int fd, int party_id, int char_id); void mapif_party_info(int fd, struct party* p, int char_id); |