summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-29 00:12:30 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-29 00:12:30 +0300
commit28fce75298ef95d380e5c9206a26145561933664 (patch)
treeb0cc922d4b810b13fcfba9c5592a0ae629d8c6fa /src/emap/script.c
parent9598d5c5079f8d3d4e0b9f78580ba8b763b4498d (diff)
downloadevol-hercules-28fce75298ef95d380e5c9206a26145561933664.tar.gz
evol-hercules-28fce75298ef95d380e5c9206a26145561933664.tar.bz2
evol-hercules-28fce75298ef95d380e5c9206a26145561933664.tar.xz
evol-hercules-28fce75298ef95d380e5c9206a26145561933664.zip
Change script function requestitemindex to return value.
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index 2f853ca..8d5cb44 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -723,28 +723,7 @@ BUILDIN(requestItems)
BUILDIN(requestItemIndex)
{
- 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))
- {
- ShowError("script:requestitemindex: not a variable\n");
- script->reportsrc(st);
- return false;
- }
+ getSessionDataReturn(client, -1);
if (!sd->state.menu_or_input)
{
@@ -763,10 +742,11 @@ BUILDIN(requestItemIndex)
// take received text/value and store it in the designated variable
sd->state.menu_or_input = 0;
- int item = 0;
+ int item = -1;
if (!sd->npc_str)
{
+ script_pushint(st, -1);
ShowWarning("npc string not found\n");
script->reportsrc(st);
return false;
@@ -774,12 +754,13 @@ BUILDIN(requestItemIndex)
if (sscanf (sd->npc_str, "%5d", &item) < 1)
{
+ script_pushint(st, -1);
ShowWarning("input data is not item id\n");
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;