Core/Entities: GameObject's m_unique_users will now store full guids to get rid of silly casts
This commit is contained in:
@@ -527,13 +527,10 @@ void GameObject::Update(uint32 diff)
|
|||||||
|
|
||||||
if (spellId)
|
if (spellId)
|
||||||
{
|
{
|
||||||
std::set<uint32>::const_iterator it = m_unique_users.begin();
|
for (std::set<uint64>::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it)
|
||||||
std::set<uint32>::const_iterator end = m_unique_users.end();
|
// m_unique_users can contain only player GUIDs
|
||||||
for (; it != end; ++it)
|
if (Player* owner = ObjectAccessor::GetPlayer(*this, *it))
|
||||||
{
|
|
||||||
if (Unit* owner = Unit::GetUnit(*this, uint64(*it)))
|
|
||||||
owner->CastSpell(owner, spellId, false);
|
owner->CastSpell(owner, spellId, false);
|
||||||
}
|
|
||||||
|
|
||||||
m_unique_users.clear();
|
m_unique_users.clear();
|
||||||
m_usetimes = 0;
|
m_usetimes = 0;
|
||||||
@@ -606,7 +603,7 @@ void GameObject::Refresh()
|
|||||||
void GameObject::AddUniqueUse(Player* player)
|
void GameObject::AddUniqueUse(Player* player)
|
||||||
{
|
{
|
||||||
AddUse();
|
AddUse();
|
||||||
m_unique_users.insert(player->GetGUIDLow());
|
m_unique_users.insert(player->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObject::Delete()
|
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)
|
// 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)
|
// 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
|
if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases
|
||||||
{
|
for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++)
|
||||||
for (int 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)))
|
||||||
if (Unit* target = Unit::GetUnit(*this, (uint64)SelectRandomContainerElement(m_unique_users)))
|
|
||||||
spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true);
|
spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// finish owners spell
|
// finish owners spell
|
||||||
if (owner)
|
if (owner)
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
|
|||||||
std::list<uint32> m_SkillupList;
|
std::list<uint32> m_SkillupList;
|
||||||
|
|
||||||
Player* m_ritualOwner; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
|
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;
|
uint32 m_usetimes;
|
||||||
|
|
||||||
typedef std::map<uint32, uint64> ChairSlotAndUser;
|
typedef std::map<uint32, uint64> ChairSlotAndUser;
|
||||||
|
|||||||
Reference in New Issue
Block a user