mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11330] Use ObjectGuid to store Totem guids instead of uint64 and fix related rare crash.
Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
parent
735f086992
commit
cd32dd9bfc
5 changed files with 9 additions and 15 deletions
|
|
@ -102,9 +102,6 @@ class MANGOS_DLL_SPEC ObjectGuid
|
||||||
void Set(uint64 const& guid) { m_guid = guid; }
|
void Set(uint64 const& guid) { m_guid = guid; }
|
||||||
void Clear() { m_guid = 0; }
|
void Clear() { m_guid = 0; }
|
||||||
|
|
||||||
// Possible removed in future for more strict control type conversions
|
|
||||||
void operator= (uint64 const& guid) { m_guid = guid; }
|
|
||||||
|
|
||||||
PackedGuid WriteAsPacked() const;
|
PackedGuid WriteAsPacked() const;
|
||||||
public: // accessors
|
public: // accessors
|
||||||
uint64 const& GetRawValue() const { return m_guid; }
|
uint64 const& GetRawValue() const { return m_guid; }
|
||||||
|
|
|
||||||
|
|
@ -5012,7 +5012,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellIconID == 33)
|
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellIconID == 33)
|
||||||
{
|
{
|
||||||
// fire totems slot
|
// fire totems slot
|
||||||
if (!m_caster->GetTotemGUID(TOTEM_SLOT_FIRE))
|
if (m_caster->GetTotemGuid(TOTEM_SLOT_FIRE).IsEmpty())
|
||||||
return SPELL_FAILED_TOTEMS;
|
return SPELL_FAILED_TOTEMS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -207,9 +207,6 @@ Unit::Unit()
|
||||||
|
|
||||||
m_addDmgOnce = 0;
|
m_addDmgOnce = 0;
|
||||||
|
|
||||||
for(int i = 0; i < MAX_TOTEM_SLOT; ++i)
|
|
||||||
m_TotemSlot[i] = 0;
|
|
||||||
|
|
||||||
m_ObjectSlot[0] = m_ObjectSlot[1] = m_ObjectSlot[2] = m_ObjectSlot[3] = 0;
|
m_ObjectSlot[0] = m_ObjectSlot[1] = m_ObjectSlot[2] = m_ObjectSlot[3] = 0;
|
||||||
//m_Aura = NULL;
|
//m_Aura = NULL;
|
||||||
//m_AurasCheck = 2000;
|
//m_AurasCheck = 2000;
|
||||||
|
|
@ -6005,7 +6002,7 @@ Unit* Unit::_GetTotem(TotemSlot slot) const
|
||||||
|
|
||||||
Totem* Unit::GetTotem(TotemSlot slot ) const
|
Totem* Unit::GetTotem(TotemSlot slot ) const
|
||||||
{
|
{
|
||||||
if(slot >= MAX_TOTEM_SLOT || !IsInWorld())
|
if(slot >= MAX_TOTEM_SLOT || !IsInWorld() || m_TotemSlot[slot].IsEmpty())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]);
|
Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]);
|
||||||
|
|
@ -6015,23 +6012,23 @@ Totem* Unit::GetTotem(TotemSlot slot ) const
|
||||||
bool Unit::IsAllTotemSlotsUsed() const
|
bool Unit::IsAllTotemSlotsUsed() const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_TOTEM_SLOT; ++i)
|
for (int i = 0; i < MAX_TOTEM_SLOT; ++i)
|
||||||
if (!m_TotemSlot[i])
|
if (m_TotemSlot[i].IsEmpty())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::_AddTotem(TotemSlot slot, Totem* totem)
|
void Unit::_AddTotem(TotemSlot slot, Totem* totem)
|
||||||
{
|
{
|
||||||
m_TotemSlot[slot] = totem->GetGUID();
|
m_TotemSlot[slot] = totem->GetObjectGuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::_RemoveTotem(Totem* totem)
|
void Unit::_RemoveTotem(Totem* totem)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < MAX_TOTEM_SLOT; ++i)
|
for(int i = 0; i < MAX_TOTEM_SLOT; ++i)
|
||||||
{
|
{
|
||||||
if (m_TotemSlot[i] == totem->GetGUID())
|
if (m_TotemSlot[i] == totem->GetObjectGuid())
|
||||||
{
|
{
|
||||||
m_TotemSlot[i] = 0;
|
m_TotemSlot[i].Clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1552,7 +1552,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
CharmInfo* GetCharmInfo() { return m_charmInfo; }
|
CharmInfo* GetCharmInfo() { return m_charmInfo; }
|
||||||
CharmInfo* InitCharmInfo(Unit* charm);
|
CharmInfo* InitCharmInfo(Unit* charm);
|
||||||
|
|
||||||
uint64 const& GetTotemGUID(TotemSlot slot) const { return m_TotemSlot[slot]; }
|
ObjectGuid const& GetTotemGuid(TotemSlot slot) const { return m_TotemSlot[slot]; }
|
||||||
Totem* GetTotem(TotemSlot slot) const;
|
Totem* GetTotem(TotemSlot slot) const;
|
||||||
bool IsAllTotemSlotsUsed() const;
|
bool IsAllTotemSlotsUsed() const;
|
||||||
|
|
||||||
|
|
@ -2041,7 +2041,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
|
|
||||||
GuardianPetList m_guardianPets;
|
GuardianPetList m_guardianPets;
|
||||||
|
|
||||||
uint64 m_TotemSlot[MAX_TOTEM_SLOT];
|
ObjectGuid m_TotemSlot[MAX_TOTEM_SLOT];
|
||||||
|
|
||||||
private: // Error traps for some wrong args using
|
private: // Error traps for some wrong args using
|
||||||
// this will catch and prevent build for any cases when all optional args skipped and instead triggered used non boolean type
|
// this will catch and prevent build for any cases when all optional args skipped and instead triggered used non boolean type
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11329"
|
#define REVISION_NR "11330"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue