Questinfo correction (#5523)
* Corrected questinfo bubble not always being displayed * Docs updated * Changed qi_display to std::vector Co-authored-by: Lemongrass3110 <lemongrass@kstp.at> Thanks to @lighta @aleos89 @Lemongrass3110 !
This commit is contained in:
@@ -3691,10 +3691,6 @@ void map_data_copy(struct map_data *dst_map, struct map_data *src_map) {
|
||||
dst_map->skill_duration.insert(src_map->skill_duration.begin(), src_map->skill_duration.end());
|
||||
|
||||
dst_map->zone = src_map->zone;
|
||||
|
||||
// Mimic questinfo
|
||||
if (!src_map->qi_data.empty())
|
||||
src_map->qi_data = dst_map->qi_data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4343,29 +4339,27 @@ int log_sql_init(void)
|
||||
|
||||
void map_remove_questinfo(int m, struct npc_data *nd) {
|
||||
struct map_data *mapdata = map_getmapdata(m);
|
||||
struct s_questinfo *qi;
|
||||
|
||||
nullpo_retv(nd);
|
||||
nullpo_retv(mapdata);
|
||||
|
||||
for (int i = 0; i < mapdata->qi_data.size(); i++) {
|
||||
qi = &mapdata->qi_data[i];
|
||||
if (qi && qi->nd == nd) {
|
||||
script_free_code(qi->condition);
|
||||
mapdata->qi_data.erase(mapdata->qi_data.begin() + i);
|
||||
}
|
||||
}
|
||||
util::vector_erase_if_exists(mapdata->qi_npc, nd->bl.id);
|
||||
nd->qi_data.clear();
|
||||
}
|
||||
|
||||
static void map_free_questinfo(struct map_data *mapdata) {
|
||||
nullpo_retv(mapdata);
|
||||
|
||||
for (const auto &it : mapdata->qi_data) {
|
||||
if (it.condition)
|
||||
script_free_code(it.condition);
|
||||
for (const auto &it : mapdata->qi_npc) {
|
||||
struct npc_data *nd = map_id2nd(it);
|
||||
|
||||
if (!nd || nd->qi_data.empty())
|
||||
continue;
|
||||
|
||||
nd->qi_data.clear();
|
||||
}
|
||||
|
||||
mapdata->qi_data.clear();
|
||||
mapdata->qi_npc.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4876,6 +4870,10 @@ void do_final(void){
|
||||
map_quit(sd);
|
||||
mapit_free(iter);
|
||||
|
||||
for (int i = 0; i < map_num; i++) {
|
||||
map_free_questinfo(map_getmapdata(i));
|
||||
}
|
||||
|
||||
/* prepares npcs for a faster shutdown process */
|
||||
do_clear_npc();
|
||||
|
||||
@@ -4939,7 +4937,6 @@ void do_final(void){
|
||||
for (int j=0; j<MAX_MOB_LIST_PER_MAP; j++)
|
||||
if (mapdata->moblist[j]) aFree(mapdata->moblist[j]);
|
||||
}
|
||||
map_free_questinfo(mapdata);
|
||||
mapdata->damage_adjust = {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user