From 8b68532c0858889fe734b85c46c89a67ba832195 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 25 Jun 2018 01:00:00 +0200 Subject: Move mapif functions from int_quest.c to mapif.c Signed-off-by: Haru --- src/char/int_quest.c | 73 ---------------------------------------------------- 1 file changed, 73 deletions(-) (limited to 'src/char/int_quest.c') diff --git a/src/char/int_quest.c b/src/char/int_quest.c index 7b89ddf01..afd01579e 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -200,15 +200,6 @@ bool inter_quest_update(int char_id, struct quest qd) return true; } -void mapif_quest_save_ack(int fd, int char_id, bool success) -{ - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x3861; - WFIFOL(fd,2) = char_id; - WFIFOB(fd,6) = success?1:0; - WFIFOSET(fd,7); -} - bool inter_quest_save(int char_id, const struct quest *new_qd, int new_n) { int i, j, k, old_n; @@ -247,70 +238,6 @@ bool inter_quest_save(int char_id, const struct quest *new_qd, int new_n) return success; } -/** - * Handles the save request from mapserver for a character's questlog. - * - * Received quests are saved, and an ack is sent back to the map server. - * - * @see inter_parse_frommap - */ -int mapif_parse_quest_save(int fd) -{ - int num = (RFIFOW(fd, 2) - 8) / sizeof(struct quest); - int char_id = RFIFOL(fd, 4); - const struct quest *qd = NULL; - bool success; - - if (num > 0) - qd = RFIFOP(fd,8); - - success = inter_quest->save(char_id, qd, num); - - // Send ack - mapif->quest_save_ack(fd, char_id, success); - - return 0; -} - -void mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_quests) -{ - WFIFOHEAD(fd,num_quests*sizeof(struct quest)+8); - WFIFOW(fd,0) = 0x3860; - WFIFOW(fd,2) = num_quests*sizeof(struct quest)+8; - WFIFOL(fd,4) = char_id; - - if (num_quests > 0) { - nullpo_retv(tmp_questlog); - memcpy(WFIFOP(fd,8), tmp_questlog, sizeof(struct quest)*num_quests); - } - - WFIFOSET(fd,num_quests*sizeof(struct quest)+8); -} - -/** - * Sends questlog to the map server - * - * Note: Completed quests (state == Q_COMPLETE) are guaranteed to be sent last - * and the map server relies on this behavior (once the first Q_COMPLETE quest, - * all of them are considered to be Q_COMPLETE) - * - * @see inter_parse_frommap - */ -int mapif_parse_quest_load(int fd) -{ - int char_id = RFIFOL(fd,2); - struct quest *tmp_questlog = NULL; - int num_quests; - - tmp_questlog = inter_quest->fromsql(char_id, &num_quests); - mapif->send_quests(fd, char_id, tmp_questlog, num_quests); - - if (tmp_questlog) - aFree(tmp_questlog); - - return 0; -} - /** * Parses questlog related packets from the map server. * -- cgit v1.2.3-70-g09d2