From 882b22d8dfaaabd8781bdad139aaa2e6777eea52 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 24 Jun 2018 20:33:59 +0200 Subject: Move mapif functions from int_homunculus.c to mapif.c Signed-off-by: Haru --- src/char/int_homun.c | 97 ---------------------------------------------------- 1 file changed, 97 deletions(-) (limited to 'src/char/int_homun.c') diff --git a/src/char/int_homun.c b/src/char/int_homun.c index b692ac971..28ec848be 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -49,66 +49,6 @@ void inter_homunculus_sql_final(void) return; } -void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus *sh, unsigned char flag) -{ - nullpo_retv(sh); - WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); - WFIFOW(fd,0) = 0x3890; - WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; - WFIFOL(fd,4) = account_id; - WFIFOB(fd,8)= flag; - memcpy(WFIFOP(fd,9),sh,sizeof(struct s_homunculus)); - WFIFOSET(fd, WFIFOW(fd,2)); -} - -void mapif_homunculus_deleted(int fd, int flag) -{ - WFIFOHEAD(fd, 3); - WFIFOW(fd, 0) = 0x3893; - WFIFOB(fd,2) = flag; //Flag 1 = success - WFIFOSET(fd, 3); -} - -void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) -{ - WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); - WFIFOW(fd,0) = 0x3891; - WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; - WFIFOL(fd,4) = account_id; - if( hd != NULL ) - { - WFIFOB(fd,8) = 1; // success - memcpy(WFIFOP(fd,9), hd, sizeof(struct s_homunculus)); - } - else - { - WFIFOB(fd,8) = 0; // not found. - memset(WFIFOP(fd,9), 0, sizeof(struct s_homunculus)); - } - WFIFOSET(fd, sizeof(struct s_homunculus)+9); -} - -void mapif_homunculus_saved(int fd, int account_id, bool flag) -{ - WFIFOHEAD(fd, 7); - WFIFOW(fd,0) = 0x3892; - WFIFOL(fd,2) = account_id; - WFIFOB(fd,6) = flag; // 1:success, 0:failure - WFIFOSET(fd, 7); -} - -void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, const char *name) -{ - nullpo_retv(name); - WFIFOHEAD(fd, NAME_LENGTH+12); - WFIFOW(fd, 0) = 0x3894; - WFIFOL(fd, 2) = account_id; - WFIFOL(fd, 6) = char_id; - WFIFOB(fd,10) = flag; - safestrncpy(WFIFOP(fd,11), name, NAME_LENGTH); - WFIFOSET(fd, NAME_LENGTH+12); -} - /** * Creates a new homunculus with the given data. * @@ -302,43 +242,6 @@ bool inter_homunculus_rename(const char *name) return true; } - -void mapif_parse_homunculus_create(int fd, int len, int account_id, const struct s_homunculus *phd) -{ - struct s_homunculus shd; - bool result; - - memcpy(&shd, phd, sizeof(shd)); - - result = inter_homunculus->create(&shd); - mapif->homunculus_created(fd, account_id, &shd, result); -} - -void mapif_parse_homunculus_delete(int fd, int homun_id) -{ - bool result = inter_homunculus->delete(homun_id); - mapif->homunculus_deleted(fd, result); -} - -void mapif_parse_homunculus_load(int fd, int account_id, int homun_id) -{ - struct s_homunculus hd; - bool result = inter_homunculus->load(homun_id, &hd); - mapif->homunculus_loaded(fd, account_id, ( result ? &hd : NULL )); -} - -void mapif_parse_homunculus_save(int fd, int len, int account_id, const struct s_homunculus *phd) -{ - bool result = inter_homunculus->save(phd); - mapif->homunculus_saved(fd, account_id, result); -} - -void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, const char *name) -{ - bool result = inter_homunculus->rename(name); - mapif->homunculus_renamed(fd, account_id, char_id, result, name); -} - /*========================================== * Inter Packets *------------------------------------------*/ -- cgit v1.2.3-70-g09d2