summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/instance.c2
-rw-r--r--src/map/npc.c22
-rw-r--r--src/map/npc_chat.c2
-rw-r--r--src/map/script.c3
-rw-r--r--src/map/script.h3
5 files changed, 17 insertions, 15 deletions
diff --git a/src/map/instance.c b/src/map/instance.c
index f5688d02c..92acd1bbb 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -357,7 +357,7 @@ int instance_init_npc(struct block_list* bl, va_list args) {
snprintf(evname, EVENT_NAME_LENGTH, "%s::OnInstanceInit", nd->exname);
if( ( ev = strdb_get(npc->ev_db, evname) ) )
- script->run(ev->nd->u.scr.script, ev->pos, 0, ev->nd->bl.id);
+ script->run_npc(ev->nd->u.scr.script, ev->pos, 0, ev->nd->bl.id);
return 1;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 6acb93266..8733ee7e4 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -396,7 +396,7 @@ void npc_event_doall_sub(void *key, void *data, va_list ap)
npc->event_sub(map->id2sd(rid), ev, buf);
}
else {
- script->run(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl.id);
+ script->run_npc(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl.id);
}
(*c)++;
}
@@ -411,7 +411,7 @@ int npc_event_do(const char* name)
else {
struct event_data *ev = strdb_get(npc->ev_db, name);
if (ev) {
- script->run(ev->nd->u.scr.script, ev->pos, 0, ev->nd->bl.id);
+ script->run_npc(ev->nd->u.scr.script, ev->pos, 0, ev->nd->bl.id);
return 1;
}
}
@@ -596,7 +596,7 @@ int npc_timerevent(int tid, int64 tick, int id, intptr_t data) {
}
// Run the script
- script->run(nd->u.scr.script,te->pos,nd->u.scr.rid,nd->bl.id);
+ script->run_npc(nd->u.scr.script,te->pos,nd->u.scr.rid,nd->bl.id);
nd->u.scr.rid = old_rid; // Attached-rid should be restored anyway.
if( sd )
@@ -745,7 +745,7 @@ void npc_timerevent_quit(struct map_session_data* sd)
nd->u.scr.timer = ted->time;
//Execute label
- script->run(nd->u.scr.script,ev->pos,sd->bl.id,nd->bl.id);
+ script->run_npc(nd->u.scr.script,ev->pos,sd->bl.id,nd->bl.id);
//Restore previous data.
nd->u.scr.rid = old_rid;
@@ -822,7 +822,7 @@ int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char
npc->event_dequeue(sd);
return 2;
}
- script->run(ev->nd->u.scr.script,ev->pos,sd->bl.id,ev->nd->bl.id);
+ script->run_npc(ev->nd->u.scr.script,ev->pos,sd->bl.id,ev->nd->bl.id);
return 0;
}
@@ -1067,7 +1067,7 @@ int npc_touch_areanpc2(struct mob_data *md)
break; // No OnTouchNPC Event
md->areanpc_id = map->list[m].npc[i]->bl.id;
id = md->bl.id; // Stores Unique ID
- script->run(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id);
+ script->run_npc(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id);
if( map->id2md(id) == NULL ) return 1; // Not Warped, but killed
break;
}
@@ -1255,7 +1255,7 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
if( !npc->trader_open(sd,nd) )
return 1;
} else
- script->run(nd->u.scr.script,0,sd->bl.id,nd->bl.id);
+ script->run_npc(nd->u.scr.script,0,sd->bl.id,nd->bl.id);
break;
case TOMB:
npc->run_tomb(sd,nd);
@@ -1654,7 +1654,7 @@ void npc_trader_count_funds(struct npc_data *nd, struct map_session_data *sd) {
snprintf(evname, EVENT_NAME_LENGTH, "%s::OnCountFunds",nd->exname);
if ( (ev = strdb_get(npc->ev_db, evname)) )
- script->run(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
+ script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
else
ShowError("npc_trader_count_funds: '%s' event '%s' not found, operation failed\n",nd->exname,evname);
@@ -1682,7 +1682,7 @@ bool npc_trader_pay(struct npc_data *nd, struct map_session_data *sd, int price,
pc->setreg(sd,script->add_str("@price"),price);
pc->setreg(sd,script->add_str("@points"),points);
- script->run(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
+ script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
} else
ShowError("npc_trader_pay: '%s' event '%s' not found, operation failed\n",nd->exname,evname);
@@ -3037,7 +3037,7 @@ const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char*
if( ( ev = (struct event_data*)strdb_get(npc->ev_db, evname) ) ) {
//Execute OnInit
- script->run(nd->u.scr.script,ev->pos,0,nd->bl.id);
+ script->run_npc(nd->u.scr.script,ev->pos,0,nd->bl.id);
}
}
@@ -3208,7 +3208,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
if( ( ev = (struct event_data*)strdb_get(npc->ev_db, evname) ) ) {
//Execute OnInit
- script->run(nd->u.scr.script,ev->pos,0,nd->bl.id);
+ script->run_npc(nd->u.scr.script,ev->pos,0,nd->bl.id);
}
}
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index 3fe379f36..67b78dcea 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -371,7 +371,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
}
// run the npc script
- script->run(nd->u.scr.script,lst[i].pos,sd->bl.id,nd->bl.id);
+ script->run_npc(nd->u.scr.script,lst[i].pos,sd->bl.id,nd->bl.id);
return 0;
}
}
diff --git a/src/map/script.c b/src/map/script.c
index 1cad581b3..ca776ead0 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4035,7 +4035,7 @@ int run_func(struct script_state *st)
/*==========================================
* script execution
*------------------------------------------*/
-void run_script(struct script_code *rootscript,int pos,int rid,int oid) {
+void run_script(struct script_code *rootscript, int pos, int rid, int oid) {
struct script_state *st;
if( rootscript == NULL || pos < 0 )
@@ -20661,6 +20661,7 @@ void script_defaults(void) {
script->get_constant = script_get_constant;
script->label_add = script_label_add;
script->run = run_script;
+ script->run_npc = run_script;
script->run_main = run_script_main;
script->run_timer = run_script_timer;
script->set_var = set_var;
diff --git a/src/map/script.h b/src/map/script.h
index 20aa7b3c2..f85ebfd79 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -637,7 +637,8 @@ struct script_interface {
void (*set_constant2) (const char *name, int value, bool isparameter);
bool (*get_constant) (const char* name, int* value);
void (*label_add)(int key, int pos);
- void (*run) (struct script_code *rootscript,int pos,int rid,int oid);
+ void (*run) (struct script_code *rootscript, int pos, int rid, int oid);
+ void (*run_npc) (struct script_code *rootscript, int pos, int rid, int oid);
void (*run_main) (struct script_state *st);
int (*run_timer) (int tid, int64 tick, int id, intptr_t data);
int (*set_var) (struct map_session_data *sd, char *name, void *val);