Reverts unit_remove_map() static function change

* Reverts unit_remove_map() back to a macro as the preprocessors will point to the static function instead of the calling function.
* Adds third argument to unit_remove_map() macro for changing zone identification.
This commit is contained in:
aleos 2022-05-16 15:24:46 -04:00
parent d637ecd967
commit 5e1fbcbefa
8 changed files with 15 additions and 17 deletions

View File

@ -209,7 +209,7 @@ int elemental_delete(s_elemental_data *ed) {
sd->ed = NULL;
sd->status.ele_id = 0;
return unit_remove_map(&ed->bl, CLR_OUTSIGHT);
return unit_remove_map(&ed->bl, CLR_OUTSIGHT, false);
}
void elemental_summon_init(s_elemental_data *ed) {

View File

@ -313,7 +313,7 @@ int hom_vaporize(struct map_session_data *sd, int flag)
status_change_end(&sd->bl, SC_HOMUN_TIME, INVALID_TIMER);
#endif
return unit_remove_map(&hd->bl, CLR_OUTSIGHT);
return unit_remove_map(&hd->bl, CLR_OUTSIGHT, false);
}
/**
@ -339,7 +339,7 @@ int hom_delete(struct homun_data *hd, int emote)
// Send homunculus_dead to client
hd->homunculus.hp = 0;
clif_hominfo(sd, hd, 0);
return unit_remove_map(&hd->bl,CLR_OUTSIGHT);
return unit_remove_map(&hd->bl,CLR_OUTSIGHT, false);
}
/**
@ -660,7 +660,7 @@ int hom_evolution(struct homun_data *hd)
hom->luk += 10*rnd_value(min->luk, max->luk);
hom->intimacy = battle_config.homunculus_evo_intimacy_reset;
unit_remove_map(&hd->bl, CLR_OUTSIGHT);
unit_remove_map(&hd->bl, CLR_OUTSIGHT, false);
if (map_addblock(&hd->bl))
return 0;
@ -711,7 +711,7 @@ int hom_mutate(struct homun_data *hd, int homun_id)
return 0;
}
unit_remove_map(&hd->bl, CLR_OUTSIGHT);
unit_remove_map(&hd->bl, CLR_OUTSIGHT, false);
if(map_addblock(&hd->bl))
return 0;

View File

@ -291,7 +291,7 @@ int mercenary_delete(s_mercenary_data *md, int reply) {
}
clif_mercenary_message(sd, reply);
return unit_remove_map(&md->bl, CLR_OUTSIGHT);
return unit_remove_map(&md->bl, CLR_OUTSIGHT, false);
}
/**

View File

@ -1116,7 +1116,7 @@ int mob_spawn (struct mob_data *md)
md->last_thinktime = tick;
if (md->bl.prev != NULL)
unit_remove_map(&md->bl,CLR_RESPAWN);
unit_remove_map(&md->bl,CLR_RESPAWN, false);
else
if (md->spawn && md->mob_id != md->spawn->id)
{
@ -6462,7 +6462,7 @@ void mob_reload_itemmob_data(void) {
static int mob_reload_sub( struct mob_data *md, va_list args ){
// Slaves have to be killed
if( md->master_id != 0 ){
unit_remove_map( &md->bl, CLR_OUTSIGHT );
unit_remove_map( &md->bl, CLR_OUTSIGHT, false);
return 0;
}
@ -6475,7 +6475,7 @@ static int mob_reload_sub( struct mob_data *md, va_list args ){
ShowDebug( "mob_reload_sub: The monster was removed from map %s (%hu/%hu).\n", map_mapid2mapname( md->bl.m ), md->bl.x, md->bl.y );
}
unit_remove_map( &md->bl, CLR_OUTSIGHT );
unit_remove_map( &md->bl, CLR_OUTSIGHT, false);
return 0;
}

View File

@ -1315,7 +1315,7 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
if(rnd()%10000 < pet_catch_rate) {
achievement_update_objective(sd, AG_TAMING, 1, md->mob_id);
unit_remove_map(&md->bl,CLR_OUTSIGHT);
unit_remove_map(&md->bl,CLR_OUTSIGHT, false);
status_kill(&md->bl);
clif_pet_roulette(sd,1);
@ -2298,7 +2298,7 @@ void pet_evolution(struct map_session_data *sd, int16 pet_id) {
clif_additem(sd, idx, 1, 0);
// Remove the old pet from sight
unit_remove_map(&sd->pd->bl, CLR_OUTSIGHT);
unit_remove_map(&sd->pd->bl, CLR_OUTSIGHT, false);
// Prepare the new pet
sd->pd->pet.class_ = pet_id;

View File

@ -1157,7 +1157,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 dhp, in
if(flag&4) // Delete from memory. (also invokes map removal code)
unit_free(target,CLR_DEAD);
else if(flag&2) // remove from map
unit_remove_map(target,CLR_DEAD);
unit_remove_map(target,CLR_DEAD, false);
else { // Some death states that would normally be handled by unit_remove_map
unit_stop_attack(target);
unit_stop_walking(target,1);

View File

@ -1318,7 +1318,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
if (bl->type == BL_PC) // Use pc_setpos
return pc_setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
if (!unit_remove_map(bl, type))
if (!unit_remove_map(bl, type, false))
return 3;
if (bl->m != m && battle_config.clear_unit_onwarp &&
@ -3359,7 +3359,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
map_freeblock_lock();
if( bl->prev ) // Players are supposed to logout with a "warp" effect.
unit_remove_map(bl, clrtype);
unit_remove_map(bl, clrtype, false);
switch( bl->type ) {
case BL_PC: {

View File

@ -165,10 +165,8 @@ struct unit_data* unit_bl2ud(struct block_list *bl);
void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype, bool changeZone = false);
void unit_refresh(struct block_list *bl, bool walking = false);
void unit_free_pc(struct map_session_data *sd);
#define unit_remove_map(bl,clrtype,changeZone) unit_remove_map_(bl,clrtype,__FILE__,__LINE__,__func__,changeZone)
int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func, bool changeZone = false);
static int unit_remove_map(block_list *bl, clr_type clrtype, bool changeZone = false) {
return unit_remove_map_(bl, clrtype, __FILE__, __LINE__, __func__, changeZone);
}
int unit_free(struct block_list *bl, clr_type clrtype);
int unit_changeviewsize(struct block_list *bl,short size);
int unit_changetarget(struct block_list *bl,va_list ap);