summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-28 23:44:35 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-28 23:46:55 +0300
commitcbe15f5cc7338e9f1b7744bfd6bbbe44c9db115c (patch)
tree7279ca1cb4a352e21a18b8cd89e6d57ef65b5037
parent7115a2a0ff13a16609fb8fa516dcdf17cd773ee0 (diff)
downloadplugin-cbe15f5cc7338e9f1b7744bfd6bbbe44c9db115c.tar.gz
plugin-cbe15f5cc7338e9f1b7744bfd6bbbe44c9db115c.tar.bz2
plugin-cbe15f5cc7338e9f1b7744bfd6bbbe44c9db115c.tar.xz
plugin-cbe15f5cc7338e9f1b7744bfd6bbbe44c9db115c.zip
Change script function requestlang to return value.
-rw-r--r--src/emap/init.c2
-rw-r--r--src/emap/script.c25
-rw-r--r--src/emap/scriptdefines.h2
3 files changed, 4 insertions, 25 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index f9f264b..a3a3a10 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -96,7 +96,7 @@ HPExport void plugin_init (void)
addScriptCommand("getinvindexlink", "i", getInvIndexLink);
addScriptCommand("l", "s*", l);
addScriptCommand("lg", "s*", lg);
- addScriptCommand("requestlang", "v", requestLang);
+ addScriptCommand("requestlang", "", requestLang);
addScriptCommand("requestitem", "v", requestItem);
addScriptCommand("requestitems", "v*", requestItems);
addScriptCommand("requestitemindex", "v", requestItemIndex);
diff --git a/src/emap/script.c b/src/emap/script.c
index 26a0246..f079215 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -613,28 +613,7 @@ BUILDIN(getItemLink)
BUILDIN(requestLang)
{
- getSD();
- struct script_data* data;
- int64 uid;
- const char* name;
-
- data = script_getdata(st, 2);
- if (!data_isreference(data))
- {
- ShowError("script:requestlang: 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:requestlang: not a variable\n");
- script->reportsrc(st);
- return false;
- }
+ getSDReturn(-1);
if (!sd->state.menu_or_input)
{
@@ -654,7 +633,7 @@ BUILDIN(requestLang)
int lng = -1;
if (*sd->npc_str)
lng = lang_getId(sd->npc_str);
- script->set_reg(st, sd, uid, name, (void*)h64BPTRSIZE(lng), script_getref(st,2));
+ script_pushint(st, lng);
st->state = RUN;
}
return true;
diff --git a/src/emap/scriptdefines.h b/src/emap/scriptdefines.h
index 9a21313..54d8a33 100644
--- a/src/emap/scriptdefines.h
+++ b/src/emap/scriptdefines.h
@@ -4,7 +4,7 @@
#ifndef EVOL_MAP_SCRIPTDEFINES
#define EVOL_MAP_SCRIPTDEFINES
-#define getSessionDataReturn(def) \
+#define getSessionDataReturn(data, def) \
if (!st->rid) \
{ \
ShowWarning("!st->rid\n"); \