From 6ae4f909d0640c6ad3880459a340ee747c75693b Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 7 Mar 2009 00:52:30 -0600 Subject: [PATCH 1/3] *Fix a crash caused by possesspet spells. --HG-- branch : trunk --- src/game/SpellAuras.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 40edea80ce9..034370f9564 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2873,11 +2873,14 @@ void Aura::HandleModPossessPet(bool apply, bool Real) Unit* caster = GetCaster(); if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - if(caster->GetPet() != m_target) - return; if(apply) + { + if(caster->GetPet() != m_target) + return; + m_target->SetCharmedOrPossessedBy(caster, true); + } else { m_target->RemoveCharmedOrPossessedBy(caster); From 5627f5e8383e879aba32623c95169f48af0e147b Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 7 Mar 2009 00:53:01 -0600 Subject: [PATCH 2/3] *Fix a typo and add some missing content. --HG-- branch : trunk --- src/game/Map.cpp | 7 ++----- src/game/Unit.cpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 42e21f9b5eb..7a280160913 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1015,7 +1015,6 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) RemoveFromGrid(c,getNGrid(old_cell.GridX(), old_cell.GridY()),old_cell); AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); - c->SetCurrentCell(new_cell); } else { @@ -1040,7 +1039,6 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) RemoveFromGrid(c,getNGrid(old_cell.GridX(), old_cell.GridY()),old_cell); AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); - c->SetCurrentCell(new_cell); return true; } @@ -1056,7 +1054,6 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) RemoveFromGrid(c,getNGrid(old_cell.GridX(), old_cell.GridY()),old_cell); EnsureGridCreated(GridPair(new_cell.GridX(), new_cell.GridY())); AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); - c->SetCurrentCell(new_cell); return true; } @@ -1714,7 +1711,7 @@ void Map::AddToActive( Creature* c ) AddToActiveHelper(c); // also not allow unloading spawn grid to prevent creating creature clone at load - if(c->GetDBTableGUIDLow()) + if(!c->isPet() && c->GetDBTableGUIDLow()) { float x,y,z; c->GetRespawnCoord(x,y,z); @@ -1735,7 +1732,7 @@ void Map::RemoveFromActive( Creature* c ) RemoveFromActiveHelper(c); // also allow unloading spawn grid - if(c->GetDBTableGUIDLow()) + if(!c->isPet() && c->GetDBTableGUIDLow()) { float x,y,z; c->GetRespawnCoord(x,y,z); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a3fc2400208..7bdb3b28d27 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8342,7 +8342,7 @@ bool Unit::AttackStop() void Unit::CombatStop(bool cast) { - if(cast& IsNonMeleeSpellCasted(false)) + if(cast && IsNonMeleeSpellCasted(false)) InterruptNonMeleeSpells(false); AttackStop(); From 6dc06ab53b2e5307b682c5723b3c6fd62318633e Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 7 Mar 2009 00:53:30 -0600 Subject: [PATCH 3/3] *Fix a bug that possessed creature cannot melee. --HG-- branch : trunk --- src/game/PetHandler.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 19b05797618..b87193b7e9f 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -118,10 +118,9 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) //if(!pet->IsWithinLOSInMap(TargetUnit)) // return; - if(pet->GetTypeId() != TYPEID_PLAYER) + if(pet->GetTypeId() != TYPEID_PLAYER && ((Creature*)pet)->IsAIEnabled) { - if (((Creature*)pet)->IsAIEnabled) - ((Creature*)pet)->AI()->AttackStart(TargetUnit); + ((Creature*)pet)->AI()->AttackStart(TargetUnit); //10% chance to play special pet attack talk, else growl if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)