fix(Core/Entities): crash fix cause by a pointer change in #19622 (#19633)

* fix(Core/Entities): crash fix cause by a pointer change in #19622

* fix blank space for codestyle check
This commit is contained in:
Grimdhex
2024-08-15 21:28:50 +02:00
committed by GitHub
parent 7457aef78d
commit 9dc20bc261
8 changed files with 49 additions and 44 deletions

View File

@@ -17,6 +17,7 @@
#include "CharmInfo.h"
#include "Creature.h"
#include "GameTime.h"
#include "Map.h"
#include "SpellInfo.h"
#include "Player.h"
@@ -390,3 +391,21 @@ bool CharmInfo::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;
}