diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-10-22 00:35:00 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-10-22 00:35:00 +0200 |
| commit | e7d9830a06aa23c49b93053c4debb98d1bbcea69 (patch) | |
| tree | 216e91793e259fe6d50f9304bf58e277c45e0a15 /src/server/game/Entities/GameObject | |
| parent | 7ae708acf57899721d77e4d09e1636281582f8e7 (diff) | |
Core/Groups: Use full guid for group lookup
Diffstat (limited to 'src/server/game/Entities/GameObject')
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 15 | ||||
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.h | 6 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 5d035286c25..947b4e81b04 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -57,9 +57,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(), m_DBTableGuid = 0; m_rotation = 0; - m_lootRecipientGroup = 0; m_groupLootTimer = 0; - lootingGroupLowGUID = 0; ResetLootMode(); // restore default loot mode m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); @@ -560,13 +558,14 @@ void GameObject::Update(uint32 diff) { if (m_groupLootTimer <= diff) { - Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID); - if (group) + if (Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID)) group->EndRoll(&loot); + m_groupLootTimer = 0; - lootingGroupLowGUID = 0; + lootingGroupLowGUID.Clear(); } - else m_groupLootTimer -= diff; + else + m_groupLootTimer -= diff; } break; case GAMEOBJECT_TYPE_TRAP: @@ -2204,7 +2203,7 @@ void GameObject::SetLootRecipient(Unit* unit) if (!unit) { m_lootRecipient.Clear(); - m_lootRecipientGroup = 0; + m_lootRecipientGroup.Clear(); return; } @@ -2217,7 +2216,7 @@ void GameObject::SetLootRecipient(Unit* unit) m_lootRecipient = player->GetGUID(); if (Group* group = player->GetGroup()) - m_lootRecipientGroup = group->GetLowGUID(); + m_lootRecipientGroup = group->GetGUID(); } bool GameObject::IsLootAllowedFor(Player const* player) const diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 4eeb3ae2b31..adb25d1854f 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -780,9 +780,9 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map Group* GetLootRecipientGroup() const; void SetLootRecipient(Unit* unit); bool IsLootAllowedFor(Player const* player) const; - bool HasLootRecipient() const { return !m_lootRecipient.IsEmpty() || m_lootRecipientGroup; } + bool HasLootRecipient() const { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); } uint32 m_groupLootTimer; // (msecs)timer used for group loot - uint32 lootingGroupLowGUID; // used to find group which is looting + ObjectGuid lootingGroupLowGUID; // used to find group which is looting bool hasQuest(uint32 quest_id) const override; bool hasInvolvedQuest(uint32 quest_id) const override; @@ -881,7 +881,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map Position m_stationaryPosition; ObjectGuid m_lootRecipient; - uint32 m_lootRecipientGroup; + ObjectGuid m_lootRecipientGroup; uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable private: void RemoveFromOwner(); |
