summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-15 15:58:48 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-15 15:58:48 +0300
commit9e1580014b92a465c874086fde4d64cd69034ba5 (patch)
treeab16573d253833e6745f6c47ad3a0f8d52d43f49 /src/map/script.c
parent3a0174f242798b42b82b196c9c665abc65d323f3 (diff)
downloadplugin-9e1580014b92a465c874086fde4d64cd69034ba5.tar.gz
plugin-9e1580014b92a465c874086fde4d64cd69034ba5.tar.bz2
plugin-9e1580014b92a465c874086fde4d64cd69034ba5.tar.xz
plugin-9e1580014b92a465c874086fde4d64cd69034ba5.zip
Simplify sd usage in scripts.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 7184707..371d17b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -42,6 +42,11 @@
return true; \
struct SessionExt *data = session_get(sd->fd)
+#define getSD() \
+ TBL_PC *sd = script->rid2sd(st); \
+ if (!sd) \
+ return 1
+
BUILDIN(l)
{
// for now not translate and not use format parameters
@@ -69,10 +74,7 @@ BUILDIN(setLang)
BUILDIN(setCamNpc)
{
- TBL_PC *sd = script->rid2sd(st);
- if (!sd)
- return 1;
-
+ getSD();
struct npc_data *nd = NULL;
int x = 0;
@@ -105,10 +107,7 @@ BUILDIN(setCamNpc)
BUILDIN(restoreCam)
{
- TBL_PC *sd = script->rid2sd(st);
- if (!sd)
- return 1;
-
+ getSD();
send_npccommand(sd, st->oid, 3);
return 0;
}