refactor(Core): NULL -> nullptr (#3275)
* NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com> Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
@@ -83,7 +83,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
{
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
|
||||
m_bagslot[i] = NULL;
|
||||
m_bagslot[i] = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -106,7 +106,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry
|
||||
{
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
|
||||
delete m_bagslot[i];
|
||||
m_bagslot[i] = NULL;
|
||||
m_bagslot[i] = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -136,9 +136,9 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/)
|
||||
ASSERT(slot < MAX_BAG_SIZE);
|
||||
|
||||
if (m_bagslot[slot])
|
||||
m_bagslot[slot]->SetContainer(NULL);
|
||||
m_bagslot[slot]->SetContainer(nullptr);
|
||||
|
||||
m_bagslot[slot] = NULL;
|
||||
m_bagslot[slot] = nullptr;
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0);
|
||||
}
|
||||
|
||||
@@ -228,6 +228,6 @@ Item* Bag::GetItemByPos(uint8 slot) const
|
||||
if (slot < GetBagSize())
|
||||
return m_bagslot[slot];
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ class Bag : public Item
|
||||
void RemoveItem(uint8 slot, bool update);
|
||||
|
||||
Item* GetItemByPos(uint8 slot) const;
|
||||
uint32 GetItemCount(uint32 item, Item* eItem = NULL) const;
|
||||
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) 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;
|
||||
|
||||
@@ -33,7 +33,7 @@ void AddItemsSetItem(Player* player, Item* item)
|
||||
if (set->required_skill_id && player->GetSkillValue(set->required_skill_id) < set->required_skill_value)
|
||||
return;
|
||||
|
||||
ItemSetEffect* eff = NULL;
|
||||
ItemSetEffect* eff = nullptr;
|
||||
|
||||
for (size_t x = 0; x < player->ItemSetEff.size(); ++x)
|
||||
{
|
||||
@@ -111,7 +111,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto)
|
||||
return;
|
||||
}
|
||||
|
||||
ItemSetEffect* eff = NULL;
|
||||
ItemSetEffect* eff = nullptr;
|
||||
size_t setindex = 0;
|
||||
for (; setindex < player->ItemSetEff.size(); setindex++)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto)
|
||||
{
|
||||
ASSERT(eff == player->ItemSetEff[setindex]);
|
||||
delete eff;
|
||||
player->ItemSetEff[setindex] = NULL;
|
||||
player->ItemSetEff[setindex] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,10 +233,10 @@ Item::Item()
|
||||
m_slot = 0;
|
||||
uState = ITEM_NEW;
|
||||
uQueuePos = -1;
|
||||
m_container = NULL;
|
||||
m_container = nullptr;
|
||||
m_lootGenerated = false;
|
||||
mb_in_trade = false;
|
||||
m_lastPlayedTimeUpdate = time(NULL);
|
||||
m_lastPlayedTimeUpdate = time(nullptr);
|
||||
|
||||
m_refundRecipient = 0;
|
||||
m_paidMoney = 0;
|
||||
@@ -674,7 +674,7 @@ void Item::AddToUpdateQueueOf(Player* player)
|
||||
if (IsInUpdateQueue())
|
||||
return;
|
||||
|
||||
ASSERT(player != NULL);
|
||||
ASSERT(player != nullptr);
|
||||
|
||||
if (player->GetGUID() != GetOwnerGUID())
|
||||
{
|
||||
@@ -696,7 +696,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
|
||||
if (!IsInUpdateQueue())
|
||||
return;
|
||||
|
||||
ASSERT(player != NULL);
|
||||
ASSERT(player != nullptr);
|
||||
|
||||
if (player->GetGUID() != GetOwnerGUID())
|
||||
{
|
||||
@@ -709,7 +709,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
|
||||
if (player->m_itemUpdateQueueBlocked)
|
||||
return;
|
||||
|
||||
player->m_itemUpdateQueue[uQueuePos] = NULL;
|
||||
player->m_itemUpdateQueue[uQueuePos] = nullptr;
|
||||
uQueuePos = -1;
|
||||
}
|
||||
|
||||
@@ -1016,7 +1016,7 @@ void Item::SendTimeUpdate(Player* owner)
|
||||
Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clone, uint32 randomPropertyId)
|
||||
{
|
||||
if (count < 1)
|
||||
return NULL; //don't create item at zero count
|
||||
return nullptr; //don't create item at zero count
|
||||
|
||||
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
|
||||
if (pProto)
|
||||
@@ -1042,7 +1042,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo
|
||||
}
|
||||
else
|
||||
ABORT();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Item* Item::CloneItem(uint32 count, Player const* player) const
|
||||
@@ -1050,7 +1050,7 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
|
||||
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
|
||||
Item * newItem = CreateItem(GetEntry(), count, player, true, player ? GetItemRandomPropertyId() : 0);
|
||||
if (!newItem)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR));
|
||||
newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR));
|
||||
@@ -1143,7 +1143,7 @@ void Item::UpdatePlayedTime(Player* owner)
|
||||
// Get current played time
|
||||
uint32 current_playtime = GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME);
|
||||
// Calculate time elapsed since last played time update
|
||||
time_t curtime = time(NULL);
|
||||
time_t curtime = time(nullptr);
|
||||
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
|
||||
uint32 new_playtime = current_playtime + elapsed;
|
||||
// Check if the refund timer has expired yet
|
||||
@@ -1164,7 +1164,7 @@ void Item::UpdatePlayedTime(Player* owner)
|
||||
|
||||
uint32 Item::GetPlayedTime()
|
||||
{
|
||||
time_t curtime = time(NULL);
|
||||
time_t curtime = time(nullptr);
|
||||
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
|
||||
return GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + elapsed;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ class Item : public Object
|
||||
{
|
||||
public:
|
||||
static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL, bool clone = false, uint32 randomPropertyId = 0);
|
||||
Item* CloneItem(uint32 count, Player const* player = NULL) const;
|
||||
Item* CloneItem(uint32 count, Player const* player = nullptr) const;
|
||||
|
||||
Item();
|
||||
|
||||
@@ -224,8 +224,8 @@ class Item : public Object
|
||||
void SaveRefundDataToDB();
|
||||
void DeleteRefundDataFromDB(SQLTransaction* trans);
|
||||
|
||||
Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return NULL; }
|
||||
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
|
||||
Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return nullptr; }
|
||||
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return nullptr; }
|
||||
|
||||
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); }
|
||||
bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
|
||||
@@ -257,7 +257,7 @@ class Item : public Object
|
||||
uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
|
||||
void SetContainer(Bag* container) { m_container = container; }
|
||||
|
||||
bool IsInBag() const { return m_container != NULL; }
|
||||
bool IsInBag() const { return m_container != nullptr; }
|
||||
bool IsEquipped() const;
|
||||
|
||||
uint32 GetSkill();
|
||||
@@ -294,7 +294,7 @@ class Item : public Object
|
||||
|
||||
// Update States
|
||||
ItemUpdateState GetState() const { return uState; }
|
||||
void SetState(ItemUpdateState state, Player* forplayer = NULL);
|
||||
void SetState(ItemUpdateState state, Player* forplayer = nullptr);
|
||||
void AddToUpdateQueueOf(Player* player);
|
||||
void RemoveFromUpdateQueueOf(Player* player);
|
||||
bool IsInUpdateQueue() const { return uQueuePos != -1; }
|
||||
@@ -312,7 +312,7 @@ class Item : public Object
|
||||
bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
|
||||
|
||||
// Item Refund system
|
||||
void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = NULL);
|
||||
void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = nullptr);
|
||||
void SetRefundRecipient(uint32 pGuidLow) { m_refundRecipient = pGuidLow; }
|
||||
void SetPaidMoney(uint32 money) { m_paidMoney = money; }
|
||||
void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; }
|
||||
|
||||
Reference in New Issue
Block a user