summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-07 21:13:07 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-10 23:06:08 +0300
commitc0367b69fd226be21643cd4b620fff2aadb0e742 (patch)
tree94b6cb16c7c5232020a22896496813be378a340e /src/map/script.c
parent5ad96bcc2af2a5a76348fca87e52a0f038461808 (diff)
downloadhercules-c0367b69fd226be21643cd4b620fff2aadb0e742.tar.gz
hercules-c0367b69fd226be21643cd4b620fff2aadb0e742.tar.bz2
hercules-c0367b69fd226be21643cd4b620fff2aadb0e742.tar.xz
hercules-c0367b69fd226be21643cd4b620fff2aadb0e742.zip
Move use item script function call into function script_run_use_script.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 4c669bf20..1290d96e1 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10453,7 +10453,7 @@ BUILDIN(itemeffect) {
}
}
- script->run( item_data->script, 0, sd->bl.id, nd->bl.id );
+ script->run_use_script(sd, item_data, nd->bl.id);
return true;
}
@@ -19834,6 +19834,22 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)
return script->add_builtin(&buildin, true);
}
+void script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1)));
+
+/**
+ * Run use script for item.
+ *
+ * @param sd player session data. Must be correct and checked before.
+ * @param n item index in inventory. Must be correct and checked before.
+ * @param oid npc id. Can be also 0 or fake npc id.
+ */
+void script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid)
+{
+ script->current_item_id = data->nameid;
+ script->run(data->script, 0, sd->bl.id, oid);
+ script->current_item_id = 0;
+}
+
#define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args, false }
#define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args, false }
#define BUILDIN_DEF_DEPRECATED(x,args) { buildin_ ## x , #x , args, true }
@@ -20778,5 +20794,6 @@ void script_defaults(void) {
script->add_language = script_add_language;
script->get_translation_file_name = script_get_translation_file_name;
script->parser_clean_leftovers = script_parser_clean_leftovers;
-
+
+ script->run_use_script = script_run_use_script;
}