summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-06-24 22:04:10 +0200
committerHaru <haru@dotalux.com>2018-06-30 01:51:11 +0200
commitccfd2de6387f7919ef0c83fc3e48eb18b0fc5427 (patch)
tree1c5d51884fe578bdf22e44d90ed8104c15648c06 /src/char
parentbc7e7be46de608fb695e6e324dd76fb6c2a91eea (diff)
downloadhercules-ccfd2de6387f7919ef0c83fc3e48eb18b0fc5427.tar.gz
hercules-ccfd2de6387f7919ef0c83fc3e48eb18b0fc5427.tar.bz2
hercules-ccfd2de6387f7919ef0c83fc3e48eb18b0fc5427.tar.xz
hercules-ccfd2de6387f7919ef0c83fc3e48eb18b0fc5427.zip
Move some non-mapif functionality from the mapif interface to the inter_mercenary interface
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char')
-rw-r--r--src/char/int_mercenary.c21
-rw-r--r--src/char/int_mercenary.h6
-rw-r--r--src/char/mapif.c8
-rw-r--r--src/char/mapif.h4
4 files changed, 19 insertions, 20 deletions
diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c
index bf1df5588..6c94b62c9 100644
--- a/src/char/int_mercenary.c
+++ b/src/char/int_mercenary.c
@@ -104,7 +104,7 @@ bool inter_mercenary_owner_delete(int char_id)
* @param[in,out] merc The new mercenary's data.
* @retval false in case of errors.
*/
-bool mapif_mercenary_create(struct s_mercenary *merc)
+bool inter_mercenary_create(struct s_mercenary *merc)
{
nullpo_retr(false, merc);
Assert_retr(false, merc->mercenary_id == 0);
@@ -126,7 +126,7 @@ bool mapif_mercenary_create(struct s_mercenary *merc)
* @param merc The mercenary's data.
* @retval false in case of errors.
*/
-bool mapif_mercenary_save(const struct s_mercenary *merc)
+bool inter_mercenary_save(const struct s_mercenary *merc)
{
nullpo_retr(false, merc);
Assert_retr(false, merc->mercenary_id > 0);
@@ -141,7 +141,7 @@ bool mapif_mercenary_save(const struct s_mercenary *merc)
return true;
}
-bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc)
+bool inter_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc)
{
char* data;
@@ -174,7 +174,7 @@ bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc)
return true;
}
-bool mapif_mercenary_delete(int merc_id)
+bool inter_mercenary_delete(int merc_id)
{
if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", mercenary_db, merc_id) )
{
@@ -205,14 +205,14 @@ void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc)
memcpy(&merc_, merc, sizeof(merc_));
- result = mapif->mercenary_create(&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 = mapif->mercenary_load(merc_id, char_id, &merc);
+ bool result = inter_mercenary->load(merc_id, char_id, &merc);
mapif->mercenary_send(fd, &merc, result);
}
@@ -226,7 +226,7 @@ void mapif_mercenary_deleted(int fd, unsigned char flag)
void mapif_parse_mercenary_delete(int fd, int merc_id)
{
- bool result = mapif->mercenary_delete(merc_id);
+ bool result = inter_mercenary->delete(merc_id);
mapif->mercenary_deleted(fd, result);
}
@@ -240,7 +240,7 @@ void mapif_mercenary_saved(int fd, unsigned char flag)
void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc)
{
- bool result = mapif->mercenary_save(merc);
+ bool result = inter_mercenary->save(merc);
mapif->mercenary_saved(fd, result);
}
@@ -282,4 +282,9 @@ void inter_mercenary_defaults(void)
inter_mercenary->sql_init = inter_mercenary_sql_init;
inter_mercenary->sql_final = inter_mercenary_sql_final;
inter_mercenary->parse_frommap = inter_mercenary_parse_frommap;
+
+ inter_mercenary->create = inter_mercenary_create;
+ inter_mercenary->load = inter_mercenary_load;
+ inter_mercenary->save = inter_mercenary_save;
+ inter_mercenary->delete = inter_mercenary_delete;
}
diff --git a/src/char/int_mercenary.h b/src/char/int_mercenary.h
index 2b7c82dfa..6291bfcf6 100644
--- a/src/char/int_mercenary.h
+++ b/src/char/int_mercenary.h
@@ -22,6 +22,7 @@
#define CHAR_INT_MERCENARY_H
#include "common/hercules.h"
+#include "common/mmo.h"
struct mmo_charstatus;
@@ -35,6 +36,11 @@ struct inter_mercenary_interface {
int (*sql_init) (void);
void (*sql_final) (void);
int (*parse_frommap) (int fd);
+
+ bool (*create) (struct s_mercenary *merc);
+ bool (*save) (const struct s_mercenary *merc);
+ bool (*load) (int merc_id, int char_id, struct s_mercenary *merc);
+ bool (*delete) (int merc_id);
};
#ifdef HERCULES_CORE
diff --git a/src/char/mapif.c b/src/char/mapif.c
index b137fc448..85b0e44dc 100644
--- a/src/char/mapif.c
+++ b/src/char/mapif.c
@@ -1128,10 +1128,6 @@ void mapif_parse_mail_send(int fd)
mapif->mail_new(&msg); // notify recipient
}
-bool mapif_mercenary_create(struct s_mercenary *merc);
-bool mapif_mercenary_save(const struct s_mercenary *merc);
-bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc);
-bool mapif_mercenary_delete(int merc_id);
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);
@@ -1335,10 +1331,6 @@ void mapif_defaults(void) {
mapif->parse_mail_return = mapif_parse_mail_return;
mapif->mail_send = mapif_mail_send;
mapif->parse_mail_send = mapif_parse_mail_send;
- mapif->mercenary_create = mapif_mercenary_create;
- mapif->mercenary_save = mapif_mercenary_save;
- mapif->mercenary_load = mapif_mercenary_load;
- mapif->mercenary_delete = mapif_mercenary_delete;
mapif->mercenary_send = mapif_mercenary_send;
mapif->parse_mercenary_create = mapif_parse_mercenary_create;
mapif->parse_mercenary_load = mapif_parse_mercenary_load;
diff --git a/src/char/mapif.h b/src/char/mapif.h
index 781ccd4cc..a038dd304 100644
--- a/src/char/mapif.h
+++ b/src/char/mapif.h
@@ -114,10 +114,6 @@ struct mapif_interface {
void (*parse_mail_return) (int fd);
void (*mail_send) (int fd, struct mail_message* msg);
void (*parse_mail_send) (int fd);
- bool (*mercenary_create) (struct s_mercenary *merc);
- bool (*mercenary_save) (const struct s_mercenary *merc);
- bool (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc);
- bool (*mercenary_delete) (int merc_id);
void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag);
void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc);
void (*parse_mercenary_load) (int fd, int merc_id, int char_id);