merge
--HG-- branch : trunk
This commit is contained in:
@@ -1590,6 +1590,7 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
|||||||
Creature* pCreature = new Creature;
|
Creature* pCreature = new Creature;
|
||||||
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o))
|
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o))
|
||||||
{
|
{
|
||||||
|
pCreature->CleanupsBeforeDelete();
|
||||||
sLog.outError("Can't create creature entry: %u",entry);
|
sLog.outError("Can't create creature entry: %u",entry);
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -794,6 +794,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
|||||||
|
|
||||||
if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
|
if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
|
||||||
{
|
{
|
||||||
|
v->CleanupsBeforeDelete();
|
||||||
delete v;
|
delete v;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1283,7 +1283,10 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||||||
Creature* pCreature = new Creature;
|
Creature* pCreature = new Creature;
|
||||||
//sLog.outDebug("Spawning creature %u",*itr);
|
//sLog.outDebug("Spawning creature %u",*itr);
|
||||||
if (!pCreature->LoadFromDB(*itr, map))
|
if (!pCreature->LoadFromDB(*itr, map))
|
||||||
|
{
|
||||||
|
pCreature->CleanupsBeforeDelete();
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
map->Add(pCreature);
|
map->Add(pCreature);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1014,6 +1014,7 @@ bool ChatHandler::HandleNpcAddCommand(const char* args)
|
|||||||
Creature* pCreature = new Creature;
|
Creature* pCreature = new Creature;
|
||||||
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o))
|
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o))
|
||||||
{
|
{
|
||||||
|
pCreature->CleanupsBeforeDelete();
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2830,6 +2831,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
|||||||
Creature* wpCreature2 = new Creature;
|
Creature* wpCreature2 = new Creature;
|
||||||
if (!wpCreature2->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
|
if (!wpCreature2->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
|
||||||
{
|
{
|
||||||
|
wpCreature2->CleanupsBeforeDelete();
|
||||||
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
|
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
|
||||||
delete wpCreature2;
|
delete wpCreature2;
|
||||||
return false;
|
return false;
|
||||||
@@ -3039,6 +3041,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
|||||||
Creature* wpCreature = new Creature;
|
Creature* wpCreature = new Creature;
|
||||||
if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
||||||
{
|
{
|
||||||
|
wpCreature->CleanupsBeforeDelete();
|
||||||
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||||
delete wpCreature;
|
delete wpCreature;
|
||||||
delete result;
|
delete result;
|
||||||
@@ -3094,6 +3097,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
|||||||
Creature* pCreature = new Creature;
|
Creature* pCreature = new Creature;
|
||||||
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
||||||
{
|
{
|
||||||
|
pCreature->CleanupsBeforeDelete();
|
||||||
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
delete result;
|
delete result;
|
||||||
@@ -3149,6 +3153,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
|||||||
Creature* pCreature = new Creature;
|
Creature* pCreature = new Creature;
|
||||||
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
||||||
{
|
{
|
||||||
|
pCreature->CleanupsBeforeDelete();
|
||||||
PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
|
PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
delete result;
|
delete result;
|
||||||
|
|||||||
@@ -1759,6 +1759,7 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
|
|||||||
|
|
||||||
if(!summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
|
if(!summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
|
||||||
{
|
{
|
||||||
|
summon->CleanupsBeforeDelete();
|
||||||
delete summon;
|
delete summon;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1470,6 +1470,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
|
|||||||
Creature *creature = new Creature;
|
Creature *creature = new Creature;
|
||||||
if(!creature->LoadFromDB(guid, map))
|
if(!creature->LoadFromDB(guid, map))
|
||||||
{
|
{
|
||||||
|
creature->CleanupsBeforeDelete();
|
||||||
sLog.outError("AddCreature: cannot add creature entry %u to map", guid);
|
sLog.outError("AddCreature: cannot add creature entry %u to map", guid);
|
||||||
delete creature;
|
delete creature;
|
||||||
return false;
|
return false;
|
||||||
@@ -1521,6 +1522,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 team, uint32 mapId, float x, f
|
|||||||
Creature* creature = new Creature;
|
Creature* creature = new Creature;
|
||||||
if(!creature->LoadFromDB(guid, map))
|
if(!creature->LoadFromDB(guid, map))
|
||||||
{
|
{
|
||||||
|
creature->CleanupsBeforeDelete();
|
||||||
sLog.outError("AddCreature: cannot add creature entry %u to map", entry);
|
sLog.outError("AddCreature: cannot add creature entry %u to map", entry);
|
||||||
delete creature;
|
delete creature;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ bool PoolGroup<Creature>::Spawn1Object(uint32 guid)
|
|||||||
//sLog.outDebug("Spawning creature %u",guid);
|
//sLog.outDebug("Spawning creature %u",guid);
|
||||||
if (!pCreature->LoadFromDB(guid, map))
|
if (!pCreature->LoadFromDB(guid, map))
|
||||||
{
|
{
|
||||||
|
pCreature->CleanupsBeforeDelete();
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class AuraApplication
|
|||||||
AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
|
AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
|
||||||
bool m_needClientUpdate:1;
|
bool m_needClientUpdate:1;
|
||||||
bool m_isNeedManyNegativeEffects:1;
|
bool m_isNeedManyNegativeEffects:1;
|
||||||
bool m_canBeRemoved:1; // used only in aura list update of AuraBase
|
bool m_canBeRemoved:1; // used only in aura list update of Aura
|
||||||
|
|
||||||
explicit AuraApplication(Unit * target, Unit * caster, Aura * base);
|
explicit AuraApplication(Unit * target, Unit * caster, Aura * base);
|
||||||
void _Remove();
|
void _Remove();
|
||||||
|
|||||||
@@ -899,7 +899,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
|
|||||||
// part of positive spell if casted at self
|
// part of positive spell if casted at self
|
||||||
if(spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER)
|
if(spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER)
|
||||||
return false;
|
return false;
|
||||||
// but not this if this first effect (don't found batter check)
|
// but not this if this first effect (didn't find batter check)
|
||||||
if(spellproto->Attributes & 0x4000000 && effIndex==0)
|
if(spellproto->Attributes & 0x4000000 && effIndex==0)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+8
-3
@@ -182,6 +182,8 @@ Unit::Unit()
|
|||||||
// remove aurastates allowing special moves
|
// remove aurastates allowing special moves
|
||||||
for (uint8 i = 0; i < MAX_REACTIVE; ++i)
|
for (uint8 i = 0; i < MAX_REACTIVE; ++i)
|
||||||
m_reactiveTimer[i] = 0;
|
m_reactiveTimer[i] = 0;
|
||||||
|
|
||||||
|
m_cleanupDone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit::~Unit()
|
Unit::~Unit()
|
||||||
@@ -205,6 +207,7 @@ Unit::~Unit()
|
|||||||
if (m_vehicleKit)
|
if (m_vehicleKit)
|
||||||
delete m_vehicleKit;
|
delete m_vehicleKit;
|
||||||
|
|
||||||
|
assert(m_cleanupDone);
|
||||||
assert(!m_attacking);
|
assert(!m_attacking);
|
||||||
assert(m_attackers.empty());
|
assert(m_attackers.empty());
|
||||||
assert(m_sharedVision.empty());
|
assert(m_sharedVision.empty());
|
||||||
@@ -3234,8 +3237,7 @@ void Unit::_UpdateSpells( uint32 time )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update auraBases
|
// m_auraUpdateIterator can be updated in indirect called code at aura remove to skip next planned to update but removed auras
|
||||||
// m_auraBaseUpdateIterator can be updated in indirect called code at aura remove to skip next planned to update but removed auras
|
|
||||||
for (m_auraUpdateIterator = m_ownedAuras.begin(); m_auraUpdateIterator != m_ownedAuras.end();)
|
for (m_auraUpdateIterator = m_ownedAuras.begin(); m_auraUpdateIterator != m_ownedAuras.end();)
|
||||||
{
|
{
|
||||||
Aura * i_aura = m_auraUpdateIterator->second;
|
Aura * i_aura = m_auraUpdateIterator->second;
|
||||||
@@ -3529,6 +3531,7 @@ void Unit::DeMorph()
|
|||||||
|
|
||||||
void Unit::_AddAura(UnitAura * aura, Unit * caster)
|
void Unit::_AddAura(UnitAura * aura, Unit * caster)
|
||||||
{
|
{
|
||||||
|
assert(!m_cleanupDone);
|
||||||
m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
|
m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
|
||||||
|
|
||||||
// passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
|
// passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
|
||||||
@@ -3579,7 +3582,8 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
|
|||||||
|
|
||||||
AuraApplication * Unit::__ApplyAura(Aura * aura)
|
AuraApplication * Unit::__ApplyAura(Aura * aura)
|
||||||
{
|
{
|
||||||
// auraBase musn't be removed
|
assert(!m_cleanupDone);
|
||||||
|
// aura musn't be removed
|
||||||
assert(!aura->IsRemoved());
|
assert(!aura->IsRemoved());
|
||||||
|
|
||||||
SpellEntry const* aurSpellInfo = aura->GetSpellProto();
|
SpellEntry const* aurSpellInfo = aura->GetSpellProto();
|
||||||
@@ -12965,6 +12969,7 @@ void Unit::CleanupsBeforeDelete()
|
|||||||
//A unit may be in removelist and not in world, but it is still in grid
|
//A unit may be in removelist and not in world, but it is still in grid
|
||||||
//and may have some references during delete
|
//and may have some references during delete
|
||||||
RemoveAllAuras();
|
RemoveAllAuras();
|
||||||
|
m_cleanupDone = true;
|
||||||
InterruptNonMeleeSpells(true);
|
InterruptNonMeleeSpells(true);
|
||||||
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
|
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
|
||||||
CombatStop();
|
CombatStop();
|
||||||
|
|||||||
@@ -2069,6 +2069,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
|
|
||||||
uint32 m_reducedThreatPercent;
|
uint32 m_reducedThreatPercent;
|
||||||
uint64 m_misdirectionTargetGUID;
|
uint64 m_misdirectionTargetGUID;
|
||||||
|
|
||||||
|
bool m_cleanupDone;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Trinity
|
namespace Trinity
|
||||||
|
|||||||
Reference in New Issue
Block a user