summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/script.c24
-rw-r--r--src/map/script.h1
3 files changed, 21 insertions, 6 deletions
diff --git a/src/map/init.c b/src/map/init.c
index 77b19fd..fe4d6d2 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -49,7 +49,7 @@ HPExport void plugin_init (void) {
addScriptCommand("getitemlink", "s", dummyStr);
addScriptCommand("l", "s*", l);
addScriptCommand("getlang", "", getLang);
- addScriptCommand("setlang", "i", dummy);
+ addScriptCommand("setlang", "i", setLang);
addScriptCommand("requestlang", "*", dummy);
addScriptCommand("getq", "i", dummyInt);
addScriptCommand("setq", "ii", dummy);
diff --git a/src/map/script.c b/src/map/script.c
index 8499411..bbc2b52 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -17,20 +17,28 @@
#include "map/session.h"
#include "map/sessionext.h"
-#define getData(def) \
+#define getDataReturn(def) \
if (!st->rid) \
{ \
- script_pushint(st, 0); \
+ script_pushint(st, def); \
return true; \
} \
TBL_PC *sd = script->rid2sd(st); \
if (!sd) \
{ \
- script_pushint(st, 0); \
+ script_pushint(st, def); \
return true; \
} \
struct SessionExt *data = session_get(sd->fd)
+#define getData() \
+ if (!st->rid) \
+ return true; \
+ TBL_PC *sd = script->rid2sd(st); \
+ if (!sd) \
+ return true; \
+ struct SessionExt *data = session_get(sd->fd)
+
BUILDIN(l)
{
// for now not translate and not use format parameters
@@ -40,12 +48,18 @@ BUILDIN(l)
BUILDIN(getClientVersion)
{
- getData(0);
+ getDataReturn(0);
script_pushint(st, data->clientVersion);
}
BUILDIN(getLang)
{
- getData(0);
+ getDataReturn(0);
script_pushint(st, data->language);
}
+
+BUILDIN(setLang)
+{
+ getData();
+ data->language = script_getint(st, 2);
+}
diff --git a/src/map/script.h b/src/map/script.h
index 0febbb4..0d0bbda 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -7,5 +7,6 @@
BUILDIN(l);
BUILDIN(getClientVersion);
BUILDIN(getLang);
+BUILDIN(setLang);
#endif // EVOL_MAP_SCRIPT