From 50418d820226fbcdf7609fb619028e3b75a2fa9e Mon Sep 17 00:00:00 2001 From: ultramage Date: Thu, 3 Jan 2008 20:56:20 +0000 Subject: Moved extra junk from map_addblock/map_delblock to where it logically belongs (loadendack/unit_remove_map), removed flags and _sub macros git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12002 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/unit.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'src/map/unit.c') diff --git a/src/map/unit.c b/src/map/unit.c index c8ae55bc3..b1ee72a2f 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1652,7 +1652,10 @@ int unit_remove_map(struct block_list *bl, int clrtype) skill_cleartimerskill(bl); // タイマースキルクリア } - if(bl->type == BL_PC) { + switch( bl->type ) + { + case BL_PC: + { struct map_session_data *sd = (struct map_session_data*)bl; //Leave/reject all invitations. @@ -1695,28 +1698,41 @@ int unit_remove_map(struct block_list *bl, int clrtype) } party_send_dot_remove(sd);//minimap dot fix [Kevin] guild_send_dot_remove(sd); - } else if(bl->type == BL_MOB) { + + if (--map[bl->m].users == 0 && battle_config.dynamic_mobs) //[Skotlex] + map_removemobs(bl->m); + + break; + } + case BL_MOB: + { struct mob_data *md = (struct mob_data*)bl; md->target_id=0; md->attacked_id=0; md->state.skillstate= MSS_IDLE; - } else if (bl->type == BL_PET) { + + break; + } + case BL_PET: + { struct pet_data *pd = (struct pet_data*)bl; - if(pd->pet.intimate <= 0 && - !(pd->msd && pd->msd->state.waitingdisconnect) - ) { //If logging out, this is deleted on unit_free + if( pd->pet.intimate <= 0 && !(pd->msd && pd->msd->state.waitingdisconnect) ) + { //If logging out, this is deleted on unit_free clif_clearunit_area(bl,clrtype); map_delblock(bl); unit_free(bl,0); map_freeblock_unlock(); return 0; } - } else if (bl->type == BL_HOM) { + + break; + } + case BL_HOM: + { struct homun_data *hd = (struct homun_data *) bl; ud->canact_tick = ud->canmove_tick; //It appears HOM do reset the can-act tick. - if(!hd->homunculus.intimacy && - !(hd->master && hd->master->state.waitingdisconnect) - ) { //If logging out, this is deleted on unit_free + if(!hd->homunculus.intimacy && !(hd->master && hd->master->state.waitingdisconnect) ) + { //If logging out, this is deleted on unit_free clif_emotion(bl, 28) ; //sob clif_clearunit_area(bl,clrtype); map_delblock(bl); @@ -1724,7 +1740,12 @@ int unit_remove_map(struct block_list *bl, int clrtype) map_freeblock_unlock(); return 0; } + + break; } + default: ;// do nothing + } + clif_clearunit_area(bl,clrtype); map_delblock(bl); map_freeblock_unlock(); -- cgit v1.2.3-60-g2f50