aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/MapUpdater.cpp4
-rw-r--r--src/game/SpellMgr.cpp6
-rw-r--r--src/game/Unit.cpp54
-rw-r--r--src/game/WorldSocketMgr.cpp8
-rw-r--r--src/trinitycore/CliRunnable.cpp4
-rw-r--r--src/trinitycore/WorldRunnable.cpp1
6 files changed, 50 insertions, 27 deletions
diff --git a/src/game/MapUpdater.cpp b/src/game/MapUpdater.cpp
index 61d367ef2e1..501843f8869 100644
--- a/src/game/MapUpdater.cpp
+++ b/src/game/MapUpdater.cpp
@@ -18,6 +18,8 @@ class WDBThreadStartReq1 : public ACE_Method_Request
call (void)
{
WorldDatabase.ThreadStart();
+ CharacterDatabase.ThreadStart();
+ loginDatabase.ThreadStart();
return 0;
}
};
@@ -31,6 +33,8 @@ class WDBThreadEndReq1 : public ACE_Method_Request
call (void)
{
WorldDatabase.ThreadEnd();
+ CharacterDatabase.ThreadEnd();
+ loginDatabase.ThreadEnd();
return 0;
}
};
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index eea1971c029..e1792787b02 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -3256,7 +3256,7 @@ void SpellMgr::LoadSpellRanks()
do
{
// spellid, rank
- std::list<std::pair<int32, int32>> rankChain;
+ std::list < std::pair < int32, int32 > > rankChain;
int32 currentSpell = -1;
int32 lastSpell = -1;
@@ -3299,7 +3299,7 @@ void SpellMgr::LoadSpellRanks()
int32 curRank = 0;
bool valid = true;
// check spells in chain
- for (std::list<std::pair<int32, int32>>::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr)
+ for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr)
{
SpellEntry const * spell = sSpellStore.LookupEntry(itr->first);
if (!spell)
@@ -3320,7 +3320,7 @@ void SpellMgr::LoadSpellRanks()
continue;
int32 prevRank = 0;
// insert the chain
- std::list<std::pair<int32, int32>>::iterator itr = rankChain.begin();
+ std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin();
do
{
int32 addedSpell = itr->first;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d9c1179823c..bb48d49ab7b 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4300,33 +4300,43 @@ void Unit::RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemo
void Unit::RemoveAreaAurasDueToLeaveWorld()
{
- // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later
- for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
+ bool cleanRun;
+ do
{
- Aura * aura = iter->second;
- ++iter;
- Aura::ApplicationMap const & appMap = aura->GetApplicationMap();
- for(Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr!= appMap.end();)
+ cleanRun = true;
+ // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later
+ for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
{
- AuraApplication * aurApp = itr->second;
- ++itr;
- Unit * target = aurApp->GetTarget();
- if (target == this)
- continue;
- target->RemoveAura(aurApp);
- // things linked on aura remove may apply new area aura - so start from the beginning
- iter = m_ownedAuras.begin();
+ Aura * aura = iter->second;
+ ++iter;
+ Aura::ApplicationMap const & appMap = aura->GetApplicationMap();
+ for(Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr!= appMap.end();)
+ {
+ AuraApplication * aurApp = itr->second;
+ ++itr;
+ Unit * target = aurApp->GetTarget();
+ if (target == this)
+ continue;
+ target->RemoveAura(aurApp);
+ cleanRun = false;
+ // things linked on aura remove may apply new area aura - so start from the beginning
+ iter = m_ownedAuras.begin();
+ }
}
- }
- // remove area auras owned by others
- for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
- {
- if (iter->second->GetBase()->GetOwner()!=this)
- RemoveAura(iter);
- else
- ++iter;
+ // remove area auras owned by others
+ for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
+ {
+ if (iter->second->GetBase()->GetOwner()!=this)
+ {
+ RemoveAura(iter);
+ cleanRun = false;
+ }
+ else
+ ++iter;
+ }
}
+ while (!cleanRun);
}
void Unit::RemoveAllAuras()
diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp
index b6407219792..b018e7423e2 100644
--- a/src/game/WorldSocketMgr.cpp
+++ b/src/game/WorldSocketMgr.cpp
@@ -154,7 +154,9 @@ class ReactorRunnable : protected ACE_Task_Base
{
DEBUG_LOG ("Network Thread Starting");
- WorldDatabase.ThreadStart ();
+ WorldDatabase.ThreadStart();
+ CharacterDatabase.ThreadStart();
+ loginDatabase.ThreadStart();
ACE_ASSERT (m_Reactor);
@@ -187,7 +189,9 @@ class ReactorRunnable : protected ACE_Task_Base
}
}
- WorldDatabase.ThreadEnd ();
+ WorldDatabase.ThreadEnd();
+ CharacterDatabase.ThreadEnd();
+ loginDatabase.ThreadEnd();
DEBUG_LOG ("Network Thread Exitting");
diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp
index 4549ffcf03e..f18d7ca49cb 100644
--- a/src/trinitycore/CliRunnable.cpp
+++ b/src/trinitycore/CliRunnable.cpp
@@ -369,6 +369,8 @@ void CliRunnable::run()
{
///- Init new SQL thread for the world database (one connection call enough)
WorldDatabase.ThreadStart(); // let thread do safe mySQL requests
+ CharacterDatabase.ThreadStart();
+ loginDatabase.ThreadStart();
char commandbuf[256];
bool canflush = true;
@@ -438,4 +440,6 @@ void CliRunnable::run()
///- End the database thread
WorldDatabase.ThreadEnd(); // free mySQL thread resources
+ CharacterDatabase.ThreadEnd();
+ loginDatabase.ThreadEnd();
}
diff --git a/src/trinitycore/WorldRunnable.cpp b/src/trinitycore/WorldRunnable.cpp
index 358344e1fed..007107f1eb8 100644
--- a/src/trinitycore/WorldRunnable.cpp
+++ b/src/trinitycore/WorldRunnable.cpp
@@ -47,6 +47,7 @@ void WorldRunnable::run()
WorldDatabase.ThreadStart(); // let thread do safe mySQL requests (one connection call enough)
CharacterDatabase.ThreadStart();
loginDatabase.ThreadStart();
+
sWorld.InitResultQueue();
uint32 realCurrTime = 0;