summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-29 00:20:54 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-29 00:20:54 +0300
commit3d76d08ce39ea9f4d4d4e0f015eec74ec6653cd3 (patch)
treeb34f85e2caac7ebc7ba7d92796e1d8de13e1228f /src/emap/script.c
parent28fce75298ef95d380e5c9206a26145561933664 (diff)
downloadplugin-3d76d08ce39ea9f4d4d4e0f015eec74ec6653cd3.tar.gz
plugin-3d76d08ce39ea9f4d4d4e0f015eec74ec6653cd3.tar.bz2
plugin-3d76d08ce39ea9f4d4d4e0f015eec74ec6653cd3.tar.xz
plugin-3d76d08ce39ea9f4d4d4e0f015eec74ec6653cd3.zip
Change script function requestitemsindex to return value.
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index 8d5cb44..d2281d6 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -768,34 +768,12 @@ BUILDIN(requestItemIndex)
BUILDIN(requestItemsIndex)
{
- getSessionData(client);
- 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))
- {
- ShowWarning("parameter is not variable\n");
- script->reportsrc(st);
- return false;
- }
-
+ getSessionDataReturnS(client, "-1");
int count = 1;
- if (script_hasdata(st, 3))
+ if (script_hasdata(st, 2))
{
- count = script_getnum(st, 3);
+ count = script_getnum(st, 2);
if (count < 0)
count = 1;
}
@@ -819,12 +797,13 @@ BUILDIN(requestItemsIndex)
if (!sd->npc_str)
{
+ script_pushstr(st, aStrdup("-1"));
ShowWarning("npc string not found\n");
script->reportsrc(st);
return false;
}
- script->set_reg(st, sd, uid, name, (void*)sd->npc_str, script_getref(st, 2));
+ script_pushstr(st, aStrdup(sd->npc_str));
st->state = RUN;
}
return true;