summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-29 00:05:43 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-29 00:05:43 +0300
commit9598d5c5079f8d3d4e0b9f78580ba8b763b4498d (patch)
tree1283a92d206ad1771a6c3178cc6ab65ec33dd9d3
parent13679e2600d188a615d8f05dfe56c61341496588 (diff)
downloadevol-hercules-9598d5c5079f8d3d4e0b9f78580ba8b763b4498d.tar.gz
evol-hercules-9598d5c5079f8d3d4e0b9f78580ba8b763b4498d.tar.bz2
evol-hercules-9598d5c5079f8d3d4e0b9f78580ba8b763b4498d.tar.xz
evol-hercules-9598d5c5079f8d3d4e0b9f78580ba8b763b4498d.zip
Change script function requestitems to return value.
-rw-r--r--src/emap/init.c2
-rw-r--r--src/emap/script.c31
-rw-r--r--src/emap/scriptdefines.h2
3 files changed, 7 insertions, 28 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 1737355..73d7928 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -98,7 +98,7 @@ HPExport void plugin_init (void)
addScriptCommand("lg", "s*", lg);
addScriptCommand("requestlang", "", requestLang);
addScriptCommand("requestitem", "", requestItem);
- addScriptCommand("requestitems", "v*", requestItems);
+ addScriptCommand("requestitems", "*", requestItems);
addScriptCommand("requestitemindex", "v", requestItemIndex);
addScriptCommand("requestitemsindex", "v*", requestItemsIndex);
addScriptCommand("requestcraft", "*", requestCraft);
diff --git a/src/emap/script.c b/src/emap/script.c
index ebfbd77..2f853ca 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -683,34 +683,12 @@ BUILDIN(requestItem)
BUILDIN(requestItems)
{
- 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))
- {
- ShowWarning("parameter is not variable\n");
- script->reportsrc(st);
- return false;
- }
-
+ getSDReturnS("0,0");
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;
}
@@ -732,11 +710,12 @@ BUILDIN(requestItems)
if (!sd->npc_str)
{
ShowWarning("npc string not found\n");
+ script_pushstr(st, aStrdup("0,0"));
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;
diff --git a/src/emap/scriptdefines.h b/src/emap/scriptdefines.h
index 54d8a33..5d462f4 100644
--- a/src/emap/scriptdefines.h
+++ b/src/emap/scriptdefines.h
@@ -82,7 +82,7 @@
{ \
ShowWarning("player not attached\n"); \
script->reportsrc(st); \
- script_pushstr(st, def); \
+ script_pushstr(st, aStrdup(def)); \
return false; \
}