#include "stdafx.h" #include #include #include "Spell.h" #include "Casting.h" bool CCastingSpell::Add(CSpell* pSpell) { CSpell* pRemoveSpell = 0; CSpell** ppPastEnd = NULL; switch(pSpell->GetSkillType()) { case Skill::Type::CHANT: if(m_cChantNum >= MAX_CHANT_CASTING) { pRemoveSpell = m_pChantCasting[0]; // ¸Ç óÀ½¿¡ ij½ºÆÃ ÇÑ ÁÖ¹®À» Áö¿ò. ppPastEnd = m_pChantCasting + m_cChantNum; std::copy(m_pChantCasting + 1, ppPastEnd, m_pChantCasting); --m_cChantNum; m_pChantCasting[m_cChantNum] = 0; pRemoveSpell->ClearAll(); } m_pChantCasting[m_cChantNum] = pSpell; ++m_cChantNum; return true; case Skill::Type::ENCHANT: if(m_cEnchantNum >= MAX_ENCHANT_CASTING) { pRemoveSpell = m_pEnchantCasting[0]; // ¸Ç óÀ½¿¡ ij½ºÆÃ ÇÑ ÁÖ¹®À» Áö¿ò. ppPastEnd = m_pEnchantCasting + m_cEnchantNum; std::copy(m_pEnchantCasting + 1, ppPastEnd, m_pEnchantCasting); --m_cEnchantNum; m_pEnchantCasting[m_cEnchantNum] = 0; pRemoveSpell->ClearAll(); } /* // edith 2008.10.16 ¿Àºê »èÁ¦½Ã ·Î±× ³²±è. if(pSpell->GetSpellID() == Skill::SpellID::ExpOrb) { unsigned long time = pSpell->GetDurationSec(); if(m_pOwner) SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add °æÇèÄ¡ÀÇ ¿Àºê »ý¼º : Type:%d : %d Tick³²À½", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time); else SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add °æÇèÄ¡ÀÇ ¿Àºê »ý¼º : Type:%d : %d Tick³²À½", 0, 0, pSpell->GetSpellType(), time); } else if(pSpell->GetSpellID() == Skill::SpellID::LuckyOrb) { unsigned long time = pSpell->GetDurationSec(); if(m_pOwner) SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add Çà¿îÀÇ ¿Àºê »ý¼º : Type:%d : %d Tick³²À½", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time); else SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add Çà¿îÀÇ ¿Àºê »ý¼º : Type:%d : %d Tick³²À½", 0, 0, pSpell->GetSpellType(), time); } */ m_pEnchantCasting[m_cEnchantNum] = pSpell; ++m_cEnchantNum; return true; }; return false; } bool CCastingSpell::Remove(CSpell* pSpell) { CSpell** ppBegin = NULL; CSpell** ppPastEnd = NULL; switch(pSpell->GetSkillType()) { case Skill::Type::CHANT: for(ppBegin = m_pChantCasting, ppPastEnd = m_pChantCasting + m_cChantNum; ppBegin != ppPastEnd; ++ppBegin) { if((*ppBegin) == pSpell) { std::copy(ppBegin + 1, ppPastEnd, ppBegin); --m_cChantNum; m_pChantCasting[m_cChantNum] = 0; return true; } } break; case Skill::Type::ENCHANT: for(ppBegin = m_pEnchantCasting, ppPastEnd = m_pEnchantCasting + m_cEnchantNum; ppBegin != ppPastEnd; ++ppBegin) { if((*ppBegin) == pSpell) { /* // edith 2008.10.16 ¿Àºê »èÁ¦½Ã ·Î±× ³²±è. if(pSpell->GetSpellID() == Skill::SpellID::ExpOrb) { unsigned long time = pSpell->GetDurationSec(); if(m_pOwner) SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove °æÇèÄ¡ÀÇ ¿Àºê »èÁ¦ : Type:%d : %d Tick³²À½", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time); else SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove °æÇèÄ¡ÀÇ ¿Àºê »èÁ¦ : Type:%d : %d Tick³²À½", 0, 0, pSpell->GetSpellType(), time); } else if(pSpell->GetSpellID() == Skill::SpellID::LuckyOrb) { unsigned long time = pSpell->GetDurationSec(); if(m_pOwner) SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove Çà¿îÀÇ ¿Àºê »èÁ¦ : Type:%d : %d Tick³²À½", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time); else SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove Çà¿îÀÇ ¿Àºê »èÁ¦ : Type:%d : %d Tick³²À½", 0, 0, pSpell->GetSpellType(), time); } */ std::copy(ppBegin + 1, ppPastEnd, ppBegin); --m_cEnchantNum; m_pEnchantCasting[m_cEnchantNum] = 0; return true; } } break; }; return false; } void CCastingSpell::ClearChant() { CSpell** pprBegin = m_pChantCasting + m_cChantNum - 1; CSpell** pprPastEnd = m_pChantCasting - 1; for(;pprBegin != pprPastEnd; --pprBegin) { (*pprBegin)->ClearAll(); } } void CCastingSpell::ClearEnchant() { CSpell** pprBegin = m_pEnchantCasting + m_cEnchantNum - 1; CSpell** pprPastEnd = m_pEnchantCasting - 1; for(;pprBegin != pprPastEnd; --pprBegin) { (*pprBegin)->ClearAll(); } } CSpell* CCastingSpell::GetSpell(unsigned short usSpellID) { CSpell** ppBegin = NULL; CSpell** ppPastEnd = NULL; // æƮ ppBegin = m_pChantCasting; ppPastEnd = m_pChantCasting + m_cChantNum; for(;ppBegin != ppPastEnd; ++ppBegin) { if((*ppBegin)->GetSpellID() == usSpellID) { return *ppBegin; } } // ÀÎæƮ ppBegin = m_pEnchantCasting; ppPastEnd = m_pEnchantCasting + m_cEnchantNum; for(;ppBegin != ppPastEnd; ++ppBegin) { if((*ppBegin)->GetSpellID() == usSpellID) { return *ppBegin; } } return NULL; } void CCastingSpell::EnableChant(unsigned long dwOperateFlag) { CSpell** ppBegin = m_pChantCasting; CSpell** ppPastEnd = m_pChantCasting + m_cChantNum; for(;ppBegin != ppPastEnd; ++ppBegin) { (*ppBegin)->Enable(dwOperateFlag); } } void CCastingSpell::DisableChant(unsigned long dwOperateFlag) { CSpell** ppBegin = m_pChantCasting; CSpell** ppPastEnd = m_pChantCasting + m_cChantNum; for(;ppBegin != ppPastEnd; ++ppBegin) { (*ppBegin)->Disable(dwOperateFlag); } }