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

@@ -31,9 +31,9 @@
#include "UpdateFieldFlags.h"
Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0),
rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT)
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0),
rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT)
{
}
@@ -52,10 +52,10 @@ Loot* Roll::getLoot()
}
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
m_bfGroup(nullptr), m_bgGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_masterLooterGuid(0), m_subGroupsCounts(nullptr), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), _difficultyChangePreventionTime(0),
_difficultyChangePreventionType(DIFFICULTY_PREVENTION_CHANGE_NONE)
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
m_bfGroup(nullptr), m_bgGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_masterLooterGuid(0), m_subGroupsCounts(nullptr), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), _difficultyChangePreventionTime(0),
_difficultyChangePreventionType(DIFFICULTY_PREVENTION_CHANGE_NONE)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = 0;
@@ -76,7 +76,7 @@ Group::~Group()
while (!RollId.empty())
{
itr = RollId.begin();
Roll *r = *itr;
Roll* r = *itr;
RollId.erase(itr);
delete(r);
}
@@ -178,7 +178,7 @@ bool Group::LoadGroupFromDB(Field* fields)
m_lootThreshold = ItemQualities(fields[3].GetUInt8());
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = fields[4+i].GetUInt32();
m_targetIcons[i] = fields[4 + i].GetUInt32();
m_groupType = GroupType(fields[12].GetUInt8());
if (m_groupType & GROUPTYPE_RAID)
@@ -192,9 +192,9 @@ bool Group::LoadGroupFromDB(Field* fields)
uint32 r_diff = fields[14].GetUInt8();
if (r_diff >= MAX_RAID_DIFFICULTY)
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
else
m_raidDifficulty = Difficulty(r_diff);
m_raidDifficulty = Difficulty(r_diff);
m_masterLooterGuid = MAKE_NEW_GUID(fields[15].GetUInt32(), 0, HIGHGUID_PLAYER);
@@ -320,7 +320,7 @@ void Group::RemoveInvite(Player* player)
void Group::RemoveAllInvites()
{
for (InvitesList::iterator itr=m_invitees.begin(); itr != m_invitees.end(); ++itr)
for (InvitesList::iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
if (*itr)
(*itr)->SetGroupInvite(nullptr);
@@ -498,7 +498,7 @@ bool Group::AddMember(Player* player)
return true;
}
bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/)
bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/)
{
BroadcastGroupUpdate();
@@ -519,7 +519,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
if (isBGGroup() || isBFGroup())
player->RemoveFromBattlegroundOrBattlefieldRaid();
else
// Regular group
// Regular group
{
if (player->GetOriginalGroup() == this)
player->SetOriginalGroup(nullptr);
@@ -539,7 +539,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
}
// Do we really need to send this opcode?
data.Initialize(SMSG_GROUP_LIST, 1+1+1+1+8+4+4+8);
data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8);
data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0);
data << uint64(m_guid) << uint32(m_counter) << uint32(0) << uint64(0);
player->GetSession()->SendPacket(&data);
@@ -693,7 +693,7 @@ void Group::ChangeLeader(uint64 newLeaderGuid)
m_leaderName = newLeader->GetName();
ToggleGroupMemberFlag(slot, MEMBER_FLAG_ASSISTANT, false);
WorldPacket data(SMSG_GROUP_SET_LEADER, m_leaderName.size()+1);
WorldPacket data(SMSG_GROUP_SET_LEADER, m_leaderName.size() + 1);
data << slot->name;
BroadcastPacket(&data, true);
@@ -750,7 +750,7 @@ void Group::Disband(bool hideDestroy /* = false */)
}
else
{
data.Initialize(SMSG_GROUP_LIST, 1+1+1+1+8+4+4+8);
data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8);
data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0);
data << uint64(m_guid) << uint32(m_counter) << uint32(0) << uint64(0);
player->GetSession()->SendPacket(&data);
@@ -788,9 +788,9 @@ void Group::Disband(bool hideDestroy /* = false */)
/*** LOOT SYSTEM ***/
/*********************************************************/
void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll& r)
{
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4+1));
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
data << uint64(r.itemGUID); // guid of rolled item
data << uint32(mapid); // 3.3.3 mapid
data << uint32(r.itemSlot); // itemslot
@@ -801,7 +801,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
data << uint32(CountDown); // the countdown time to choose "need" or "greed"
data << uint8(r.rollVoteMask); // roll type mask
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->first);
if (!p)
@@ -836,7 +836,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
WorldPacket data(SMSG_LOOT_ROLL, (8 + 4 + 8 + 4 + 4 + 4 + 1 + 1 + 1));
data << uint64(sourceGuid); // guid of the item rolled
data << uint32(roll.itemSlot); // slot
data << uint64(targetGuid);
@@ -860,7 +860,7 @@ void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber,
void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
WorldPacket data(SMSG_LOOT_ROLL_WON, (8 + 4 + 4 + 4 + 4 + 8 + 1 + 1));
data << uint64(sourceGuid); // guid of the item rolled
data << uint32(roll.itemSlot); // slot
data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
@@ -883,7 +883,7 @@ void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumb
void Group::SendLootAllPassed(Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8 + 4 + 4 + 4 + 4));
data << uint64(roll.itemGUID); // Guid of the item rolled
data << uint32(roll.itemSlot); // Item loot slot
data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
@@ -906,7 +906,7 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
{
ASSERT(creature);
WorldPacket data(SMSG_LOOT_LIST, (8+8));
WorldPacket data(SMSG_LOOT_LIST, (8 + 8));
data << uint64(creature->GetGUID());
if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
@@ -982,7 +982,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
// If there is any "auto pass", broadcast the pass now.
if (r->totalPass)
{
for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayer(itr->first);
if (!p)
@@ -1321,7 +1321,8 @@ void Group::EndRoll(Loot* pLoot, Map* allowedMap)
{
for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();)
{
if ((*itr)->getLoot() == pLoot) {
if ((*itr)->getLoot() == pLoot)
{
CountTheRoll(itr, allowedMap); //i don't have to edit player votes, who didn't vote ... he will pass
itr = RollId.begin();
}
@@ -1349,7 +1350,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
uint64 maxguid = 0; // pussywizard: start with 0 >_>
Player* player = nullptr;
for (Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
for (Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
{
if (itr->second != NEED)
continue;
@@ -1502,13 +1503,13 @@ void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid)
// clean other icons
if (targetGuid != 0)
for (int i=0; i<TARGETICONCOUNT; ++i)
for (int i = 0; i < TARGETICONCOUNT; ++i)
if (m_targetIcons[i] == targetGuid)
SetTargetIcon(i, 0, 0);
m_targetIcons[id] = targetGuid;
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+8+1+8));
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1 + 8 + 1 + 8));
data << uint8(0); // set targets
data << uint64(whoGuid);
data << uint8(id);
@@ -1521,7 +1522,7 @@ void Group::SendTargetIconList(WorldSession* session)
if (!session)
return;
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9));
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1 + TARGETICONCOUNT * 9));
data << uint8(1); // list targets
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
@@ -1560,7 +1561,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
slot = &(*witr);
}
WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+1+4+8+4+4+(GetMembersCount()-1)*(13+8+1+1+1+1)+8+1+8+1+1+1+1));
WorldPacket data(SMSG_GROUP_LIST, (1 + 1 + 1 + 1 + 1 + 4 + 8 + 4 + 4 + (GetMembersCount() - 1) * (13 + 8 + 1 + 1 + 1 + 1) + 8 + 1 + 8 + 1 + 1 + 1 + 1));
data << uint8(m_groupType); // group type (flags in 3.3)
data << uint8(slot->group);
data << uint8(slot->flags);
@@ -1573,7 +1574,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
data << uint64(m_guid);
data << uint32(m_counter++); // 3.3, value increases every time this packet gets sent
data << uint32(GetMembersCount()-1);
data << uint32(GetMembersCount() - 1);
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
if (slot->guid == citr->guid)
@@ -2074,7 +2075,7 @@ void Group::SetLfgRoles(uint64 guid, const uint8 roles)
return;
slot->roles = roles;
SendUpdate();
SendUpdate();
}
bool Group::IsFull() const
@@ -2122,7 +2123,7 @@ uint32 Group::GetLowGUID() const
return GUID_LOPART(m_guid);
}
const char * Group::GetLeaderName() const
const char* Group::GetLeaderName() const
{
return m_leaderName.c_str();
}
@@ -2177,7 +2178,7 @@ bool Group::SameSubGroup(uint64 guid1, uint64 guid2) const
{
member_citerator mslot2 = _getMemberCSlot(guid2);
if (mslot2 == m_memberSlots.end())
return false;
return false;
return SameSubGroup(guid1, &*mslot2);
}
@@ -2198,7 +2199,7 @@ uint8 Group::GetMemberGroup(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if (mslot == m_memberSlots.end())
return (MAX_RAID_SUBGROUPS+1);
return (MAX_RAID_SUBGROUPS + 1);
return mslot->group;
}
@@ -2207,7 +2208,7 @@ void Group::SetBattlegroundGroup(Battleground* bg)
m_bgGroup = bg;
}
void Group::SetBattlefieldGroup(Battlefield *bg)
void Group::SetBattlefieldGroup(Battlefield* bg)
{
m_bfGroup = bg;
}
@@ -2216,7 +2217,7 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
if (!isRaidGroup())
return;
return;
// Check if player is really in the raid
member_witerator slot = _getMemberWSlot(guid);
@@ -2224,7 +2225,8 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
return;
// Do flag specific actions, e.g ensure uniqueness
switch (flag) {
switch (flag)
{
case MEMBER_FLAG_MAINASSIST:
RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST); // Remove main assist flag from current if any.
break;
@@ -2275,7 +2277,7 @@ bool Group::isRollLootActive() const
Group::Rolls::iterator Group::GetRoll(uint64 Guid)
{
Rolls::iterator iter;
for (iter=RollId.begin(); iter != RollId.end(); ++iter)
for (iter = RollId.begin(); iter != RollId.end(); ++iter)
if ((*iter)->itemGUID == Guid && (*iter)->isValid())
return iter;
return RollId.end();