diff options
author | Haru <haru@dotalux.com> | 2019-06-01 14:22:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-01 14:22:19 +0200 |
commit | c8202e1cd9eb64d07fa921d117a13eef3938a4db (patch) | |
tree | e57701639ffb1e518431dc0e0a10860aa7c642d6 /src/map/quest.c | |
parent | d7042459c9f9797a80dadce57297b5d16e8931c4 (diff) | |
parent | a321a26f2f9867c8c0e4b5503e4ad2275801122e (diff) | |
download | hercules-c8202e1cd9eb64d07fa921d117a13eef3938a4db.tar.gz hercules-c8202e1cd9eb64d07fa921d117a13eef3938a4db.tar.bz2 hercules-c8202e1cd9eb64d07fa921d117a13eef3938a4db.tar.xz hercules-c8202e1cd9eb64d07fa921d117a13eef3938a4db.zip |
Merge pull request #2433 from Asheraf/questinfomemfix
Move questinfo data from map to npc_data
Diffstat (limited to 'src/map/quest.c')
-rw-r--r-- | src/map/quest.c | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/src/map/quest.c b/src/map/quest.c index 7a216095e..9540b411d 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -672,21 +672,22 @@ static int quest_questinfo_validate_icon(int icon) */ static void quest_questinfo_refresh(struct map_session_data *sd) { - int i; - nullpo_retv(sd); - for (i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_data); i++) { - struct questinfo *qi = &VECTOR_INDEX(map->list[sd->bl.m].qi_data, i); - // Remove the bubbles if one of the conditions is no longer valid. - if (quest->questinfo_validate(sd, qi) == false) { + for (int i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_list); i++) { + struct npc_data *nd = &VECTOR_INDEX(map->list[sd->bl.m].qi_list, i); + + int j; + ARR_FIND(0, VECTOR_LENGTH(nd->qi_data), j, quest->questinfo_validate(sd, &VECTOR_INDEX(nd->qi_data, j)) == true); + if (j != VECTOR_LENGTH(nd->qi_data)) { + struct questinfo *qi = &VECTOR_INDEX(nd->qi_data, j); + clif->quest_show_event(sd, &nd->bl, qi->icon, qi->color); + } else { #if PACKETVER >= 20120410 - clif->quest_show_event(sd, &qi->nd->bl, 9999, 0); + clif->quest_show_event(sd, &nd->bl, 9999, 0); #else - clif->quest_show_event(sd, &qi->nd->bl, 0, 0); + clif->quest_show_event(sd, &nd->bl, 0, 0); #endif - } else { - clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); } } } @@ -927,26 +928,6 @@ static bool quest_questinfo_validate_mercenary_class(struct map_session_data *sd } /** - * Clears the questinfo data vector - * - * @param m mapindex. - * - */ -static void quest_questinfo_vector_clear(int m) -{ - int i; - - Assert_retv(m >= 0 && m < map->count); - - for (i = 0; i < VECTOR_LENGTH(map->list[m].qi_data); i++) { - struct questinfo *qi_data = &VECTOR_INDEX(map->list[m].qi_data, i); - VECTOR_CLEAR(qi_data->items); - VECTOR_CLEAR(qi_data->quest_requirement); - } - VECTOR_CLEAR(map->list[m].qi_data); -} - -/** * Initializes the quest interface. * * @param minimal Run in minimal mode (skips most of the loading) @@ -1020,5 +1001,4 @@ void quest_defaults(void) quest->questinfo_validate_homunculus_type = quest_questinfo_validate_homunculus_type; quest->questinfo_validate_quests = quest_questinfo_validate_quests; quest->questinfo_validate_mercenary_class = quest_questinfo_validate_mercenary_class; - quest->questinfo_vector_clear = quest_questinfo_vector_clear; } |