[7967] Removed unused field. Author: tomrus88
--HG-- branch : trunk
This commit is contained in:
+24
-14
@@ -51,14 +51,18 @@ Corpse::~Corpse()
|
|||||||
void Corpse::AddToWorld()
|
void Corpse::AddToWorld()
|
||||||
{
|
{
|
||||||
///- Register the corpse for guid lookup
|
///- Register the corpse for guid lookup
|
||||||
if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this);
|
if(!IsInWorld())
|
||||||
|
ObjectAccessor::Instance().AddObject(this);
|
||||||
|
|
||||||
Object::AddToWorld();
|
Object::AddToWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Corpse::RemoveFromWorld()
|
void Corpse::RemoveFromWorld()
|
||||||
{
|
{
|
||||||
///- Remove the corpse from the accessor
|
///- Remove the corpse from the accessor
|
||||||
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
|
if(IsInWorld())
|
||||||
|
ObjectAccessor::Instance().RemoveObject(this);
|
||||||
|
|
||||||
Object::RemoveFromWorld();
|
Object::RemoveFromWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +83,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
|
|||||||
if(!IsPositionValid())
|
if(!IsPositionValid())
|
||||||
{
|
{
|
||||||
sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
|
sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
|
||||||
guidlow,owner->GetName(),owner->GetPositionX(), owner->GetPositionY());
|
guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +128,7 @@ void Corpse::SaveToDB()
|
|||||||
|
|
||||||
void Corpse::DeleteBonesFromWorld()
|
void Corpse::DeleteBonesFromWorld()
|
||||||
{
|
{
|
||||||
assert(GetType()==CORPSE_BONES);
|
assert(GetType() == CORPSE_BONES);
|
||||||
Corpse* corpse = ObjectAccessor::GetCorpse(*this, GetGUID());
|
Corpse* corpse = ObjectAccessor::GetCorpse(*this, GetGUID());
|
||||||
|
|
||||||
if (!corpse)
|
if (!corpse)
|
||||||
@@ -153,7 +157,7 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId)
|
|||||||
// 0 1 2 3 4 5 6 7 8 9
|
// 0 1 2 3 4 5 6 7 8 9
|
||||||
result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance,phaseMask FROM corpse WHERE guid = '%u'",guid);
|
result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance,phaseMask FROM corpse WHERE guid = '%u'",guid);
|
||||||
|
|
||||||
if( ! result )
|
if( !result )
|
||||||
{
|
{
|
||||||
sLog.outError("Corpse (GUID: %u) not found in table `corpse`, can't load. ",guid);
|
sLog.outError("Corpse (GUID: %u) not found in table `corpse`, can't load. ",guid);
|
||||||
return false;
|
return false;
|
||||||
@@ -161,13 +165,17 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId)
|
|||||||
|
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
|
|
||||||
if(!LoadFromDB(guid,fields))
|
if(!LoadFromDB(guid, fields))
|
||||||
{
|
{
|
||||||
if (!external) delete result;
|
if (!external)
|
||||||
|
delete result;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!external) delete result;
|
if (!external)
|
||||||
|
delete result;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,13 +197,15 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_time = time_t(fields[6].GetUInt64());
|
m_time = time_t(fields[6].GetUInt64());
|
||||||
m_type = CorpseType(fields[7].GetUInt32());
|
m_type = CorpseType(fields[7].GetUInt32());
|
||||||
|
|
||||||
if(m_type >= MAX_CORPSE_TYPE)
|
if(m_type >= MAX_CORPSE_TYPE)
|
||||||
{
|
{
|
||||||
sLog.outError("Corpse (guidlow %d, owner %d) have wrong corpse type, not load.",GetGUIDLow(),GUID_LOPART(GetOwnerGUID()));
|
sLog.outError("Corpse (guidlow %d, owner %d) have wrong corpse type, not load.",GetGUIDLow(),GUID_LOPART(GetOwnerGUID()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 instanceid = fields[8].GetUInt32();
|
uint32 instanceid = fields[8].GetUInt32();
|
||||||
uint32 phaseMask = fields[9].GetUInt32();
|
uint32 phaseMask = fields[9].GetUInt32();
|
||||||
|
|
||||||
@@ -205,13 +215,13 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
|
|||||||
// place
|
// place
|
||||||
SetInstanceId(instanceid);
|
SetInstanceId(instanceid);
|
||||||
SetMapId(mapid);
|
SetMapId(mapid);
|
||||||
SetPhaseMask(phaseMask,false);
|
SetPhaseMask(phaseMask, false);
|
||||||
Relocate(positionX,positionY,positionZ,ort);
|
Relocate(positionX, positionY, positionZ, ort);
|
||||||
|
|
||||||
if(!IsPositionValid())
|
if(!IsPositionValid())
|
||||||
{
|
{
|
||||||
sLog.outError("Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
|
sLog.outError("Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
|
||||||
GetGUIDLow(),GUID_LOPART(GetOwnerGUID()),GetPositionX(),GetPositionY());
|
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), GetPositionX(), GetPositionY());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +232,6 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
|
|||||||
|
|
||||||
bool Corpse::isVisibleForInState(Player const* u, bool inVisibleList) const
|
bool Corpse::isVisibleForInState(Player const* u, bool inVisibleList) const
|
||||||
{
|
{
|
||||||
return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u->m_seer,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u->m_seer, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32
|
|||||||
SetInstanceId(caster->GetInstanceId());
|
SetInstanceId(caster->GetInstanceId());
|
||||||
|
|
||||||
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetMapId(), caster->GetPhaseMask());
|
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetMapId(), caster->GetPhaseMask());
|
||||||
Relocate(x,y,z,0);
|
Relocate(x, y, z, 0);
|
||||||
|
|
||||||
if(!IsPositionValid())
|
if(!IsPositionValid())
|
||||||
{
|
{
|
||||||
@@ -98,7 +98,6 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32
|
|||||||
m_radius = radius;
|
m_radius = radius;
|
||||||
m_effIndex = effIndex;
|
m_effIndex = effIndex;
|
||||||
m_spellId = spellId;
|
m_spellId = spellId;
|
||||||
m_casterGuid = caster->GetGUID();
|
|
||||||
m_updateTimer = 0;
|
m_updateTimer = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -106,7 +105,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32
|
|||||||
Unit* DynamicObject::GetCaster() const
|
Unit* DynamicObject::GetCaster() const
|
||||||
{
|
{
|
||||||
// can be not found in some cases
|
// can be not found in some cases
|
||||||
return ObjectAccessor::GetUnit(*this,m_casterGuid);
|
return ObjectAccessor::GetUnit(*this, GetCasterGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::Update(uint32 p_time)
|
void DynamicObject::Update(uint32 p_time)
|
||||||
@@ -153,7 +152,7 @@ void DynamicObject::Delete()
|
|||||||
void DynamicObject::Delay(int32 delaytime)
|
void DynamicObject::Delay(int32 delaytime)
|
||||||
{
|
{
|
||||||
m_aliveDuration -= delaytime;
|
m_aliveDuration -= delaytime;
|
||||||
for(AffectedSet::iterator iunit= m_affected.begin();iunit != m_affected.end();++iunit)
|
for(AffectedSet::iterator iunit= m_affected.begin(); iunit != m_affected.end(); ++iunit)
|
||||||
if (*iunit)
|
if (*iunit)
|
||||||
(*iunit)->DelayAura(m_spellId, GetCaster()->GetGUID() , delaytime);
|
(*iunit)->DelayAura(m_spellId, GetCaster()->GetGUID() , delaytime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class DynamicObject : public WorldObject
|
|||||||
uint32 GetSpellId() const { return m_spellId; }
|
uint32 GetSpellId() const { return m_spellId; }
|
||||||
uint32 GetEffIndex() const { return m_effIndex; }
|
uint32 GetEffIndex() const { return m_effIndex; }
|
||||||
uint32 GetDuration() const { return m_aliveDuration; }
|
uint32 GetDuration() const { return m_aliveDuration; }
|
||||||
uint64 GetCasterGUID() const { return m_casterGuid; }
|
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
|
||||||
Unit* GetCaster() const;
|
Unit* GetCaster() const;
|
||||||
float GetRadius() const { return m_radius; }
|
float GetRadius() const { return m_radius; }
|
||||||
bool IsAffecting(Unit *unit) const { return m_affected.find(unit) != m_affected.end(); }
|
bool IsAffecting(Unit *unit) const { return m_affected.find(unit) != m_affected.end(); }
|
||||||
@@ -58,7 +58,6 @@ class DynamicObject : public WorldObject
|
|||||||
|
|
||||||
GridReference<DynamicObject> &GetGridRef() { return m_gridRef; }
|
GridReference<DynamicObject> &GetGridRef() { return m_gridRef; }
|
||||||
protected:
|
protected:
|
||||||
uint64 m_casterGuid;
|
|
||||||
uint32 m_spellId;
|
uint32 m_spellId;
|
||||||
uint32 m_effIndex;
|
uint32 m_effIndex;
|
||||||
int32 m_aliveDuration;
|
int32 m_aliveDuration;
|
||||||
|
|||||||
Reference in New Issue
Block a user