[10757] Implement zone limited pets unsummon at leave allowed zones.

* Also remove redundant zone/area args for zone/area update function like UpdateZoneDependentAuras.
* Merge Player::*AllControlledUnits functions to Unit version with replace option args by mask arg.
* Unit::*AllControlledUnits guardian iteration make working with internal unsummon call suport for guardians case.
This commit is contained in:
VladimirMangos 2010-11-20 07:09:39 +03:00
parent 1ef8ea1161
commit b20b3e5ade
7 changed files with 88 additions and 72 deletions

View file

@ -5702,7 +5702,7 @@ struct CombatStopWithPetsHelper
void Unit::CombatStopWithPets(bool includingCast)
{
CombatStop(includingCast);
CallForAllControlledUnits(CombatStopWithPetsHelper(includingCast),false,true,true);
CallForAllControlledUnits(CombatStopWithPetsHelper(includingCast), CONTROLED_PET|CONTROLED_GUARDIANS|CONTROLED_CHARM);
}
struct IsAttackingPlayerHelper
@ -5716,7 +5716,7 @@ bool Unit::isAttackingPlayer() const
if(hasUnitState(UNIT_STAT_ATTACK_PLAYER))
return true;
return CheckAllControlledUnits(IsAttackingPlayerHelper(),true,true,true);
return CheckAllControlledUnits(IsAttackingPlayerHelper(), CONTROLED_PET|CONTROLED_TOTEMS|CONTROLED_GUARDIANS|CONTROLED_CHARM);
}
void Unit::RemoveAllAttackers()
@ -8093,7 +8093,7 @@ struct UpdateWalkModeHelper
void Unit::UpdateWalkMode(Unit* source, bool self)
{
if (GetTypeId() == TYPEID_PLAYER)
((Player*)this)->CallForAllControlledUnits(UpdateWalkModeHelper(source), false, true, true, true);
CallForAllControlledUnits(UpdateWalkModeHelper(source), CONTROLED_PET|CONTROLED_GUARDIANS|CONTROLED_CHARM|CONTROLED_MINIPET);
else if (self)
{
bool on = source->GetTypeId() == TYPEID_PLAYER
@ -8112,7 +8112,7 @@ void Unit::UpdateWalkMode(Unit* source, bool self)
}
}
else
CallForAllControlledUnits(UpdateWalkModeHelper(source), false, true, true);
CallForAllControlledUnits(UpdateWalkModeHelper(source), CONTROLED_PET|CONTROLED_GUARDIANS|CONTROLED_CHARM|CONTROLED_MINIPET);
}
void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
@ -8361,10 +8361,7 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate, bool forced)
SendMessageToSet( &data, true );
}
if (GetTypeId() == TYPEID_PLAYER) // need include minpet
((Player*)this)->CallForAllControlledUnits(SetSpeedRateHelper(mtype,forced),false,true,true,true);
else
CallForAllControlledUnits(SetSpeedRateHelper(mtype,forced),false,true,true);
CallForAllControlledUnits(SetSpeedRateHelper(mtype,forced), CONTROLED_PET|CONTROLED_GUARDIANS|CONTROLED_CHARM|CONTROLED_MINIPET);
}
void Unit::SetHover(bool on)
@ -10514,7 +10511,7 @@ void Unit::SetPvP( bool state )
else
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
CallForAllControlledUnits(SetPvPHelper(state),true,true,true);
CallForAllControlledUnits(SetPvPHelper(state), CONTROLED_PET|CONTROLED_TOTEMS|CONTROLED_GUARDIANS|CONTROLED_CHARM);
}
struct SetFFAPvPHelper
@ -10531,7 +10528,7 @@ void Unit::SetFFAPvP( bool state )
else
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
CallForAllControlledUnits(SetFFAPvPHelper(state),true,true,true);
CallForAllControlledUnits(SetFFAPvPHelper(state), CONTROLED_PET|CONTROLED_TOTEMS|CONTROLED_GUARDIANS|CONTROLED_CHARM);
}
void Unit::KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpeed)
@ -10693,7 +10690,7 @@ void Unit::StopAttackFaction(uint32 faction_id)
getHostileRefManager().deleteReferencesForFaction(faction_id);
CallForAllControlledUnits(StopAttackFactionHelper(faction_id),false,true,true);
CallForAllControlledUnits(StopAttackFactionHelper(faction_id), CONTROLED_PET|CONTROLED_GUARDIANS|CONTROLED_CHARM);
}
void Unit::CleanupDeletedAuras()