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

@@ -35,7 +35,7 @@ bool AuctionListItemsDelayEvent::Execute()
//sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
// GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4)+50*((16+MAX_INSPECTED_ENCHANTMENT_SLOT*3)*4));
WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4 + 4) + 50 * ((16 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3) * 4));
uint32 count = 0;
uint32 totalcount = 0;
data << (uint32) 0;
@@ -48,9 +48,9 @@ bool AuctionListItemsDelayEvent::Execute()
wstrToLower(wsearchedname);
bool result = auctionHouse->BuildListAuctionItems(data, plr,
wsearchedname, _listfrom, _levelmin, _levelmax, _usable,
_auctionSlotID, _auctionMainCategory, _auctionSubCategory, _quality,
count, totalcount, _getAll);
wsearchedname, _listfrom, _levelmin, _levelmax, _usable,
_auctionSlotID, _auctionMainCategory, _auctionSubCategory, _quality,
count, totalcount, _getAll);
if (!result)
return false;

View File

@@ -7,18 +7,18 @@
class AuctionListOwnerItemsDelayEvent : public BasicEvent
{
public:
AuctionListOwnerItemsDelayEvent(uint64 _creatureGuid, uint64 guid, bool o) : creatureGuid(_creatureGuid), playerguid(guid), owner(o) {}
virtual ~AuctionListOwnerItemsDelayEvent() {}
public:
AuctionListOwnerItemsDelayEvent(uint64 _creatureGuid, uint64 guid, bool o) : creatureGuid(_creatureGuid), playerguid(guid), owner(o) {}
virtual ~AuctionListOwnerItemsDelayEvent() {}
virtual bool Execute(uint64 e_time, uint32 p_time);
virtual void Abort(uint64 /*e_time*/) {}
bool getOwner() { return owner; }
virtual bool Execute(uint64 e_time, uint32 p_time);
virtual void Abort(uint64 /*e_time*/) {}
bool getOwner() { return owner; }
private:
uint64 creatureGuid;
uint64 playerguid;
bool owner;
private:
uint64 creatureGuid;
uint64 playerguid;
bool owner;
};
class AuctionListItemsDelayEvent
@@ -53,8 +53,8 @@ public:
static bool IsAuctionListingAllowed() { return auctionListingAllowed; }
static void SetAuctionListingAllowed(bool a) { auctionListingAllowed = a; }
static std::list<AuctionListItemsDelayEvent> & GetList() { return auctionListingList; }
static std::list<AuctionListItemsDelayEvent> & GetTempList() { return auctionListingListTemp; }
static std::list<AuctionListItemsDelayEvent>& GetList() { return auctionListingList; }
static std::list<AuctionListItemsDelayEvent>& GetTempList() { return auctionListingListTemp; }
static ACE_Thread_Mutex& GetLock() { return auctionListingLock; }
static ACE_Thread_Mutex& GetTempLock() { return auctionListingTempLock; }

View File

@@ -17,16 +17,16 @@ public:
uint32 getTimeWeightedAverage()
{
if (tab[AVG_DIFF_COUNT-1] == 0)
if (tab[AVG_DIFF_COUNT - 1] == 0)
return 0;
uint32 sum = 0, weightsum = 0;
for (uint32 i=0; i<AVG_DIFF_COUNT; ++i)
for (uint32 i = 0; i < AVG_DIFF_COUNT; ++i)
{
sum += tab[i]*tab[i];
sum += tab[i] * tab[i];
weightsum += tab[i];
}
return sum/weightsum;
return sum / weightsum;
}
uint32 getMax()
@@ -50,10 +50,10 @@ public:
max[0] = 0;
}
if (tab[AVG_DIFF_COUNT-1])
average = total/AVG_DIFF_COUNT;
if (tab[AVG_DIFF_COUNT - 1])
average = total / AVG_DIFF_COUNT;
else if (index)
average = total/index;
average = total / index;
else
average = 0;
}

View File

@@ -33,7 +33,7 @@ BanReturn BanManager::BanAccount(std::string const& AccountName, std::string con
///- Disconnect all affected players (for IP it can be several)
SQLTransaction trans = LoginDatabase.BeginTransaction();
// pussywizard: check existing ban to prevent overriding by a shorter one! >_>
PreparedStatement* stmtAccountBanned = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED);
stmtAccountBanned->setUInt32(0, AccountID);
@@ -105,7 +105,7 @@ BanReturn BanManager::BanAccountByPlayerName(std::string const& CharacterName, s
return BAN_LONGER_EXISTS;
// make sure there is only one active ban
PreparedStatement * stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED);
stmt->setUInt32(0, AccountID);
trans->Append(stmt);
@@ -209,7 +209,7 @@ BanReturn BanManager::BanIP(std::string const& IP, std::string const& Duration,
/// Ban an character, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
BanReturn BanManager::BanCharacter(std::string const& CharacterName, std::string const& Duration, std::string const& Reason, std::string const& Author)
{
Player* target = ObjectAccessor::FindPlayerByName(CharacterName, false);
Player* target = ObjectAccessor::FindPlayerByName(CharacterName, false);
uint32 DurationSecs = TimeStringToSecs(Duration);
uint32 TargetGUID = 0;

View File

@@ -7,7 +7,7 @@
#include "Common.h"
/// Ban function return codes
/// Ban function return codes
enum BanReturn
{
BAN_SUCCESS,

View File

@@ -4,8 +4,8 @@ uint8 DynamicVisibilityMgr::visibilitySettingsIndex = 0;
void DynamicVisibilityMgr::Update(uint32 sessionCount)
{
if (sessionCount >= (visibilitySettingsIndex+1)*((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL) && visibilitySettingsIndex < VISIBILITY_SETTINGS_MAX_INTERVAL_NUM-1)
if (sessionCount >= (visibilitySettingsIndex + 1) * ((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL) && visibilitySettingsIndex < VISIBILITY_SETTINGS_MAX_INTERVAL_NUM - 1)
++visibilitySettingsIndex;
else if (visibilitySettingsIndex && sessionCount < visibilitySettingsIndex*((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL)-100)
else if (visibilitySettingsIndex && sessionCount < visibilitySettingsIndex * ((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL) - 100)
--visibilitySettingsIndex;
}

View File

@@ -12,7 +12,7 @@ Graveyard* Graveyard::instance()
void Graveyard::LoadGraveyardFromDB()
{
uint32 oldMSTime = getMSTime();
uint32 oldMSTime = getMSTime();
_graveyardStore.clear();
@@ -38,7 +38,7 @@ void Graveyard::LoadGraveyardFromDB()
Graveyard.y = fields[3].GetFloat();
Graveyard.z = fields[4].GetFloat();
Graveyard.name = fields[5].GetString();
if (!Utf8toWStr(Graveyard.name, Graveyard.wnameLow))
{
sLog->outErrorDb("Wrong UTF8 name for id %u in `game_graveyard` table, ignoring.", ID);
@@ -143,9 +143,9 @@ GraveyardStruct const* Graveyard::GetClosestGraveyard(float x, float y, float z,
{
// if find graveyard at different map from where entrance placed (or no entrance data), use any first
if (!mapEntry
|| mapEntry->entrance_map < 0
|| uint32(mapEntry->entrance_map) != entry->Map
|| (mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0))
|| mapEntry->entrance_map < 0
|| uint32(mapEntry->entrance_map) != entry->Map
|| (mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0))
{
// not have any corrdinates for check distance anyway
entryFar = entry;
@@ -153,8 +153,8 @@ GraveyardStruct const* Graveyard::GetClosestGraveyard(float x, float y, float z,
}
// at entrance map calculate distance (2D);
float dist2 = (entry->x - mapEntry->entrance_x)*(entry->x - mapEntry->entrance_x)
+ (entry->y - mapEntry->entrance_y)*(entry->y - mapEntry->entrance_y);
float dist2 = (entry->x - mapEntry->entrance_x) * (entry->x - mapEntry->entrance_x)
+ (entry->y - mapEntry->entrance_y) * (entry->y - mapEntry->entrance_y);
if (foundEntr)
{
if (dist2 < distEntr)
@@ -173,7 +173,7 @@ GraveyardStruct const* Graveyard::GetClosestGraveyard(float x, float y, float z,
// find now nearest graveyard at same map
else
{
float dist2 = (entry->x - x)*(entry->x - x) + (entry->y - y)*(entry->y - y) + (entry->z - z)*(entry->z - z);
float dist2 = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y) + (entry->z - z) * (entry->z - z);
if (foundNear)
{
if (dist2 < distNear)
@@ -254,7 +254,7 @@ void Graveyard::RemoveGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, boo
for (; range.first != range.second; ++range.first)
{
GraveyardData & data = range.first->second;
GraveyardData& data = range.first->second;
// skip not matching safezone id
if (data.safeLocId != id)

View File

@@ -30,12 +30,12 @@ class Graveyard
public:
static Graveyard* instance();
typedef std::unordered_map<uint32, GraveyardStruct> GraveyardContainer;
typedef std::unordered_map<uint32, GraveyardStruct> GraveyardContainer;
GraveyardStruct const* GetGraveyard(uint32 ID) const;
GraveyardStruct const* GetGraveyard(const std::string& name) const;
GraveyardStruct const* GetDefaultGraveyard(TeamId teamId);
GraveyardStruct const* GetClosestGraveyard(float x, float y, float z, uint32 MapId, TeamId teamId);
GraveyardStruct const* GetClosestGraveyard(float x, float y, float z, uint32 MapId, TeamId teamId);
GraveyardData const* FindGraveyardData(uint32 id, uint32 zone);
GraveyardContainer const& GetGraveyardData() const { return _graveyardStore; }
bool AddGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, bool persist = true);

View File

@@ -24,8 +24,8 @@ void SavingSystemMgr::Update(uint32 diff)
return;
}
if (GetSavingMaxValue()-GetSavingCurrentValue() > playerCount+m_savingSkipList.size()) // this should not happen, but just in case
m_savingMaxValueAssigned = m_savingCurrentValue+playerCount+m_savingSkipList.size();
if (GetSavingMaxValue() - GetSavingCurrentValue() > playerCount + m_savingSkipList.size()) // this should not happen, but just in case
m_savingMaxValueAssigned = m_savingCurrentValue + playerCount + m_savingSkipList.size();
if (playerCount <= 1500) // every 2min
multiplicator = 1000.0f / playerCount;
@@ -41,7 +41,7 @@ void SavingSystemMgr::Update(uint32 diff)
multiplicator = 4000.0f / playerCount;
m_savingDiffSum += diff;
while (m_savingDiffSum >= (uint32)(step*multiplicator))
while (m_savingDiffSum >= (uint32)(step * multiplicator))
{
IncreaseSavingCurrentValue(1);
@@ -51,7 +51,7 @@ void SavingSystemMgr::Update(uint32 diff)
m_savingSkipList.pop_front();
}
m_savingDiffSum -= (uint32)(step*multiplicator);
m_savingDiffSum -= (uint32)(step * multiplicator);
if (GetSavingCurrentValue() > GetSavingMaxValue())
{

View File

@@ -10,7 +10,7 @@ void WhoListCacheMgr::Update()
{
// clear current list
m_whoOpcodeList.clear();
m_whoOpcodeList.reserve(sWorld->GetPlayerCount()+1);
m_whoOpcodeList.reserve(sWorld->GetPlayerCount() + 1);
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();

View File

@@ -20,14 +20,14 @@ struct WhoListPlayerInfo
std::string gname;
WhoListPlayerInfo(TeamId teamId, AccountTypes security, uint8 level, uint8 clas, uint8 race, uint32 zoneid, uint8 gender, std::wstring wpname, std::wstring wgname, std::string aname, std::string pname, std::string gname) :
teamId(teamId), security(security), level(level), clas(clas), race(race), zoneid(zoneid), gender(gender), wpname(wpname), wgname(wgname), aname(aname), pname(pname), gname(gname) {}
teamId(teamId), security(security), level(level), clas(clas), race(race), zoneid(zoneid), gender(gender), wpname(wpname), wgname(wgname), aname(aname), pname(pname), gname(gname) {}
};
class WhoListCacheMgr
{
public:
static void Update();
static std::vector<WhoListPlayerInfo> * GetWhoList() { return &m_whoOpcodeList; }
static std::vector<WhoListPlayerInfo>* GetWhoList() { return &m_whoOpcodeList; }
protected:
static std::vector<WhoListPlayerInfo> m_whoOpcodeList;