diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/map.c | 10 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/quest.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 5 |
4 files changed, 12 insertions, 7 deletions
diff --git a/src/map/map.c b/src/map/map.c index defa56b2e..b2c9c77c3 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -6047,11 +6047,15 @@ static bool map_add_questinfo(int m, struct npc_data *nd) nullpo_retr(false, nd); Assert_retr(false, m >= 0 && m < map->count); - if (&VECTOR_LAST(map->list[m].qi_list) == nd) + int i; + ARR_FIND(0, VECTOR_LENGTH(map->list[m].qi_list), i, VECTOR_INDEX(map->list[m].qi_list, i) == nd); + + if (i < VECTOR_LENGTH(map->list[m].qi_list)) { return false; + } VECTOR_ENSURE(map->list[m].qi_list, 1, 1); - VECTOR_PUSH(map->list[m].qi_list, *nd); + VECTOR_PUSH(map->list[m].qi_list, nd); return true; } @@ -6062,7 +6066,7 @@ static bool map_remove_questinfo(int m, struct npc_data *nd) Assert_retr(false, m >= 0 && m < map->count); int i; - ARR_FIND(0, VECTOR_LENGTH(map->list[m].qi_list), i, &VECTOR_INDEX(map->list[m].qi_list, i) == nd); + ARR_FIND(0, VECTOR_LENGTH(map->list[m].qi_list), i, VECTOR_INDEX(map->list[m].qi_list, i) == nd); if (i != VECTOR_LENGTH(map->list[m].qi_list)) { VECTOR_ERASE(map->list[m].qi_list, i); return true; diff --git a/src/map/map.h b/src/map/map.h index a876539d0..2de6df2f7 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -846,7 +846,7 @@ struct map_data { } cell_buf; /* questinfo entries list */ - VECTOR_DECL(struct npc_data) qi_list; + VECTOR_DECL(struct npc_data *) qi_list; /* speeds up clif_updatestatus processing by causing hpmeter to run only when someone with the permission can view it */ unsigned short hpmeter_visible; diff --git a/src/map/quest.c b/src/map/quest.c index 10ea668a6..217acfa19 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -675,7 +675,7 @@ static void quest_questinfo_refresh(struct map_session_data *sd) nullpo_retv(sd); 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); + 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); diff --git a/src/map/script.c b/src/map/script.c index 3d5534a47..c08f5e829 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -22085,12 +22085,13 @@ static BUILDIN(setquestinfo) return false; } - qi = &VECTOR_LAST(nd->qi_data); - if (qi == NULL) { + if (VECTOR_LENGTH(nd->qi_data) == 0) { ShowWarning("buildin_setquestinfo: no valide questinfo data has been found for this npc.\n"); return false; } + qi = &VECTOR_LAST(nd->qi_data); + switch (type) { case QINFO_JOB: { |