summaryrefslogtreecommitdiff
path: root/src/char/int_mercenary.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/int_mercenary.c')
-rw-r--r--src/char/int_mercenary.c72
1 files changed, 9 insertions, 63 deletions
diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c
index bf1df5588..52afdcb9f 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) )
{
@@ -185,65 +185,6 @@ bool mapif_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 = mapif->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);
- 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 = mapif->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 = mapif->mercenary_save(merc);
- mapif->mercenary_saved(fd, result);
-}
-
int inter_mercenary_sql_init(void)
{
return 0;
@@ -282,4 +223,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;
}