*Fix a bug that pvp flag is not cleared after unit is uncharmed.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-09-04 09:33:46 -05:00
parent 8c255266e7
commit 370be1de8e

View File

@@ -8732,6 +8732,9 @@ void Unit::SetCharm(Unit* charm, bool apply)
sLog.outCrash("Player %s is trying to uncharm unit %u, but it has another charmed unit %u", GetName(), charm->GetEntry(), GetCharmGUID());
}
if(!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
sLog.outCrash("Unit %u is being uncharmed, but it has another charmer %u", charm->GetEntry(), charm->GetCharmerGUID());
if(charm->GetTypeId() == TYPEID_PLAYER)
{
charm->m_ControlledByPlayer = true;
@@ -8751,9 +8754,6 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
}
if(!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
sLog.outCrash("Unit %u is being uncharmed, but it has another charmer %u", charm->GetEntry(), charm->GetCharmerGUID());
if(charm->GetTypeId() == TYPEID_PLAYER
|| !((Creature*)charm)->HasUnitTypeMask(UNIT_MASK_MINION)
|| charm->GetOwnerGUID() != GetGUID())