Merge pull request #102 from H0zen/develop21
Fix crash on taming rare creatures.
This commit is contained in:
commit
f05f21a631
@ -218,14 +218,16 @@ void Creature::RemoveFromWorld()
|
|||||||
Unit::RemoveFromWorld();
|
Unit::RemoveFromWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::RemoveCorpse()
|
void Creature::RemoveCorpse(bool inPlace)
|
||||||
{
|
{
|
||||||
// since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless
|
if (!inPlace)
|
||||||
if (uint16 poolid = sPoolMgr.IsPartOfAPool<Creature>(GetGUIDLow()))
|
{
|
||||||
{ sPoolMgr.UpdatePool<Creature>(*GetMap()->GetPersistentState(), poolid, GetGUIDLow()); }
|
// since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless
|
||||||
|
if (uint16 poolid = sPoolMgr.IsPartOfAPool<Creature>(GetGUIDLow()))
|
||||||
if (!IsInWorld()) // can be despawned by update pool
|
{ sPoolMgr.UpdatePool<Creature>(*GetMap()->GetPersistentState(), poolid, GetGUIDLow()); }
|
||||||
{ return; }
|
if (!IsInWorld()) // can be despawned by update pool
|
||||||
|
{ return; }
|
||||||
|
}
|
||||||
|
|
||||||
if ((GetDeathState() != CORPSE && !m_IsDeadByDefault) || (GetDeathState() != ALIVE && m_IsDeadByDefault))
|
if ((GetDeathState() != CORPSE && !m_IsDeadByDefault) || (GetDeathState() != ALIVE && m_IsDeadByDefault))
|
||||||
{ return; }
|
{ return; }
|
||||||
@ -1711,7 +1713,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
|
|||||||
if (IsAlive())
|
if (IsAlive())
|
||||||
{ SetDeathState(JUST_DIED); }
|
{ SetDeathState(JUST_DIED); }
|
||||||
|
|
||||||
RemoveCorpse();
|
RemoveCorpse(true); // force corpse removal in the same grid
|
||||||
|
|
||||||
SetHealth(0); // just for nice GM-mode view
|
SetHealth(0); // just for nice GM-mode view
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ class Creature : public Unit
|
|||||||
|
|
||||||
bool IsVisibleInGridForPlayer(Player* pl) const override;
|
bool IsVisibleInGridForPlayer(Player* pl) const override;
|
||||||
|
|
||||||
void RemoveCorpse();
|
void RemoveCorpse(bool inPlace = false);
|
||||||
bool IsDeadByDefault() const { return m_IsDeadByDefault; };
|
bool IsDeadByDefault() const { return m_IsDeadByDefault; };
|
||||||
|
|
||||||
void ForcedDespawn(uint32 timeMSToDespawn = 0);
|
void ForcedDespawn(uint32 timeMSToDespawn = 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user