Core/Transports: Fixed crash happening during teleporting transports

Closes #11793
This commit is contained in:
Shauren
2014-06-13 11:16:17 +02:00
parent c75b7942a8
commit 5804372042
12 changed files with 71 additions and 98 deletions
@@ -98,20 +98,12 @@ std::string GameObject::GetAIName() const
return "";
}
void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
void GameObject::CleanupsBeforeDelete(bool finalCleanup)
{
if (IsInWorld())
RemoveFromWorld();
WorldObject::CleanupsBeforeDelete(finalCleanup);
if (m_uint32Values) // field array can be not exist if GameOBject not loaded
RemoveFromOwner();
if (GetTransport() && !ToTransport())
{
GetTransport()->RemovePassenger(this);
SetTransport(NULL);
m_movementInfo.transport.Reset();
}
}
void GameObject::RemoveFromOwner()
@@ -705,7 +697,7 @@ void GameObject::getFishLoot(Loot* fishloot, Player* loot_owner)
{
//subzone no result,use zone loot
fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true);
//use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks.
//use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks.
if (fishloot->empty())
fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true);
}