Core/Cleanup: remove C-style cast to (Bag*):
* add ToBag() methods for Item class; * add GetBagByPos() method for Player class.
This commit is contained in:
@@ -188,7 +188,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (it->IsBag() && !((Bag*)it)->IsEmpty())
|
||||
if (!it->IsNotEmptyBag())
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
|
||||
return;
|
||||
|
||||
@@ -516,7 +516,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
// prevent sell non empty bag by drag-and-drop at vendor's item list
|
||||
if (pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
|
||||
if (pItem->IsNotEmptyBag())
|
||||
{
|
||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
|
||||
return;
|
||||
@@ -668,7 +668,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||
{
|
||||
if (Bag *pBag = (Bag*)_player->GetItemByPos(INVENTORY_SLOT_BAG_0,i))
|
||||
if (Bag* pBag = _player->GetBagByPos(i))
|
||||
{
|
||||
if (bagguid == pBag->GetGUID())
|
||||
{
|
||||
|
||||
@@ -219,7 +219,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsBag() && !((Bag*)item)->IsEmpty())
|
||||
if (item->IsNotEmptyBag())
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user