diff options
author | Haru <haru@dotalux.com> | 2018-06-24 15:46:48 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-06-30 01:51:09 +0200 |
commit | bd010c4058f7973287a4083031d508aa610cb9dd (patch) | |
tree | 1accd13d38584614b58ae2ecfa64ec7c5b103eef | |
parent | a77ed4bbf9a7afa60954c8eab6778be1840e77c5 (diff) | |
download | hercules-bd010c4058f7973287a4083031d508aa610cb9dd.tar.gz hercules-bd010c4058f7973287a4083031d508aa610cb9dd.tar.bz2 hercules-bd010c4058f7973287a4083031d508aa610cb9dd.tar.xz hercules-bd010c4058f7973287a4083031d508aa610cb9dd.zip |
Move some non-mapif functions from the mapif interface to the inter_elemental interface
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/char/char.c | 2 | ||||
-rw-r--r-- | src/char/int_elemental.c | 23 | ||||
-rw-r--r-- | src/char/int_elemental.h | 6 | ||||
-rw-r--r-- | src/char/mapif.c | 8 | ||||
-rw-r--r-- | src/char/mapif.h | 4 |
5 files changed, 22 insertions, 21 deletions
diff --git a/src/char/char.c b/src/char/char.c index 0ac1597df..0e80cf971 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1815,7 +1815,7 @@ int char_delete_char_sql(int char_id) /* remove elemental */ if (elemental_id) - mapif->elemental_delete(elemental_id); + inter_elemental->delete(elemental_id); /* remove mercenary data */ inter_mercenary->owner_delete(char_id); diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c index f847d16ae..2df30ea69 100644 --- a/src/char/int_elemental.c +++ b/src/char/int_elemental.c @@ -50,7 +50,7 @@ struct inter_elemental_interface *inter_elemental; * @param[in,out] ele The new elemental's data. * @retval false in case of errors. */ -bool mapif_elemental_create(struct s_elemental *ele) +bool inter_elemental_create(struct s_elemental *ele) { nullpo_retr(false, ele); Assert_retr(false, ele->elemental_id == 0); @@ -73,7 +73,7 @@ bool mapif_elemental_create(struct s_elemental *ele) * @param ele The elemental's data. * @retval false in case of errors. */ -bool mapif_elemental_save(const struct s_elemental *ele) +bool inter_elemental_save(const struct s_elemental *ele) { nullpo_retr(false, ele); Assert_retr(false, ele->elemental_id > 0); @@ -90,7 +90,8 @@ bool mapif_elemental_save(const struct s_elemental *ele) return true; } -bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) { +bool inter_elemental_load(int ele_id, int char_id, struct s_elemental *ele) +{ char* data; nullpo_retr(false, ele); @@ -134,7 +135,8 @@ bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) { return true; } -bool mapif_elemental_delete(int ele_id) { +bool inter_elemental_delete(int ele_id) +{ if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", elemental_db, ele_id) ) { Sql_ShowDebug(inter->sql_handle); return false; @@ -162,13 +164,13 @@ void mapif_parse_elemental_create(int fd, const struct s_elemental *ele) memcpy(&ele_, ele, sizeof(ele_)); - result = mapif->elemental_create(&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 = mapif->elemental_load(ele_id, char_id, &ele); + bool result = inter_elemental->load(ele_id, char_id, &ele); mapif->elemental_send(fd, &ele, result); } @@ -180,7 +182,7 @@ void mapif_elemental_deleted(int fd, unsigned char flag) { } void mapif_parse_elemental_delete(int fd, int ele_id) { - bool result = mapif->elemental_delete(ele_id); + bool result = inter_elemental->delete(ele_id); mapif->elemental_deleted(fd, result); } @@ -193,7 +195,7 @@ void mapif_elemental_saved(int fd, unsigned char flag) { void mapif_parse_elemental_save(int fd, const struct s_elemental *ele) { - bool result = mapif->elemental_save(ele); + bool result = inter_elemental->save(ele); mapif->elemental_saved(fd, result); } @@ -229,4 +231,9 @@ void inter_elemental_defaults(void) inter_elemental->sql_init = inter_elemental_sql_init; inter_elemental->sql_final = inter_elemental_sql_final; inter_elemental->parse_frommap = inter_elemental_parse_frommap; + + inter_elemental->create = inter_elemental_create; + inter_elemental->save = inter_elemental_save; + inter_elemental->load = inter_elemental_load; + inter_elemental->delete = inter_elemental_delete; } diff --git a/src/char/int_elemental.h b/src/char/int_elemental.h index 646009b50..3172dcacf 100644 --- a/src/char/int_elemental.h +++ b/src/char/int_elemental.h @@ -22,6 +22,7 @@ #define CHAR_INT_ELEMENTAL_H #include "common/hercules.h" +#include "common/mmo.h" /** * inter_elemental_interface interface @@ -30,6 +31,11 @@ struct inter_elemental_interface { void (*sql_init) (void); void (*sql_final) (void); int (*parse_frommap) (int fd); + + bool (*create) (struct s_elemental *ele); + bool (*save) (const struct s_elemental *ele); + bool (*load) (int ele_id, int char_id, struct s_elemental *ele); + bool (*delete) (int ele_id); }; #ifdef HERCULES_CORE diff --git a/src/char/mapif.c b/src/char/mapif.c index e9da31f07..d8f29b9f3 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -416,10 +416,6 @@ void mapif_parse_auction_bid(int fd) mapif->auction_bid(fd, char_id, 0, 1); // You have successfully bid in the auction } -bool mapif_elemental_create(struct s_elemental *ele); -bool mapif_elemental_save(const struct s_elemental *ele); -bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele); -bool mapif_elemental_delete(int ele_id); 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); @@ -634,10 +630,6 @@ void mapif_defaults(void) { mapif->parse_auction_close = mapif_parse_auction_close; mapif->auction_bid = mapif_auction_bid; mapif->parse_auction_bid = mapif_parse_auction_bid; - mapif->elemental_create = mapif_elemental_create; - mapif->elemental_save = mapif_elemental_save; - mapif->elemental_load = mapif_elemental_load; - mapif->elemental_delete = mapif_elemental_delete; mapif->elemental_send = mapif_elemental_send; mapif->parse_elemental_create = mapif_parse_elemental_create; mapif->parse_elemental_load = mapif_parse_elemental_load; diff --git a/src/char/mapif.h b/src/char/mapif.h index 9cac2be85..b27bd8092 100644 --- a/src/char/mapif.h +++ b/src/char/mapif.h @@ -51,10 +51,6 @@ struct mapif_interface { void (*parse_auction_close) (int fd); void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); void (*parse_auction_bid) (int fd); - bool (*elemental_create) (struct s_elemental *ele); - bool (*elemental_save) (const struct s_elemental *ele); - bool (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); - bool (*elemental_delete) (int ele_id); void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); void (*parse_elemental_create) (int fd, const struct s_elemental *ele); void (*parse_elemental_load) (int fd, int ele_id, int char_id); |