chore(Core/Shared): restyle shared lib with astyle (#3462)

This commit is contained in:
Kargatum
2020-09-11 11:50:48 +07:00
committed by GitHub
parent d47d6d34f3
commit 8b3621779e
10 changed files with 184 additions and 182 deletions
@@ -47,7 +47,7 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
uint32 indexTableSize = std::max(records, (*result)[_sqlIndexPos].GetUInt32() + 1); uint32 indexTableSize = std::max(records, (*result)[_sqlIndexPos].GetUInt32() + 1);
if (indexTableSize > records) if (indexTableSize > records)
{ {
char** tmpIdxTable = new char*[indexTableSize]; char** tmpIdxTable = new char* [indexTableSize];
memset(tmpIdxTable, 0, indexTableSize * sizeof(char*)); memset(tmpIdxTable, 0, indexTableSize * sizeof(char*));
memcpy(tmpIdxTable, indexTable, records * sizeof(char*)); memcpy(tmpIdxTable, indexTable, records * sizeof(char*));
delete[] indexTable; delete[] indexTable;
+1 -1
View File
@@ -282,7 +282,7 @@ enum FactionTemplateFlags
{ {
FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT= 0x00002000, FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT = 0x00002000,
}; };
enum FactionMasks enum FactionMasks
@@ -13,7 +13,7 @@
template <class T> template <class T>
class DBCStorageIterator : public std::iterator<std::forward_iterator_tag, T> class DBCStorageIterator : public std::iterator<std::forward_iterator_tag, T>
{ {
public: public:
DBCStorageIterator() : _index(nullptr), _pos(0), _end(0) { } DBCStorageIterator() : _index(nullptr), _pos(0), _end(0) { }
DBCStorageIterator(T** index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size) DBCStorageIterator(T** index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size)
{ {
@@ -49,7 +49,7 @@ class DBCStorageIterator : public std::iterator<std::forward_iterator_tag, T>
return tmp; return tmp;
} }
private: private:
T** _index; T** _index;
uint32 _pos; uint32 _pos;
uint32 _end; uint32 _end;
+1 -1
View File
@@ -12,7 +12,7 @@
#include "Errors.h" #include "Errors.h"
#include <vector> #include <vector>
/// Interface class for common access /// Interface class for common access
class DBCStorageBase class DBCStorageBase
{ {
public: public:
+8 -5
View File
@@ -28,7 +28,7 @@ struct AchievementEntry
int32 requiredFaction; // 1 -1=all, 0=horde, 1=alliance int32 requiredFaction; // 1 -1=all, 0=horde, 1=alliance
int32 mapID; // 2 -1=none int32 mapID; // 2 -1=none
//uint32 parentAchievement; // 3 its Achievement parent (can`t start while parent uncomplete, use its Criteria if don`t have own, use its progress on begin) //uint32 parentAchievement; // 3 its Achievement parent (can`t start while parent uncomplete, use its Criteria if don`t have own, use its progress on begin)
char *name[16]; // 4-19 char* name[16]; // 4-19
//uint32 name_flags; // 20 //uint32 name_flags; // 20
//char *description[16]; // 21-36 //char *description[16]; // 21-36
//uint32 desc_flags; // 37 //uint32 desc_flags; // 37
@@ -928,7 +928,7 @@ struct FactionTemplateEntry
} }
return (hostileMask & entry.ourMask) != 0; return (hostileMask & entry.ourMask) != 0;
} }
bool IsHostileToPlayers() const { return (hostileMask & FACTION_MASK_PLAYER) !=0; } bool IsHostileToPlayers() const { return (hostileMask & FACTION_MASK_PLAYER) != 0; }
bool IsNeutralToAll() const bool IsNeutralToAll() const
{ {
for (uint8 i = 0; i < MAX_FACTION_RELATIONS; ++i) for (uint8 i = 0; i < MAX_FACTION_RELATIONS; ++i)
@@ -1289,7 +1289,7 @@ struct MapEntry
bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; } bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
bool IsWorldMap() const { return map_type == MAP_COMMON; } bool IsWorldMap() const { return map_type == MAP_COMMON; }
bool GetEntrancePos(int32 &mapid, float &x, float &y) const bool GetEntrancePos(int32& mapid, float& x, float& y) const
{ {
if (entrance_map < 0) if (entrance_map < 0)
return false; return false;
@@ -1994,9 +1994,12 @@ struct VehicleSeatEntry
(m_flags & (VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_ENTER | VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_RIDE)) != 0); (m_flags & (VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_ENTER | VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_RIDE)) != 0);
} }
bool CanSwitchFromSeat() const { return m_flags & VEHICLE_SEAT_FLAG_CAN_SWITCH; } bool CanSwitchFromSeat() const { return m_flags & VEHICLE_SEAT_FLAG_CAN_SWITCH; }
bool IsUsableByOverride() const { return (m_flags & (VEHICLE_SEAT_FLAG_UNCONTROLLED | VEHICLE_SEAT_FLAG_UNK18) bool IsUsableByOverride() const
{
return (m_flags & (VEHICLE_SEAT_FLAG_UNCONTROLLED | VEHICLE_SEAT_FLAG_UNK18)
|| (m_flagsB & (VEHICLE_SEAT_FLAG_B_USABLE_FORCED | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 | || (m_flagsB & (VEHICLE_SEAT_FLAG_B_USABLE_FORCED | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 |
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4))); } VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4)));
}
bool IsEjectable() const { return m_flagsB & VEHICLE_SEAT_FLAG_B_EJECTABLE; } bool IsEjectable() const { return m_flagsB & VEHICLE_SEAT_FLAG_B_EJECTABLE; }
}; };
+8 -8
View File
@@ -38,7 +38,7 @@ RealmSocket::~RealmSocket(void)
peer().close(); peer().close();
} }
int RealmSocket::open(void * arg) int RealmSocket::open(void* arg)
{ {
ACE_INET_Addr addr; ACE_INET_Addr addr;
@@ -90,7 +90,7 @@ size_t RealmSocket::recv_len(void) const
return input_buffer_.length(); return input_buffer_.length();
} }
bool RealmSocket::recv_soft(char *buf, size_t len) bool RealmSocket::recv_soft(char* buf, size_t len)
{ {
if (input_buffer_.length() < len) if (input_buffer_.length() < len)
return false; return false;
@@ -100,7 +100,7 @@ bool RealmSocket::recv_soft(char *buf, size_t len)
return true; return true;
} }
bool RealmSocket::recv(char *buf, size_t len) bool RealmSocket::recv(char* buf, size_t len)
{ {
bool ret = recv_soft(buf, len); bool ret = recv_soft(buf, len);
@@ -115,7 +115,7 @@ void RealmSocket::recv_skip(size_t len)
input_buffer_.rd_ptr(len); input_buffer_.rd_ptr(len);
} }
ssize_t RealmSocket::noblk_send(ACE_Message_Block &message_block) ssize_t RealmSocket::noblk_send(ACE_Message_Block& message_block)
{ {
const size_t len = message_block.length(); const size_t len = message_block.length();
@@ -146,7 +146,7 @@ ssize_t RealmSocket::noblk_send(ACE_Message_Block &message_block)
return n; return n;
} }
bool RealmSocket::send(const char *buf, size_t len) bool RealmSocket::send(const char* buf, size_t len)
{ {
if (buf == NULL || len == 0) if (buf == NULL || len == 0)
return true; return true;
@@ -174,7 +174,7 @@ bool RealmSocket::send(const char *buf, size_t len)
ACE_Message_Block* mb = message_block.clone(); ACE_Message_Block* mb = message_block.clone();
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value *)(&ACE_Time_Value::zero)) == -1) if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)(&ACE_Time_Value::zero)) == -1)
{ {
mb->release(); mb->release();
return false; return false;
@@ -199,7 +199,7 @@ int RealmSocket::handle_output(ACE_HANDLE)
return 0; return 0;
} }
if (msg_queue()->dequeue_head(mb, (ACE_Time_Value *)(&ACE_Time_Value::zero)) == -1) if (msg_queue()->dequeue_head(mb, (ACE_Time_Value*)(&ACE_Time_Value::zero)) == -1)
return -1; return -1;
ssize_t n = noblk_send(*mb); ssize_t n = noblk_send(*mb);
@@ -218,7 +218,7 @@ int RealmSocket::handle_output(ACE_HANDLE)
{ {
mb->rd_ptr(n); mb->rd_ptr(n);
if (msg_queue()->enqueue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) if (msg_queue()->enqueue_head(mb, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1)
{ {
mb->release(); mb->release();
return -1; return -1;
+5 -5
View File
@@ -35,17 +35,17 @@ public:
virtual ~RealmSocket(void); virtual ~RealmSocket(void);
size_t recv_len(void) const; size_t recv_len(void) const;
bool recv_soft(char *buf, size_t len); bool recv_soft(char* buf, size_t len);
bool recv(char *buf, size_t len); bool recv(char* buf, size_t len);
void recv_skip(size_t len); void recv_skip(size_t len);
bool send(const char *buf, size_t len); bool send(const char* buf, size_t len);
const std::string& getRemoteAddress(void) const; const std::string& getRemoteAddress(void) const;
uint16 getRemotePort(void) const; uint16 getRemotePort(void) const;
virtual int open(void *); virtual int open(void*);
virtual int close(u_long); virtual int close(u_long);
@@ -57,7 +57,7 @@ public:
void set_session(Session* session); void set_session(Session* session);
private: private:
ssize_t noblk_send(ACE_Message_Block &message_block); ssize_t noblk_send(ACE_Message_Block& message_block);
ACE_Message_Block input_buffer_; ACE_Message_Block input_buffer_;
Session* session_; Session* session_;
+1 -2
View File
@@ -94,7 +94,6 @@ void RealmList::UpdateRealms(bool init)
if (init) if (init)
sLog->outString("Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port); sLog->outString("Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port);
} } while (result->NextRow());
while (result->NextRow());
} }
} }
+1 -1
View File
@@ -59,7 +59,7 @@ public:
uint32 size() const { return m_realms.size(); } uint32 size() const { return m_realms.size(); }
private: private:
void UpdateRealms(bool init=false); void UpdateRealms(bool init = false);
void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
RealmMap m_realms; RealmMap m_realms;