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,8 +31,8 @@ Bag::~Bag()
if (item->IsInWorld())
{
sLog->outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i);
item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i);
item->RemoveFromWorld();
}
delete m_bagslot[i];
@@ -82,7 +82,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
// Cleaning 20 slots
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i * 2), 0);
m_bagslot[i] = nullptr;
}
@@ -104,7 +104,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i * 2), 0);
delete m_bagslot[i];
m_bagslot[i] = nullptr;
}
@@ -124,7 +124,7 @@ void Bag::DeleteFromDB(SQLTransaction& trans)
uint32 Bag::GetFreeSlots() const
{
uint32 slots = 0;
for (uint32 i=0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (!m_bagslot[i])
++slots;
@@ -180,7 +180,7 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
{
Item* pItem;
uint32 count = 0;
for (uint32 i=0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
if (pItem && pItem != eItem && pItem->GetEntry() == item)
@@ -189,7 +189,7 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
if (eItem && eItem->GetTemplate()->GemProperties)
{
for (uint32 i=0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
if (pItem && pItem != eItem && pItem->GetTemplate()->Socket[0].Color)

View File

@@ -15,43 +15,43 @@
class Bag : public Item
{
public:
public:
Bag();
~Bag();
Bag();
~Bag();
void AddToWorld();
void RemoveFromWorld();
void AddToWorld();
void RemoveFromWorld();
bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
void Clear();
void StoreItem(uint8 slot, Item* pItem, bool update);
void RemoveItem(uint8 slot, bool update);
void Clear();
void StoreItem(uint8 slot, Item* pItem, bool update);
void RemoveItem(uint8 slot, bool update);
Item* GetItemByPos(uint8 slot) const;
uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
Item* GetItemByPos(uint8 slot) const;
uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
uint8 GetSlotByItemGUID(uint64 guid) const;
bool IsEmpty() const;
uint32 GetFreeSlots() const;
uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
uint8 GetSlotByItemGUID(uint64 guid) const;
bool IsEmpty() const;
uint32 GetFreeSlots() const;
uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
// DB operations
// overwrite virtual Item::SaveToDB
void SaveToDB(SQLTransaction& trans);
// overwrite virtual Item::LoadFromDB
bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry);
// overwrite virtual Item::DeleteFromDB
void DeleteFromDB(SQLTransaction& trans);
// DB operations
// overwrite virtual Item::SaveToDB
void SaveToDB(SQLTransaction& trans);
// overwrite virtual Item::LoadFromDB
bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry);
// overwrite virtual Item::DeleteFromDB
void DeleteFromDB(SQLTransaction& trans);
void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const;
void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const;
protected:
protected:
// Bag Storage space
Item* m_bagslot[MAX_BAG_SIZE];
// Bag Storage space
Item* m_bagslot[MAX_BAG_SIZE];
};
inline Item* NewItemOrBag(ItemTemplate const* proto)