summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-19 15:37:18 +0000
committertoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-19 15:37:18 +0000
commitbb1c5108521509282b53460338d9c6f309018d50 (patch)
tree460f3d3cc0268d5033f3639b2fc2c8887dd99944 /src
parent3b6d997be930fd60c3e1f519f44b83aa1acbbca9 (diff)
downloadhercules-bb1c5108521509282b53460338d9c6f309018d50.tar.gz
hercules-bb1c5108521509282b53460338d9c6f309018d50.tar.bz2
hercules-bb1c5108521509282b53460338d9c6f309018d50.tar.xz
hercules-bb1c5108521509282b53460338d9c6f309018d50.zip
Fixed a bug in (init/start/stop)npctimer
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12619 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c73
1 files changed, 45 insertions, 28 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 8af56aaa8..44cf4e37b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7605,26 +7605,32 @@ BUILDIN_FUNC(initnpctimer)
{ //Two arguments: NPC name and attach flag.
nd = npc_name2id(script_getstr(st, 2));
flag = script_getnum(st,3);
- } else
- if( script_hasdata(st,2) )
+ }
+ else if( script_hasdata(st,2) )
{ //Check if argument is numeric (flag) or string (npc name)
struct script_data *data;
data = script_getdata(st,2);
get_val(st,data);
if( data_isstring(data) ) //NPC name
- nd = npc_name2id(script_getstr(st, 2));
- else if( data_isint(data) ) { //Flag
+ nd = npc_name2id(conv_str(st, data));
+ else if( data_isint(data) ) //Flag
+ {
nd = (struct npc_data *)map_id2bl(st->oid);
- flag = script_getnum(st,3);
- } else {
+ flag = conv_num(st,data);
+ }
+ else
+ {
ShowError("initnpctimer: invalid argument type #1 (needs be int or string)).\n");
return 1;
}
- } else
+ }
+ else
nd=(struct npc_data *)map_id2bl(st->oid);
- if (!nd) return 0;
- if (flag) { //Attach
+ if (!nd)
+ return 0;
+ if (flag) //Attach
+ {
TBL_PC* sd = script_rid2sd(st);
if( sd == NULL )
return 0;
@@ -7646,26 +7652,32 @@ BUILDIN_FUNC(startnpctimer)
{ //Two arguments: NPC name and attach flag.
nd = npc_name2id(script_getstr(st, 2));
flag = script_getnum(st,3);
- } else
- if( script_hasdata(st,2) )
+ }
+ else if( script_hasdata(st,2) )
{ //Check if argument is numeric (flag) or string (npc name)
struct script_data *data;
data = script_getdata(st,2);
get_val(st,data);
if( data_isstring(data) ) //NPC name
- nd = npc_name2id(script_getstr(st, 2));
- else if( data_isint(data) ) { //Flag
+ nd = npc_name2id(conv_str(st, data));
+ else if( data_isint(data) ) //Flag
+ {
nd = (struct npc_data *)map_id2bl(st->oid);
- flag = script_getnum(st,3);
- } else {
- ShowError("startnpctimer: invalid argument type #1 (needs be int or string)).\n");
+ flag = conv_num(st,data);
+ }
+ else
+ {
+ ShowError("initnpctimer: invalid argument type #1 (needs be int or string)).\n");
return 1;
}
- } else
+ }
+ else
nd=(struct npc_data *)map_id2bl(st->oid);
- if (!nd) return 0;
- if (flag) { //Attach
+ if (!nd)
+ return 0;
+ if (flag) //Attach
+ {
TBL_PC* sd = script_rid2sd(st);
if( sd == NULL )
return 0;
@@ -7686,25 +7698,30 @@ BUILDIN_FUNC(stopnpctimer)
{ //Two arguments: NPC name and attach flag.
nd = npc_name2id(script_getstr(st, 2));
flag = script_getnum(st,3);
- } else
- if( script_hasdata(st,2) )
+ }
+ else if( script_hasdata(st,2) )
{ //Check if argument is numeric (flag) or string (npc name)
struct script_data *data;
data = script_getdata(st,2);
get_val(st,data);
if( data_isstring(data) ) //NPC name
- nd = npc_name2id(script_getstr(st, 2));
- else if( data_isint(data) ) { //Flag
+ nd = npc_name2id(conv_str(st, data));
+ else if( data_isint(data) ) //Flag
+ {
nd = (struct npc_data *)map_id2bl(st->oid);
- flag = script_getnum(st,3);
- } else {
- ShowError("stopnpctimer: invalid argument type #1 (needs be int or string)).\n");
+ flag = conv_num(st,data);
+ }
+ else
+ {
+ ShowError("initnpctimer: invalid argument type #1 (needs be int or string)).\n");
return 1;
}
- } else
+ }
+ else
nd=(struct npc_data *)map_id2bl(st->oid);
- if (!nd) return 0;
+ if (!nd)
+ return 0;
if (flag) //Detach
nd->u.scr.rid = 0;