diff options
| author | jackpoz <giacomopoz@gmail.com> | 2013-12-15 21:14:47 +0100 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2013-12-15 21:14:47 +0100 |
| commit | e90a7f82d4417400ff2db4c9da0f324190fa4e27 (patch) | |
| tree | 44ad5e9b28397861729dbb94d9df8d2083289f86 | |
| parent | 9dd30ac5ff13b1e5c6c94044e0caeb6dd961dd4c (diff) | |
Core/AI: Fix CreatureAI left uninitialized
Fix CreatureAI left uninitialized for 1 server tick for Creatures with DeathState:DEAD . This is a workaround required after c9cf2f059f8f33c3fcb58ad472871515e59df7c3 changes .
Valgrind log:
Conditional jump or move depends on uninitialised value(s)
at : npc_draenei_survivor::npc_draenei_survivorAI::MoveInLineOfSight(Unit*) (zone_azuremyst_isle.cpp:104)
by : CreatureAI::MoveInLineOfSight_Safe(Unit*) (CreatureAI.cpp:123)
by : CreatureUnitRelocationWorker(Creature*, Unit*) (GridNotifiers.cpp:134)
by : Trinity::AIRelocationNotifier::Visit(GridRefManager<Creature>&) (GridNotifiers.cpp:252)
Uninitialised value was created by a heap allocation
at : operator new(unsigned long) (vg_replace_malloc.c:319)
by : npc_draenei_survivor::GetAI(Creature*) const (zone_azuremyst_isle.cpp:66)
by : ScriptMgr::GetCreatureAI(Creature*) (ScriptMgr.cpp:792)
by : FactorySelector::selectAI(Creature*) (CreatureAISelector.cpp:41)
by : Creature::AIM_Initialize(CreatureAI*) (Creature.cpp:716)
by : Creature::AddToWorld() (Creature.cpp:190)
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index dfc35bcce56..d039ee385ec 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1533,7 +1533,11 @@ void Creature::Respawn(bool force) //Call AI respawn virtual function if (IsAIEnabled) + { + //reset the AI to be sure no dirty or uninitialized values will be used till next tick + AI()->Reset(); TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing + } uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0; if (poolid) |
