mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -35,7 +35,7 @@ DynamicObject::~DynamicObject()
|
||||
ASSERT(!_isViewpoint);
|
||||
delete _removedAura;
|
||||
}
|
||||
|
||||
|
||||
void DynamicObject::CleanupsBeforeDelete(bool finalCleanup /* = true */)
|
||||
{
|
||||
if (Transport* transport = GetTransport())
|
||||
@@ -50,7 +50,7 @@ void DynamicObject::CleanupsBeforeDelete(bool finalCleanup /* = true */)
|
||||
}
|
||||
|
||||
void DynamicObject::AddToWorld()
|
||||
{
|
||||
{
|
||||
///- Register the dynamicObject for guid lookup and for caster
|
||||
if (!IsInWorld())
|
||||
{
|
||||
@@ -61,7 +61,7 @@ void DynamicObject::AddToWorld()
|
||||
}
|
||||
|
||||
void DynamicObject::RemoveFromWorld()
|
||||
{
|
||||
{
|
||||
///- Remove the dynamicObject from the accessor and from all lists of objects in world
|
||||
if (IsInWorld())
|
||||
{
|
||||
@@ -84,7 +84,7 @@ void DynamicObject::RemoveFromWorld()
|
||||
}
|
||||
|
||||
bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type)
|
||||
{
|
||||
{
|
||||
SetMap(caster->GetMap());
|
||||
Relocate(pos);
|
||||
if (!IsPositionValid())
|
||||
@@ -122,7 +122,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
|
||||
}
|
||||
|
||||
void DynamicObject::Update(uint32 p_time)
|
||||
{
|
||||
{
|
||||
// caster has to be always available and in the same map
|
||||
ASSERT(_caster);
|
||||
ASSERT(_caster->GetMap() == GetMap());
|
||||
@@ -153,7 +153,7 @@ void DynamicObject::Update(uint32 p_time)
|
||||
}
|
||||
|
||||
void DynamicObject::Remove()
|
||||
{
|
||||
{
|
||||
if (IsInWorld())
|
||||
{
|
||||
SendObjectDeSpawnAnim(GetGUID());
|
||||
@@ -163,7 +163,7 @@ void DynamicObject::Remove()
|
||||
}
|
||||
|
||||
int32 DynamicObject::GetDuration() const
|
||||
{
|
||||
{
|
||||
if (!_aura)
|
||||
return _duration;
|
||||
else
|
||||
@@ -171,7 +171,7 @@ int32 DynamicObject::GetDuration() const
|
||||
}
|
||||
|
||||
void DynamicObject::SetDuration(int32 newDuration)
|
||||
{
|
||||
{
|
||||
if (!_aura)
|
||||
_duration = newDuration;
|
||||
else
|
||||
@@ -179,18 +179,18 @@ void DynamicObject::SetDuration(int32 newDuration)
|
||||
}
|
||||
|
||||
void DynamicObject::Delay(int32 delaytime)
|
||||
{
|
||||
{
|
||||
SetDuration(GetDuration() - delaytime);
|
||||
}
|
||||
|
||||
void DynamicObject::SetAura(Aura* aura)
|
||||
{
|
||||
{
|
||||
ASSERT(!_aura && aura);
|
||||
_aura = aura;
|
||||
}
|
||||
|
||||
void DynamicObject::RemoveAura()
|
||||
{
|
||||
{
|
||||
ASSERT(_aura && !_removedAura);
|
||||
_removedAura = _aura;
|
||||
_aura = nullptr;
|
||||
@@ -199,7 +199,7 @@ void DynamicObject::RemoveAura()
|
||||
}
|
||||
|
||||
void DynamicObject::SetCasterViewpoint()
|
||||
{
|
||||
{
|
||||
if (Player* caster = _caster->ToPlayer())
|
||||
{
|
||||
caster->SetViewpoint(this, true);
|
||||
@@ -208,7 +208,7 @@ void DynamicObject::SetCasterViewpoint()
|
||||
}
|
||||
|
||||
void DynamicObject::RemoveCasterViewpoint()
|
||||
{
|
||||
{
|
||||
if (Player* caster = _caster->ToPlayer())
|
||||
{
|
||||
caster->SetViewpoint(this, false);
|
||||
@@ -217,7 +217,7 @@ void DynamicObject::RemoveCasterViewpoint()
|
||||
}
|
||||
|
||||
void DynamicObject::BindToCaster()
|
||||
{
|
||||
{
|
||||
ASSERT(!_caster);
|
||||
_caster = ObjectAccessor::GetUnit(*this, GetCasterGUID());
|
||||
ASSERT(_caster);
|
||||
@@ -226,7 +226,7 @@ void DynamicObject::BindToCaster()
|
||||
}
|
||||
|
||||
void DynamicObject::UnbindFromCaster()
|
||||
{
|
||||
{
|
||||
ASSERT(_caster);
|
||||
_caster->_UnregisterDynObject(this);
|
||||
_caster = nullptr;
|
||||
|
||||
@@ -22,38 +22,38 @@ enum DynamicObjectType
|
||||
|
||||
class DynamicObject : public WorldObject, public GridObject<DynamicObject>, public MovableMapObject
|
||||
{
|
||||
public:
|
||||
DynamicObject(bool isWorldObject);
|
||||
~DynamicObject();
|
||||
public:
|
||||
DynamicObject(bool isWorldObject);
|
||||
~DynamicObject();
|
||||
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true) override;
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
bool CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type);
|
||||
void Update(uint32 p_time) override;
|
||||
void Remove();
|
||||
void SetDuration(int32 newDuration);
|
||||
int32 GetDuration() const;
|
||||
void Delay(int32 delaytime);
|
||||
void SetAura(Aura* aura);
|
||||
void RemoveAura();
|
||||
void SetCasterViewpoint();
|
||||
void RemoveCasterViewpoint();
|
||||
Unit* GetCaster() const { return _caster; }
|
||||
void BindToCaster();
|
||||
void UnbindFromCaster();
|
||||
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
|
||||
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
|
||||
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
|
||||
bool IsViewpoint() const { return _isViewpoint; }
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true) override;
|
||||
|
||||
protected:
|
||||
Aura* _aura;
|
||||
Aura* _removedAura;
|
||||
Unit* _caster;
|
||||
int32 _duration; // for non-aura dynobjects
|
||||
bool _isViewpoint;
|
||||
bool CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type);
|
||||
void Update(uint32 p_time) override;
|
||||
void Remove();
|
||||
void SetDuration(int32 newDuration);
|
||||
int32 GetDuration() const;
|
||||
void Delay(int32 delaytime);
|
||||
void SetAura(Aura* aura);
|
||||
void RemoveAura();
|
||||
void SetCasterViewpoint();
|
||||
void RemoveCasterViewpoint();
|
||||
Unit* GetCaster() const { return _caster; }
|
||||
void BindToCaster();
|
||||
void UnbindFromCaster();
|
||||
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
|
||||
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
|
||||
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
|
||||
bool IsViewpoint() const { return _isViewpoint; }
|
||||
|
||||
protected:
|
||||
Aura* _aura;
|
||||
Aura* _removedAura;
|
||||
Unit* _caster;
|
||||
int32 _duration; // for non-aura dynobjects
|
||||
bool _isViewpoint;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user