Fix a crash in GameObject::TakenDamage
Fixes issue 2082 --HG-- branch : trunk
This commit is contained in:
@@ -1576,11 +1576,13 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pwho = NULL;
|
Player* pwho = NULL;
|
||||||
if (who && who->GetTypeId() == TYPEID_PLAYER)
|
if (who)
|
||||||
pwho = who->ToPlayer();
|
{
|
||||||
|
if (who->GetTypeId() == TYPEID_PLAYER)
|
||||||
if (who && who->IsVehicle())
|
pwho = who->ToPlayer();
|
||||||
pwho = who->GetCharmerOrOwner()->ToPlayer();
|
else if (who->IsVehicle() && who->GetCharmerOrOwner())
|
||||||
|
pwho = who->GetCharmerOrOwner()->ToPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
if (m_goValue->building.health > damage)
|
if (m_goValue->building.health > damage)
|
||||||
m_goValue->building.health -= damage;
|
m_goValue->building.health -= damage;
|
||||||
|
|||||||
Reference in New Issue
Block a user