mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 11:55:43 +00:00
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:
@@ -36,13 +36,13 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket & recvData)
|
||||
|
||||
if (!_player->IsValidPos(srcbag, srcslot, true))
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->IsValidPos(dstbag, dstslot, false)) // can be autostore pos
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,13 +63,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recvData)
|
||||
|
||||
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, srcslot, true))
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, dstslot, true))
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,13 +127,13 @@ void WorldSession::HandleSwapItem(WorldPacket & recvData)
|
||||
|
||||
if (!_player->IsValidPos(srcbag, srcslot, true))
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->IsValidPos(dstbag, dstslot, true))
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData)
|
||||
InventoryResult msg = _player->CanEquipItem(NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag());
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, pSrcItem, NULL);
|
||||
_player->SendEquipError(msg, pSrcItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData)
|
||||
msg = _player->CanUnequipItem(dest, !pSrcItem->IsBag());
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, pDstItem, NULL);
|
||||
_player->SendEquipError(msg, pDstItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData)
|
||||
InventoryResult msg = _player->CanUnequipItem(pos, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, _player->GetItemByPos(pos), NULL);
|
||||
_player->SendEquipError(msg, _player->GetItemByPos(pos), nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -273,13 +273,13 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData)
|
||||
Item* pItem = _player->GetItemByPos(bag, slot);
|
||||
if (!pItem)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pItem->GetTemplate()->Flags & ITEM_FLAG_NO_USER_DESTROY)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -615,13 +615,13 @@ void WorldSession::HandleReadItem(WorldPacket & recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("STORAGE: Unable to read item");
|
||||
#endif
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
_player->SendEquipError(msg, pItem, nullptr);
|
||||
}
|
||||
data << pItem->GetGUID();
|
||||
SendPacket(&data);
|
||||
}
|
||||
else
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSellItemOpcode(WorldPacket & recvData)
|
||||
@@ -800,7 +800,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recvData)
|
||||
_player->StoreItem(dest, pItem, true);
|
||||
}
|
||||
else
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
_player->SendEquipError(msg, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -1005,7 +1005,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData)
|
||||
|
||||
if (!_player->IsValidPos(dstbag, NULL_SLOT, false)) // can be autostore pos
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData)
|
||||
InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos (src));
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
_player->SendEquipError(msg, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1026,7 +1026,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData)
|
||||
InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
_player->SendEquipError(msg, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1034,7 +1034,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData)
|
||||
if (dest.size() == 1 && dest[0].pos == src)
|
||||
{
|
||||
// just remove grey item state
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1122,13 +1122,13 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
|
||||
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
_player->SendEquipError(msg, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dest.size() == 1 && dest[0].pos == pItem->GetPos())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1166,7 +1166,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
_player->SendEquipError(msg, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1180,7 +1180,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
||||
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, pItem, NULL);
|
||||
_player->SendEquipError(msg, pItem, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1194,7 +1194,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recvData)
|
||||
{
|
||||
if (!_player->IsAlive())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1209,7 +1209,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recvData)
|
||||
{
|
||||
if (!_player->GetItemCount(item))
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1284,13 +1284,13 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
Item* gift = _player->GetItemByPos(gift_bag, gift_slot);
|
||||
if (!gift)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(gift->GetTemplate()->Flags & ITEM_FLAG_IS_WRAPPER)) // cheating: non-wrapper wrapper
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1298,57 +1298,57 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
|
||||
if (!item)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
// xinef: do not allow to wrap removed items, just in case
|
||||
if (item->GetState() == ITEM_REMOVED)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item == gift) // not possable with pacjket from real client
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsEquipped())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsBag())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsSoulBound())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetMaxStackCount() != 1)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
// maybe not correct check (it is better than nothing)
|
||||
if (item->GetTemplate()->MaxCount>0)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1419,11 +1419,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
|
||||
Item* Gems[MAX_GEM_SOCKETS];
|
||||
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
|
||||
Gems[i] = gem_guids[i] ? _player->GetItemByGuid(gem_guids[i]) : NULL;
|
||||
Gems[i] = gem_guids[i] ? _player->GetItemByGuid(gem_guids[i]) : nullptr;
|
||||
|
||||
GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS];
|
||||
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage
|
||||
GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetTemplate()->GemProperties) : NULL;
|
||||
GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetTemplate()->GemProperties) : nullptr;
|
||||
|
||||
// Find first prismatic socket
|
||||
int32 firstPrismatic = 0;
|
||||
@@ -1484,7 +1484,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (iGemProto->ItemId == Gems[j]->GetEntry())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1494,7 +1494,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (iGemProto->ItemId == enchantEntry->GemID)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1529,7 +1529,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
|
||||
if (limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL);
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1540,7 +1540,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (InventoryResult res = _player->CanEquipUniqueItem(Gems[i], slot, std::max(limit_newcount, 0)))
|
||||
{
|
||||
_player->SendEquipError(res, itemTarget, NULL);
|
||||
_player->SendEquipError(res, itemTarget, nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user