* fix(Core/Entities): crash fix cause by a pointer change in #19622 * fix blank space for codestyle check
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PetAI.h"
|
#include "PetAI.h"
|
||||||
|
#include "CharmInfo.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include "ArenaSpectator.h"
|
#include "ArenaSpectator.h"
|
||||||
|
#include "CharmInfo.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "DatabaseEnv.h"
|
#include "DatabaseEnv.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "ArenaTeam.h"
|
#include "ArenaTeam.h"
|
||||||
#include "Battleground.h"
|
#include "Battleground.h"
|
||||||
|
#include "CharmInfo.h"
|
||||||
#include "CharacterCache.h"
|
#include "CharacterCache.h"
|
||||||
#include "CinematicMgr.h"
|
#include "CinematicMgr.h"
|
||||||
#include "DBCStores.h"
|
#include "DBCStores.h"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "CharmInfo.h"
|
#include "CharmInfo.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
|
#include "GameTime.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
@@ -390,3 +391,21 @@ bool CharmInfo::IsReturning()
|
|||||||
{
|
{
|
||||||
return _isReturning;
|
return _isReturning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Methods of class GlobalCooldownMgr
|
||||||
|
bool GlobalCooldownMgr::HasGlobalCooldown(SpellInfo const* spellInfo) const
|
||||||
|
{
|
||||||
|
GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
|
||||||
|
return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, GameTime::GetGameTimeMS().count()) < itr->second.duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlobalCooldownMgr::AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd)
|
||||||
|
{
|
||||||
|
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, GameTime::GetGameTimeMS().count());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlobalCooldownMgr::CancelGlobalCooldown(SpellInfo const* spellInfo)
|
||||||
|
{
|
||||||
|
m_GlobalCooldowns[spellInfo->StartRecoveryCategory].duration = 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,6 +65,30 @@ enum ActiveStates : uint8
|
|||||||
ACT_DECIDE = 0x00 // custom
|
ACT_DECIDE = 0x00 // custom
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct GlobalCooldown
|
||||||
|
{
|
||||||
|
explicit GlobalCooldown(uint32 _dur = 0, uint32 _time = 0) : duration(_dur), cast_time(_time) {}
|
||||||
|
|
||||||
|
uint32 duration;
|
||||||
|
uint32 cast_time;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::unordered_map<uint32 /*category*/, GlobalCooldown> GlobalCooldownList;
|
||||||
|
|
||||||
|
class GlobalCooldownMgr // Shared by Player and CharmInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GlobalCooldownMgr() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool HasGlobalCooldown(SpellInfo const* spellInfo) const;
|
||||||
|
void AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd);
|
||||||
|
void CancelGlobalCooldown(SpellInfo const* spellInfo);
|
||||||
|
|
||||||
|
private:
|
||||||
|
GlobalCooldownList m_GlobalCooldowns;
|
||||||
|
};
|
||||||
|
|
||||||
struct UnitActionBarEntry
|
struct UnitActionBarEntry
|
||||||
{
|
{
|
||||||
UnitActionBarEntry() : packedData(uint32(ACT_DISABLED) << 24) {}
|
UnitActionBarEntry() : packedData(uint32(ACT_DISABLED) << 24) {}
|
||||||
@@ -131,7 +155,7 @@ public:
|
|||||||
|
|
||||||
CharmSpellInfo* GetCharmSpell(uint8 index) { return &(_charmspells[index]); }
|
CharmSpellInfo* GetCharmSpell(uint8 index) { return &(_charmspells[index]); }
|
||||||
|
|
||||||
GlobalCooldownMgr& GetGlobalCooldownMgr() { return *_GlobalCooldownMgr; }
|
GlobalCooldownMgr& GetGlobalCooldownMgr() { return _GlobalCooldownMgr; }
|
||||||
|
|
||||||
void SetIsCommandAttack(bool val);
|
void SetIsCommandAttack(bool val);
|
||||||
bool IsCommandAttack();
|
bool IsCommandAttack();
|
||||||
@@ -178,7 +202,7 @@ private:
|
|||||||
float _stayY;
|
float _stayY;
|
||||||
float _stayZ;
|
float _stayZ;
|
||||||
|
|
||||||
std::unique_ptr<GlobalCooldownMgr> _GlobalCooldownMgr;
|
GlobalCooldownMgr _GlobalCooldownMgr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _CHARMINFO_H
|
#endif // _CHARMINFO_H
|
||||||
|
|||||||
@@ -334,24 +334,6 @@ Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject),
|
|||||||
_lastExtraAttackSpell = 0;
|
_lastExtraAttackSpell = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Methods of class GlobalCooldownMgr
|
|
||||||
bool GlobalCooldownMgr::HasGlobalCooldown(SpellInfo const* spellInfo) const
|
|
||||||
{
|
|
||||||
GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
|
|
||||||
return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, GameTime::GetGameTimeMS().count()) < itr->second.duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlobalCooldownMgr::AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd)
|
|
||||||
{
|
|
||||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, GameTime::GetGameTimeMS().count());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlobalCooldownMgr::CancelGlobalCooldown(SpellInfo const* spellInfo)
|
|
||||||
{
|
|
||||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory].duration = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Methods of class Unit
|
// Methods of class Unit
|
||||||
Unit::~Unit()
|
Unit::~Unit()
|
||||||
|
|||||||
@@ -543,30 +543,6 @@ enum CurrentSpellTypes
|
|||||||
#define CURRENT_FIRST_NON_MELEE_SPELL 1
|
#define CURRENT_FIRST_NON_MELEE_SPELL 1
|
||||||
#define CURRENT_MAX_SPELL 4
|
#define CURRENT_MAX_SPELL 4
|
||||||
|
|
||||||
struct GlobalCooldown
|
|
||||||
{
|
|
||||||
explicit GlobalCooldown(uint32 _dur = 0, uint32 _time = 0) : duration(_dur), cast_time(_time) {}
|
|
||||||
|
|
||||||
uint32 duration;
|
|
||||||
uint32 cast_time;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::unordered_map<uint32 /*category*/, GlobalCooldown> GlobalCooldownList;
|
|
||||||
|
|
||||||
class GlobalCooldownMgr // Shared by Player and CharmInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GlobalCooldownMgr() = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool HasGlobalCooldown(SpellInfo const* spellInfo) const;
|
|
||||||
void AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd);
|
|
||||||
void CancelGlobalCooldown(SpellInfo const* spellInfo);
|
|
||||||
|
|
||||||
private:
|
|
||||||
GlobalCooldownList m_GlobalCooldowns;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ReactStates : uint8
|
enum ReactStates : uint8
|
||||||
{
|
{
|
||||||
REACT_PASSIVE = 0,
|
REACT_PASSIVE = 0,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "BattlefieldMgr.h"
|
#include "BattlefieldMgr.h"
|
||||||
#include "Battleground.h"
|
#include "Battleground.h"
|
||||||
#include "BattlegroundIC.h"
|
#include "BattlegroundIC.h"
|
||||||
|
#include "CharmInfo.h"
|
||||||
#include "CellImpl.h"
|
#include "CellImpl.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "ConditionMgr.h"
|
#include "ConditionMgr.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user