aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2011-09-17 13:20:21 +0200
committerShauren <shauren.trinity@gmail.com>2011-09-17 13:20:21 +0200
commita644e0d951f335121ad13ff3ea1cdb5f8e1825d2 (patch)
treed953e72d5ca55f452bd8fc8994e0e43337f5f936 /src
parent63b62d4ad051d08870550b57d33be258108b319e (diff)
Core/Entities: GameObject's m_unique_users will now store full guids to get rid of silly casts
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp20
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h2
2 files changed, 8 insertions, 14 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index c0bf5865f28..b69478ab0e5 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -527,13 +527,10 @@ void GameObject::Update(uint32 diff)
if (spellId)
{
- std::set<uint32>::const_iterator it = m_unique_users.begin();
- std::set<uint32>::const_iterator end = m_unique_users.end();
- for (; it != end; ++it)
- {
- if (Unit* owner = Unit::GetUnit(*this, uint64(*it)))
+ for (std::set<uint64>::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it)
+ // m_unique_users can contain only player GUIDs
+ if (Player* owner = ObjectAccessor::GetPlayer(*this, *it))
owner->CastSpell(owner, spellId, false);
- }
m_unique_users.clear();
m_usetimes = 0;
@@ -606,7 +603,7 @@ void GameObject::Refresh()
void GameObject::AddUniqueUse(Player* player)
{
AddUse();
- m_unique_users.insert(player->GetGUIDLow());
+ m_unique_users.insert(player->GetGUID());
}
void GameObject::Delete()
@@ -1397,13 +1394,10 @@ void GameObject::Use(Unit* user)
// on the current DB there is only one gameobject that uses this (Ritual of Doom)
// and its required target number is 1 (outter for loop will run once)
if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases
- {
- for (int i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++)
- {
- if (Unit* target = Unit::GetUnit(*this, (uint64)SelectRandomContainerElement(m_unique_users)))
+ for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++)
+ // m_unique_users can contain only player GUIDs
+ if (Player* target = ObjectAccessor::GetPlayer(*this, SelectRandomContainerElement(m_unique_users)))
spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true);
- }
- }
// finish owners spell
if (owner)
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index be4ab451354..ff0cf03c8b8 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -800,7 +800,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
std::list<uint32> m_SkillupList;
Player* m_ritualOwner; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
- std::set<uint32> m_unique_users;
+ std::set<uint64> m_unique_users;
uint32 m_usetimes;
typedef std::map<uint32, uint64> ChairSlotAndUser;