Core/GameObjects: Fix possible crash in GameObject::SetDestructibleState.
This commit is contained in:
@@ -1791,10 +1791,13 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||||||
case GO_DESTRUCTIBLE_DAMAGED:
|
case GO_DESTRUCTIBLE_DAMAGED:
|
||||||
{
|
{
|
||||||
EventInform(m_goInfo->building.damagedEvent);
|
EventInform(m_goInfo->building.damagedEvent);
|
||||||
sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
|
|
||||||
if (eventInvoker)
|
if (eventInvoker)
|
||||||
|
{
|
||||||
|
sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
|
||||||
if (Battleground* bg = eventInvoker->GetBattleground())
|
if (Battleground* bg = eventInvoker->GetBattleground())
|
||||||
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
|
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
|
||||||
|
}
|
||||||
|
|
||||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
|
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
|
||||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
|
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
|
||||||
@@ -1818,10 +1821,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
|||||||
}
|
}
|
||||||
case GO_DESTRUCTIBLE_DESTROYED:
|
case GO_DESTRUCTIBLE_DESTROYED:
|
||||||
{
|
{
|
||||||
sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
|
|
||||||
EventInform(m_goInfo->building.destroyedEvent);
|
EventInform(m_goInfo->building.destroyedEvent);
|
||||||
if (eventInvoker)
|
if (eventInvoker)
|
||||||
{
|
{
|
||||||
|
sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
|
||||||
if (Battleground* bg = eventInvoker->GetBattleground())
|
if (Battleground* bg = eventInvoker->GetBattleground())
|
||||||
{
|
{
|
||||||
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.destroyedEvent);
|
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.destroyedEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user