From 0daf12a348af2988d217b2f79acf134f266edbc6 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 2 Jul 2011 01:03:48 +0400 Subject: [PATCH] [11703] Proper way create items in Item::CreateItem/CloneItem for items not for inventory Old code way work not allow create item without providing targeting player. In result creating item that will not placed to inventory required additional hacks for undo redundent links to player structures. --- src/game/AuctionHouseHandler.cpp | 3 +-- src/game/Item.cpp | 7 +++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 63588722d..440eca50d 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -364,8 +364,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items continue; - Item *newItem = it->CloneItem(stackSize, pl); - newItem->RemoveFromUpdateQueueOf(pl); // item not planned to adding to inventory + Item *newItem = it->CloneItem(stackSize); pl->DestroyItemCount(it, stackSize, true); diff --git a/src/game/Item.cpp b/src/game/Item.cpp index cf868da5e..0554148d5 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -741,7 +741,8 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) if (uState == ITEM_NEW && state == ITEM_REMOVED) { // pretend the item never existed - RemoveFromUpdateQueueOf(forplayer); + if (forplayer || GetOwnerGuid()) + RemoveFromUpdateQueueOf(forplayer); delete this; return; } @@ -750,7 +751,9 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) { // new items must stay in new state until saved if (uState != ITEM_NEW) uState = state; - AddToUpdateQueueOf(forplayer); + + if (forplayer || GetOwnerGuid()) + AddToUpdateQueueOf(forplayer); } else { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 549c474f3..e110c71dd 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11702" + #define REVISION_NR "11703" #endif // __REVISION_NR_H__