summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-28 23:54:28 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-28 23:54:28 +0300
commit13679e2600d188a615d8f05dfe56c61341496588 (patch)
tree3129877b55a37270da2a83763a0a5e1a7bab879a
parentcbe15f5cc7338e9f1b7744bfd6bbbe44c9db115c (diff)
downloadplugin-13679e2600d188a615d8f05dfe56c61341496588.tar.gz
plugin-13679e2600d188a615d8f05dfe56c61341496588.tar.bz2
plugin-13679e2600d188a615d8f05dfe56c61341496588.tar.xz
plugin-13679e2600d188a615d8f05dfe56c61341496588.zip
Change script function requestitem to return value.
-rw-r--r--src/emap/init.c2
-rw-r--r--src/emap/script.c27
2 files changed, 5 insertions, 24 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index a3a3a10..1737355 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -97,7 +97,7 @@ HPExport void plugin_init (void)
addScriptCommand("l", "s*", l);
addScriptCommand("lg", "s*", lg);
addScriptCommand("requestlang", "", requestLang);
- addScriptCommand("requestitem", "v", requestItem);
+ addScriptCommand("requestitem", "", requestItem);
addScriptCommand("requestitems", "v*", requestItems);
addScriptCommand("requestitemindex", "v", requestItemIndex);
addScriptCommand("requestitemsindex", "v*", requestItemsIndex);
diff --git a/src/emap/script.c b/src/emap/script.c
index f079215..ebfbd77 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -641,28 +641,7 @@ BUILDIN(requestLang)
BUILDIN(requestItem)
{
- getSD();
- struct script_data* data;
- int64 uid;
- const char* name;
-
- data = script_getdata(st, 2);
- if (!data_isreference(data))
- {
- ShowError("script:requestitem: not a variable\n");
- script->reportsrc(st);
- st->state = END;
- return false;
- }
- uid = reference_getuid(data);
- name = reference_getname(data);
-
- if (is_string_variable(name))
- {
- ShowError("script:requestitem: not a variable\n");
- script->reportsrc(st);
- return false;
- }
+ getSDReturn(0);
if (!sd->state.menu_or_input)
{
@@ -683,6 +662,7 @@ BUILDIN(requestItem)
if (!sd->npc_str)
{
ShowWarning("npc string not found\n");
+ script_pushint(st, 0);
script->reportsrc(st);
return false;
}
@@ -690,11 +670,12 @@ BUILDIN(requestItem)
if (sscanf (sd->npc_str, "%5d", &item) < 1)
{
ShowWarning("input data is not item id\n");
+ script_pushint(st, 0);
script->reportsrc(st);
return false;
}
- script->set_reg(st, sd, uid, name, (void*)h64BPTRSIZE(item), script_getref(st,2));
+ script_pushint(st, item);
st->state = RUN;
}
return true;