diff options
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6537c31c890..c1ff6556ed4 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4035,7 +4035,7 @@ void Unit::RemoveAllAuras() { // this may be a dead loop if some events on aura remove will continiously apply aura on remove // we want to have all auras removed, so use your brain when linking events - while (!m_appliedAuras.empty() || !m_ownedAuras.empty()) + for (int counter = 0; !m_appliedAuras.empty() || !m_ownedAuras.empty(); counter++) { AuraApplicationMap::iterator aurAppIter; for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();) @@ -4044,6 +4044,37 @@ void Unit::RemoveAllAuras() AuraMap::iterator aurIter; for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();) RemoveOwnedAura(aurIter); + + const int maxIteration = 50; + // give this loop a few tries, if there are still auras then log as much information as possible + if (counter >= maxIteration) + { + std::stringstream sstr; + sstr << "Unit::RemoveAllAuras() iterated " << maxIteration << " times already but there are still " + << m_appliedAuras.size() << " m_appliedAuras and " << m_ownedAuras.size() << " m_ownedAuras. Details:" << "\n"; + sstr << GetDebugInfo() << "\n"; + + if (!m_appliedAuras.empty()) + { + sstr << "m_appliedAuras:" << "\n"; + + for (std::pair<uint32 const, AuraApplication*>& auraAppPair : m_appliedAuras) + sstr << auraAppPair.second->GetDebugInfo() << "\n"; + } + + if (!m_ownedAuras.empty()) + { + sstr << "m_ownedAuras:" << "\n"; + + for (std::pair<uint32 const, Aura*>& auraPair : m_ownedAuras) + sstr << auraPair.second->GetDebugInfo() << "\n"; + } + + TC_LOG_ERROR("entities.unit", "%s", sstr.str().c_str()); + ABORT_MSG("%s", sstr.str().c_str()); + + break; + } } } |
