Core/GameObjects: Fix crash with Summoning Ritual GOs

Fix a crash happening with GAMEOBJECT_TYPE_SUMMONING_RITUAL GameObjects if a Player clicked on the GO, logged out and let another Player click on it.
Issue added in 464c0c1611
Fixes #11856
This commit is contained in:
jackpoz committed 2014-04-10 20:41:34 +02:00
1 parent 335fe8e1b0
commit 7b9b0edb5d
2 files changed
+10 -3

No files matched your search

@@ -52,7 +52,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
m_spellId = 0;
m_cooldownTime = 0;
m_goInfo = NULL;
m_ritualOwner = NULL;
m_ritualOwnerGUID = 0;
m_goData = NULL;
m_DBTableGuid = 0;
@@ -1444,9 +1444,16 @@ void GameObject::Use(Unit* user)
GameObjectTemplate const* info = GetGOInfo();
Player* m_ritualOwner = NULL;
if (m_ritualOwnerGUID)
m_ritualOwner = ObjectAccessor::FindPlayer(m_ritualOwnerGUID);
// ritual owner is set for GO's without owner (not summoned)
if (!m_ritualOwner && !owner)
{
m_ritualOwnerGUID = player->GetGUID();
m_ritualOwner = player;
}
if (owner)
{
@@ -1517,7 +1524,7 @@ void GameObject::Use(Unit* user)
else
{
// reset ritual for this GO
m_ritualOwner = NULL;
m_ritualOwnerGUID = 0;
m_unique_users.clear();
m_usetimes = 0;
}
@@ -846,7 +846,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
// For traps this: spell casting cooldown, for doors/buttons: reset time.
std::list<uint32> m_SkillupList;
Player* m_ritualOwner; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
uint64 m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
std::set<uint64> m_unique_users;
uint32 m_usetimes;