Missing part of previous commit. Thanks HG for being so coöperative.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-03-21 16:51:03 +01:00
parent 13024dee64
commit 19b84fd889
+14 -4
View File
@@ -11530,6 +11530,7 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
{
ItemRemovedQuestCheck(it->GetEntry(), it->GetCount());
RemoveItem(bag, slot, update);
it->SetNotRefundable(this, false);
it->RemoveFromUpdateQueueOf(this);
if(it->IsInWorld())
{
@@ -16399,7 +16400,8 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff)
else
{
QueryResult_AutoPtr result2 = CharacterDatabase.PQuery(
"SELECT player_guid,paidMoney,paidExtendedCost FROM `item_refund_instance` WHERE item_guid = '%u' LIMIT 1", item->GetGUIDLow());
"SELECT player_guid,paidMoney,paidExtendedCost FROM `item_refund_instance` WHERE item_guid = '%u' AND player_guid = '%u' LIMIT 1",
item->GetGUIDLow(), GetGUIDLow());
if (!result2)
{
sLog.outDebug("Item::LoadFromDB, "
@@ -17503,13 +17505,21 @@ void Player::_SaveInventory()
std::set<uint64>::iterator i_next;
for (std::set<uint64>::iterator itr = m_refundableItems.begin(); itr!= m_refundableItems.end(); itr = i_next)
{
// use copy iterator because UpdatePlayedTime may invalidate itr
// use copy iterator because itr may be invalid after operations in this loop
i_next = itr;
++i_next;
Item* iPtr = GetItemByGuid(*itr);
ASSERT(iPtr); // Sanity check, if this assertion is hit then the item wasn't removed from the set correctly./
iPtr->UpdatePlayedTime(this);
if (iPtr)
{
iPtr->UpdatePlayedTime(this);
continue;
}
else
{
sLog.outError("Can't find item guid " UI64FMTD " but is in refundable storage for player %u ! Removing.", (*itr), GetGUIDLow());
m_refundableItems.erase(itr);
}
}
// update enchantment durations