summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-07-22 23:37:10 -0400
committergumi <git@gumi.ca>2020-05-03 11:46:22 -0400
commit06e65c769bbb66045e0d51da6a321a4c4ef1ff42 (patch)
tree8584118f3956ef75fbf0e22734b2cc3db2a2e98b /src/map/npc.c
parentf40cc839413cc82aed445d39cc3aa204dce87780 (diff)
downloadhercules-06e65c769bbb66045e0d51da6a321a4c4ef1ff42.tar.gz
hercules-06e65c769bbb66045e0d51da6a321a4c4ef1ff42.tar.bz2
hercules-06e65c769bbb66045e0d51da6a321a4c4ef1ff42.tar.xz
hercules-06e65c769bbb66045e0d51da6a321a4c4ef1ff42.zip
allow local NPC functions to be public or private
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 40ec380ee..570305ba1 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -389,7 +389,8 @@ static int npc_event_export(struct npc_data *nd, int i)
Assert_ret(i >= 0 && i < nd->u.scr.label_list_num);
lname = nd->u.scr.label_list[i].name;
pos = nd->u.scr.label_list[i].pos;
- if ((lname[0] == 'O' || lname[0] == 'o') && (lname[1] == 'N' || lname[1] == 'n')) {
+
+ if ((nd->u.scr.label_list[i].flags & LABEL_IS_EXTERN) != 0 && (nd->u.scr.label_list[i].flags & LABEL_IS_USERFUNC) == 0) {
struct event_data *ev;
struct linkdb_node **label_linkdb = NULL;
char buf[EVENT_NAME_LENGTH];
@@ -3054,11 +3055,11 @@ static int npc_unload(struct npc_data *nd, bool single, bool unload_mobs)
aFree(nd->u.shop.shop_item); /// src check for duplicate shops. [Orcao]
} else if (nd->subtype == SCRIPT) {
char evname[EVENT_NAME_LENGTH];
-
+
snprintf(evname, ARRAYLENGTH(evname), "%s::OnNPCUnload", nd->exname);
struct event_data *ev = strdb_get(npc->ev_db, evname);
-
+
if (ev != NULL)
script->run_npc(nd->u.scr.script, ev->pos, 0, nd->bl.id); /// Run OnNPCUnload.
@@ -3665,6 +3666,7 @@ static void npc_convertlabel_db(struct npc_label_list *label_list, const char *f
for( i = 0; i < script->label_count; i++ ) {
const char* lname = script->get_str(script->labels[i].key);
int lpos = script->labels[i].pos;
+ enum script_label_flags flags = script->labels[i].flags;
struct npc_label_list* label;
const char *p;
size_t len;
@@ -3686,6 +3688,7 @@ static void npc_convertlabel_db(struct npc_label_list *label_list, const char *f
safestrncpy(label->name, lname, sizeof(label->name));
label->pos = lpos;
+ label->flags = flags;
}
}
@@ -5606,7 +5609,7 @@ static int npc_reload(void)
npc->npc_last_npd = NULL;
npc->npc_last_path = NULL;
npc->npc_last_ref = NULL;
-
+
const int npc_new_min = npc->npc_id;
struct s_mapiterator *iter = mapit_geteachiddb();