diff options
author | Haru <haru@dotalux.com> | 2018-06-24 15:49:49 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-06-30 01:51:09 +0200 |
commit | fb1d9e23b926dc893d3e62c708ef0243077ef392 (patch) | |
tree | c947709b754ea1ffe71b6c51135830d3758866fe /src/char/mapif.c | |
parent | bd010c4058f7973287a4083031d508aa610cb9dd (diff) | |
download | hercules-fb1d9e23b926dc893d3e62c708ef0243077ef392.tar.gz hercules-fb1d9e23b926dc893d3e62c708ef0243077ef392.tar.bz2 hercules-fb1d9e23b926dc893d3e62c708ef0243077ef392.tar.xz hercules-fb1d9e23b926dc893d3e62c708ef0243077ef392.zip |
Move mapif functions from int_elemental.c to mapif.c
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char/mapif.c')
-rw-r--r-- | src/char/mapif.c | 67 |
1 files changed, 60 insertions, 7 deletions
diff --git a/src/char/mapif.c b/src/char/mapif.c index d8f29b9f3..442f60709 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -27,6 +27,7 @@ #include "char/int_clan.h" #include "char/int_guild.h" #include "char/int_homun.h" +#include "char/int_elemental.h" #include "char/int_mail.h" #include "char/int_rodex.h" #include "char/inter.h" @@ -416,13 +417,65 @@ void mapif_parse_auction_bid(int fd) mapif->auction_bid(fd, char_id, 0, 1); // You have successfully bid in the auction } -void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag); -void mapif_parse_elemental_create(int fd, const struct s_elemental *ele); -void mapif_parse_elemental_load(int fd, int ele_id, int char_id); -void mapif_elemental_deleted(int fd, unsigned char flag); -void mapif_parse_elemental_delete(int fd, int ele_id); -void mapif_elemental_saved(int fd, unsigned char flag); -void mapif_parse_elemental_save(int fd, const struct s_elemental *ele); +void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) +{ + int size = sizeof(struct s_elemental) + 5; + + nullpo_retv(ele); + WFIFOHEAD(fd, size); + WFIFOW(fd, 0) = 0x387c; + WFIFOW(fd, 2) = size; + WFIFOB(fd, 4) = flag; + memcpy(WFIFOP(fd, 5), ele, sizeof(struct s_elemental)); + WFIFOSET(fd, size); +} + +void mapif_parse_elemental_create(int fd, const struct s_elemental *ele) +{ + struct s_elemental ele_; + bool result; + + memcpy(&ele_, ele, sizeof(ele_)); + + result = inter_elemental->create(&ele_); + mapif->elemental_send(fd, &ele_, result); +} + +void mapif_parse_elemental_load(int fd, int ele_id, int char_id) +{ + struct s_elemental ele; + bool result = inter_elemental->load(ele_id, char_id, &ele); + mapif->elemental_send(fd, &ele, result); +} + +void mapif_elemental_deleted(int fd, unsigned char flag) +{ + WFIFOHEAD(fd, 3); + WFIFOW(fd, 0) = 0x387d; + WFIFOB(fd, 2) = flag; + WFIFOSET(fd, 3); +} + +void mapif_parse_elemental_delete(int fd, int ele_id) +{ + bool result = inter_elemental->delete(ele_id); + mapif->elemental_deleted(fd, result); +} + +void mapif_elemental_saved(int fd, unsigned char flag) +{ + WFIFOHEAD(fd, 3); + WFIFOW(fd, 0) = 0x387e; + WFIFOB(fd, 2) = flag; + WFIFOSET(fd, 3); +} + +void mapif_parse_elemental_save(int fd, const struct s_elemental *ele) +{ + bool result = inter_elemental->save(ele); + mapif->elemental_saved(fd, result); +} + int mapif_guild_created(int fd, int account_id, struct guild *g); int mapif_guild_noinfo(int fd, int guild_id); int mapif_guild_info(int fd, struct guild *g); |