diff options
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/map/script.c | 73 |
2 files changed, 47 insertions, 28 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 8da1efe3e..6e71bd382 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,8 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2008/04/19 + * Fixed a bug in (init/start/stop)npctimer [Toms] 2008/04/18 * Fixed a bug when unloading a npc near a shop. * Fixed npc_buylist not giving/checking the good item when it was an 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; |