refactor(Core/Creature): More functions capitalized (#10012)

* GetLeader

* IsFormed

* build
This commit is contained in:
Kitzunu
2022-02-10 18:40:00 +01:00
committed by GitHub
parent 0fa4a90aa8
commit 9d166722c4
5 changed files with 11 additions and 9 deletions

View File

@@ -993,12 +993,12 @@ void Creature::Motion_Initialize()
{
if (!m_formation)
GetMotionMaster()->Initialize();
else if (m_formation->getLeader() == this)
else if (m_formation->GetLeader() == this)
{
m_formation->FormationReset(false, true);
GetMotionMaster()->Initialize();
}
else if (m_formation->isFormed())
else if (m_formation->IsFormed())
GetMotionMaster()->MoveIdle(); //wait the order of leader
else
GetMotionMaster()->Initialize();
@@ -1849,7 +1849,7 @@ void Creature::setDeathState(DeathState s, bool despawn)
}
//Dismiss group if is leader
if (m_formation && m_formation->getLeader() == this)
if (m_formation && m_formation->GetLeader() == this)
m_formation->FormationReset(true, false);
bool needsFalling = !despawn && (IsFlying() || IsHovering()) && !IsUnderWater();

View File

@@ -91,10 +91,12 @@ public:
explicit CreatureGroup(uint32 id) : m_leader(nullptr), m_groupID(id), m_Formed(false) {}
~CreatureGroup() {}
Creature* getLeader() const { return m_leader; }
Creature* GetLeader() const { return m_leader; }
uint32 GetId() const { return m_groupID; }
bool IsEmpty() const { return m_members.empty(); }
bool isFormed() const { return m_Formed; }
bool IsFormed() const { return m_Formed; }
const CreatureGroupMemberType& GetMembers() const { return m_members; }
void AddMember(Creature* member);

View File

@@ -53,7 +53,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
init.MoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ());
init.SetWalk(true);
init.Launch();
if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
creature->GetFormation()->LeaderMoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ(), false);
return;
}
@@ -223,7 +223,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
_preComputedPaths.erase(pathIdx);
//Call for creature group update
if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
creature->GetFormation()->LeaderMoveTo(finalPoint.x, finalPoint.y, finalPoint.z, false);
}

View File

@@ -200,7 +200,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
init.Launch();
//Call for creature group update
if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z, node->move_type == WAYPOINT_MOVE_TYPE_RUN);
return true;

View File

@@ -227,7 +227,7 @@ struct npc_cameron : public ScriptedAI
_childrenGUIDs.push_back(jose->GetGUID());
// If Formation was disbanded, remake.
if (!me->GetFormation()->isFormed())
if (!me->GetFormation()->IsFormed())
for (auto guid : _childrenGUIDs)
if (Creature* child = ObjectAccessor::GetCreature(*me, guid))
child->SearchFormation();