diff options
Diffstat (limited to 'src/map/unit.c')
-rw-r--r-- | src/map/unit.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 64885541f..a5bd282a9 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -309,7 +309,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { if (bl->prev == NULL) //Script could have warped char, abort remaining of the function. return 0; } else - sd->areanpc_id=0; + npc->untouch_areanpc(sd, bl->m, x, y); if( sd->md ) { // mercenary should be warped after being 3 seconds too far from the master [greenbox] if( !check_distance_bl(&sd->bl, &sd->md->bl, MAX_MER_DISTANCE) ) { @@ -685,7 +685,7 @@ bool unit_run( struct block_list *bl, struct map_session_data *sd, enum sc_type break; //if sprinting and there's a PC/Mob/NPC, block the path [Kevin] - if( map->count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC, 0) ) + if ( map->count_oncell(bl->m, to_x + dir_x, to_y + dir_y, BL_PC | BL_MOB | BL_NPC, 0x2) ) break; to_x += dir_x; @@ -767,7 +767,7 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool if (bl->prev == NULL) //Script could have warped char, abort remaining of the function. return 0; } else - sd->areanpc_id=0; + npc->untouch_areanpc(sd, bl->m, bl->x, bl->y); if( sd->status.pet_id > 0 && sd->pd && sd->pd->pet.intimate > 0 ) { // Check if pet needs to be teleported. [Skotlex] @@ -867,7 +867,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag) if(map->getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) { npc->touch_areanpc(sd, bl->m, bl->x, bl->y); } else { - sd->areanpc_id = 0; + npc->untouch_areanpc(sd, bl->m, bl->x, bl->y);; } } } @@ -2619,8 +2619,8 @@ int unit_free(struct block_list *bl, clr_type clrtype) { pc->cleareventtimer(sd); pc->inventory_rental_clear(sd); pc->delspiritball(sd,sd->spiritball,1); - for(i = 1; i < 5; i++) - pc->del_charm(sd, sd->charm[i], i); + for(i = SPIRITS_TYPE_CHARM_WATER; i < SPIRITS_TYPE_SPHERE; i++) + pc->del_charm(sd, sd->spiritcharm[i], i); if( sd->st && sd->st->state != RUN ) {// free attached scripts that are waiting script->free_state(sd->st); @@ -2720,6 +2720,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) { } case BL_MOB: { + unsigned int k; struct mob_data *md = (struct mob_data*)bl; if( md->spawn_timer != INVALID_TIMER ) { @@ -2774,6 +2775,15 @@ int unit_free(struct block_list *bl, clr_type clrtype) { mob->clone_delete(md); if( md->tomb_nid ) mob->mvptomb_destroy(md); + + for (k = 0; k < md->hdatac; k++) { + if( md->hdata[k]->flag.free ) { + aFree(md->hdata[k]->data); + } + aFree(md->hdata[k]); + } + if (md->hdata) + aFree(md->hdata); break; } case BL_HOM: |