summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-05-31 07:23:43 +0000
committerLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-05-31 07:23:43 +0000
commit7ae67febba40a9729b4e3e6253e2da434a231965 (patch)
tree938ac36b0ed73b7e8595581f292590f72b84f5ce /src/map
parentfbc374b7516c2879f2f7653c33ffc09be9416805 (diff)
downloadhercules-7ae67febba40a9729b4e3e6253e2da434a231965.tar.gz
hercules-7ae67febba40a9729b4e3e6253e2da434a231965.tar.bz2
hercules-7ae67febba40a9729b4e3e6253e2da434a231965.tar.xz
hercules-7ae67febba40a9729b4e3e6253e2da434a231965.zip
crashfix to attach/detach timers
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12748 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/map/script.c b/src/map/script.c
index ebe02db0f..423cb4983 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7768,7 +7768,7 @@ BUILDIN_FUNC(getnpctimer)
if (!nd || nd->bl.type != BL_NPC)
{
script_pushint(st,0);
- ShowError("getnpctimer: Invalid NPC\n");
+ ShowError("getnpctimer: Invalid NPC.\n");
return 1;
}
@@ -7803,7 +7803,15 @@ BUILDIN_FUNC(setnpctimer)
else
nd=(struct npc_data *)map_id2bl(st->oid);
+ if (!nd || nd->bl.type != BL_NPC)
+ {
+ script_pushint(st,1);
+ ShowError("setnpctimer: Invalid NPC.\n");
+ return 1;
+ }
+
npc_settimerevent_tick(nd,tick);
+ script_pushint(st,0);
return 0;
}
@@ -7816,15 +7824,28 @@ BUILDIN_FUNC(attachnpctimer)
struct npc_data *nd;
nd=(struct npc_data *)map_id2bl(st->oid);
+
+ if (!nd || nd->bl.type != BL_NPC)
+ {
+ script_pushint(st,1);
+ ShowError("setnpctimer: Invalid NPC.\n");
+ return 1;
+ }
+
if( script_hasdata(st,2) )
sd=map_nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
- if (sd==NULL)
- return 0;
+ if (!sd)
+ {
+ script_pushint(st,1);
+ ShowWarning("attachnpctimer: Invalid player.\n");
+ return 1;
+ }
nd->u.scr.rid = sd->bl.id;
+ script_pushint(st,0);
return 0;
}
@@ -7839,7 +7860,15 @@ BUILDIN_FUNC(detachnpctimer)
else
nd=(struct npc_data *)map_id2bl(st->oid);
+ if (!nd || nd->bl.type != BL_NPC)
+ {
+ script_pushint(st,1);
+ ShowError("detachnpctimer: Invalid NPC.\n");
+ return 1;
+ }
+
nd->u.scr.rid = 0;
+ script_pushint(st,0);
return 0;
}