From 51ba36d56577016ff0103d294b33cff19764caec Mon Sep 17 00:00:00 2001 From: Charles A Edwards Date: Mon, 1 Feb 2016 17:57:09 +0000 Subject: [PATCH] Spell class - Fix for inaccessible class data Accessor functions created for protected member, m_selfContainer --- src/game/Object/Unit.cpp | 4 +++- src/game/WorldHandlers/Spell.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index 70c08ea2..28782e86 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -3068,7 +3068,9 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) m_currentSpells[CSpellType] = pSpell; pSpell->SetReferencedFromCurrent(true); - pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]); + pSpell->SetSelfContainer(&(m_currentSpells[pSpell->GetCurrentContainer()])); + // previous and faulty version of the following code. If the above proves to work, then delete this instruction + // pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]); } void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed) diff --git a/src/game/WorldHandlers/Spell.h b/src/game/WorldHandlers/Spell.h index 3cdc9ff0..6e5c6eba 100644 --- a/src/game/WorldHandlers/Spell.h +++ b/src/game/WorldHandlers/Spell.h @@ -439,6 +439,9 @@ class Spell typedef std::list UnitList; + void SetSelfContainer(Spell** pCurrentContainer) { m_selfContainer = pCurrentContainer; } + Spell** GetSelfContainer() { return m_selfContainer; } + protected: bool HasGlobalCooldown(); void TriggerGlobalCooldown();