From 729424c1ebb6762f49b85c97d56dabb5975958a1 Mon Sep 17 00:00:00 2001 From: Lance Date: Fri, 17 Mar 2006 06:39:58 +0000 Subject: * Final fix on Juperos NPC. * Fix on initnpctimer not attaching rid. * Fix on OnTouch ignoring -1 NPCs. * Fix on @reloadscript crashing due to passing non BL_SKILL bl to a function that accepts only BL_SKILL bl. * Added area NPC detection in clif_parseLoadEndAck. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5638 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 6 ++++++ src/map/map.c | 2 +- src/map/npc.c | 4 +++- src/map/script.c | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 13e936f18..556a48f8d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8846,6 +8846,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_status_load(&sd->bl, SI_DEVIL, 1); //blindness [Komurka] map_foreachinarea(clif_getareachar,sd->bl.m,sd->bl.x-AREA_SIZE,sd->bl.y-AREA_SIZE,sd->bl.x+AREA_SIZE,sd->bl.y+AREA_SIZE,BL_ALL,sd); + + // For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first) + if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) + npc_touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + sd->areanpc_id = 0; } /*========================================== diff --git a/src/map/map.c b/src/map/map.c index ef67616c4..92bddc3c5 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1279,7 +1279,7 @@ void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) { for(i=2;i<=last_object_id;i++){ if(objects[i]){ - if(!(objects[i]->type&type)) + if(!(objects[i]->type==type)) // Fixed [Lance] continue; if(bl_list_count>=BL_LIST_MAX) { if(battle_config.error_log) diff --git a/src/map/npc.c b/src/map/npc.c index 1fc99de95..4e6842b97 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -777,6 +777,7 @@ int npc_settimerevent_tick(struct npc_data *nd,int newtimer) flag= sd->npc_timer_id != -1 ; } else flag= nd->u.scr.timerid != -1 ; + if(flag) npc_timerevent_stop(nd); nd->u.scr.timer=newtimer; @@ -1556,6 +1557,7 @@ int npc_unload (struct npc_data *nd) } } } + aFree(nd); return 0; @@ -2033,7 +2035,7 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin if (xs >= 0) xs = xs * 2 + 1; if (ys >= 0) ys = ys * 2 + 1; - if (class_ >= 0) { + if (class_ >= -1) { // -1 NPCs use OnTouch [Lance] for (i = 0; i < ys; i++) { for (j = 0; j < xs; j++) { if (map_getcell(m, x - xs/2 + j, y - ys/2 + i, CELL_CHKNOPASS)) diff --git a/src/map/script.c b/src/map/script.c index 7de21a76f..4eeea13cb 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5659,6 +5659,7 @@ int buildin_initnpctimer(struct script_state *st) else nd=(struct npc_data *)map_id2bl(st->oid); + nd->u.scr.rid = st->rid; npc_settimerevent_tick(nd,0); npc_timerevent_start(nd, st->rid); return 0; -- cgit v1.2.3-60-g2f50