refactor(Core/Game): restyle game lib with astyle (#3466)

This commit is contained in:
Kargatum
2020-10-12 15:08:15 +07:00
committed by GitHub
parent e99b526e17
commit a2b26272d2
338 changed files with 52196 additions and 50944 deletions

View File

@@ -21,7 +21,7 @@
#include "MoveSplineInit.h"
#include <cassert>
inline bool isStatic(MovementGenerator *mv)
inline bool isStatic(MovementGenerator* mv)
{
return (mv == &si_idleMovement);
}
@@ -31,7 +31,7 @@ void MotionMaster::Initialize()
// clear ALL movement generators (including default)
while (!empty())
{
MovementGenerator *curr = top();
MovementGenerator* curr = top();
pop();
if (curr) DirectDelete(curr);
}
@@ -59,7 +59,7 @@ MotionMaster::~MotionMaster()
// clear ALL movement generators (including default)
while (!empty())
{
MovementGenerator *curr = top();
MovementGenerator* curr = top();
pop();
if (curr && !isStatic(curr))
delete curr; // Skip finalizing on delete, it might launch new movement
@@ -128,7 +128,7 @@ void MotionMaster::DirectClean(bool reset)
{
while (size() > 1)
{
MovementGenerator *curr = top();
MovementGenerator* curr = top();
pop();
if (curr) DirectDelete(curr);
}
@@ -146,7 +146,7 @@ void MotionMaster::DelayedClean()
{
while (size() > 1)
{
MovementGenerator *curr = top();
MovementGenerator* curr = top();
pop();
if (curr) DelayedDelete(curr);
}
@@ -156,7 +156,7 @@ void MotionMaster::DirectExpire(bool reset)
{
if (size() > 1)
{
MovementGenerator *curr = top();
MovementGenerator* curr = top();
pop();
if (curr) DirectDelete(curr);
}
@@ -176,7 +176,7 @@ void MotionMaster::DelayedExpire()
{
if (size() > 1)
{
MovementGenerator *curr = top();
MovementGenerator* curr = top();
pop();
if (curr) DelayedDelete(curr);
}
@@ -189,7 +189,7 @@ void MotionMaster::DirectExpireSlot(MovementSlot slot, bool reset)
{
if (size() > 1)
{
MovementGenerator *curr = Impl[slot];
MovementGenerator* curr = Impl[slot];
// pussywizard: clear slot AND decrease top immediately to avoid crashes when referencing null top in DirectDelete
Impl[slot] = nullptr;
@@ -302,9 +302,9 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)",
_owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
_owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
#endif
Mutate(new ChaseMovementGenerator<Player>(target, dist, angle), MOTION_SLOT_ACTIVE);
}
@@ -312,9 +312,9 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
#endif
Mutate(new ChaseMovementGenerator<Creature>(target, dist, angle), MOTION_SLOT_ACTIVE);
}
@@ -332,8 +332,8 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
#endif
Mutate(new FollowMovementGenerator<Player>(target, dist, angle), slot);
}
@@ -341,9 +341,9 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
#endif
Mutate(new FollowMovementGenerator<Creature>(target, dist, angle), slot);
}
@@ -366,7 +366,7 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z);
_owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z);
#endif
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
}
@@ -522,7 +522,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
#endif
return;
}
@@ -540,7 +540,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard
{
_owner->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING);
_owner->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING|MOVEMENTFLAG_CAN_FLY);
_owner->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY);
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
_owner->m_movementInfo.SetFallTime(0);
_owner->SendMovementFlagUpdate();
@@ -573,7 +573,7 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
#endif
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed, orientation, path, generatePath, generatePath), MOTION_SLOT_CONTROLLED);
}
@@ -593,7 +593,7 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
#endif
_owner->AttackStop();
_owner->CastStop(0, false);
@@ -616,7 +616,7 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), time);
_owner->GetEntry(), _owner->GetGUIDLow(), time);
#endif
Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
}
@@ -635,8 +635,8 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow());
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow());
#endif
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
@@ -644,10 +644,10 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
_owner->GetEntry(), _owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(),
time ? " for a limited time" : "");
_owner->GetEntry(), _owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(),
time ? " for a limited time" : "");
#endif
if (time)
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
@@ -672,13 +672,13 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
else
{
sLog->outError("%s attempt taxi to (not existed Path %u node %u)",
_owner->GetName().c_str(), path, pathnode);
_owner->GetName().c_str(), path, pathnode);
}
}
else
{
sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode);
_owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode);
}
}
@@ -693,15 +693,15 @@ void MotionMaster::MoveDistract(uint32 timer)
/*if (_owner->GetTypeId() == TYPEID_PLAYER)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer);
#endif
#endif
}
else
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)",
#endif
#endif
_owner->GetEntry(), _owner->GetGUIDLow(), timer);
}*/
@@ -709,9 +709,9 @@ void MotionMaster::MoveDistract(uint32 timer)
Mutate(mgen, MOTION_SLOT_CONTROLLED);
}
void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot)
void MotionMaster::Mutate(MovementGenerator* m, MovementSlot slot)
{
while (MovementGenerator *curr = Impl[slot])
while (MovementGenerator* curr = Impl[slot])
{
bool delayed = (_top == slot && (_cleanFlag & MMCF_UPDATE));
@@ -760,13 +760,13 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
}*/
//_owner->GetTypeId() == TYPEID_PLAYER ?
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
#endif
}
@@ -803,10 +803,10 @@ void MotionMaster::ReinitializeMovement()
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
{
if (empty())
return IDLE_MOTION_TYPE;
if (empty())
return IDLE_MOTION_TYPE;
return top()->GetMovementGeneratorType();
return top()->GetMovementGeneratorType();
}
MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const
@@ -820,10 +820,10 @@ MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const
// Xinef: Escort system
uint32 MotionMaster::GetCurrentSplineId() const
{
if (empty())
return 0;
if (empty())
return 0;
return top()->GetSplineId();
return top()->GetSplineId();
}
void MotionMaster::InitTop()
@@ -850,7 +850,7 @@ void MotionMaster::DelayedDelete(_Ty curr)
_expList->push_back(curr);
}
bool MotionMaster::GetDestination(float &x, float &y, float &z)
bool MotionMaster::GetDestination(float& x, float& y, float& z)
{
if (_owner->movespline->Finalized())
return false;