Various Cleanups (game C-E)

This commit is contained in:
Schmoozerd 2012-07-19 21:45:58 +02:00
parent f80629e307
commit c5c09cee3c
40 changed files with 1826 additions and 1818 deletions

View file

@ -41,7 +41,7 @@ DynamicObject::DynamicObject() : WorldObject()
void DynamicObject::AddToWorld()
{
///- Register the dynamicObject for guid lookup
if(!IsInWorld())
if (!IsInWorld())
GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this);
Object::AddToWorld();
@ -50,7 +50,7 @@ void DynamicObject::AddToWorld()
void DynamicObject::RemoveFromWorld()
{
///- Remove the dynamicObject from the accessor
if(IsInWorld())
if (IsInWorld())
{
GetMap()->GetObjectsStore().erase<DynamicObject>(GetObjectGuid(), (DynamicObject*)NULL);
GetViewPoint().Event_RemovedFromWorld();
@ -59,13 +59,13 @@ void DynamicObject::RemoveFromWorld()
Object::RemoveFromWorld();
}
bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type)
bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type)
{
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
SetMap(caster->GetMap());
Relocate(x, y, z, 0);
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,effIndex,GetPositionX(),GetPositionY());
return false;
@ -119,7 +119,7 @@ void DynamicObject::Update(uint32 update_diff, uint32 p_time)
{
// caster can be not in world at time dynamic object update, but dynamic object not yet deleted in Unit destructor
Unit* caster = GetCaster();
if(!caster)
if (!caster)
{
Delete();
return;
@ -127,20 +127,20 @@ void DynamicObject::Update(uint32 update_diff, uint32 p_time)
bool deleteThis = false;
if(m_aliveDuration > int32(p_time))
if (m_aliveDuration > int32(p_time))
m_aliveDuration -= p_time;
else
deleteThis = true;
// have radius and work as persistent effect
if(m_radius)
if (m_radius)
{
// TODO: make a timer and update this in larger intervals
MaNGOS::DynamicObjectUpdater notifier(*this, caster, m_positive);
Cell::VisitAllObjects(this, notifier, m_radius);
}
if(deleteThis)
if (deleteThis)
{
caster->RemoveDynObjectWithGUID(GetObjectGuid());
Delete();
@ -156,12 +156,12 @@ void DynamicObject::Delete()
void DynamicObject::Delay(int32 delaytime)
{
m_aliveDuration -= delaytime;
for (GuidSet::iterator iter = m_affected.begin(); iter != m_affected.end(); )
for (GuidSet::iterator iter = m_affected.begin(); iter != m_affected.end();)
{
Unit *target = GetMap()->GetUnit((*iter));
Unit* target = GetMap()->GetUnit((*iter));
if (target)
{
SpellAuraHolder *holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid());
SpellAuraHolder* holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid());
if (!holder)
{
++iter;
@ -205,7 +205,7 @@ bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* view
return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
}
bool DynamicObject::IsHostileTo( Unit const* unit ) const
bool DynamicObject::IsHostileTo(Unit const* unit) const
{
if (Unit* owner = GetCaster())
return owner->IsHostileTo(unit);
@ -213,7 +213,7 @@ bool DynamicObject::IsHostileTo( Unit const* unit ) const
return false;
}
bool DynamicObject::IsFriendlyTo( Unit const* unit ) const
bool DynamicObject::IsFriendlyTo(Unit const* unit) const
{
if (Unit* owner = GetCaster())
return owner->IsFriendlyTo(unit);