From 02a3b3d949e073a78247efa41cfc120a56b9e5fe Mon Sep 17 00:00:00 2001 From: Duarte Duarte Date: Sun, 3 Aug 2014 17:55:13 +0100 Subject: Core/Spell: Correct the hit and miss counters in WriteSpellGoTargets Fixes a client crash when spells hit (or miss) more than 255 targets (it was capped at 256 in 80b61fa584b019a298e129764cddba9f) Thanks to @joschiwald for finding the mistake Closes #12733 --- src/server/game/Spells/Spell.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 10339a6ac3a..bbf79f5c590 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3999,7 +3999,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) uint32 hit = 0; size_t hitPos = data->wpos(); *data << (uint8)0; // placeholder - for (std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit <= 255; ++ihit) + for (std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit < 255; ++ihit) { if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits { @@ -4009,7 +4009,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) } } - for (std::list::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit <= 255; ++ighit) + for (std::list::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit < 255; ++ighit) { *data << uint64(ighit->targetGUID); // Always hits ++hit; @@ -4018,7 +4018,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) uint32 miss = 0; size_t missPos = data->wpos(); *data << (uint8)0; // placeholder - for (std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss <= 255; ++ihit) + for (std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss < 255; ++ihit) { if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss { -- cgit v1.2.3