aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-03-21 16:51:03 +0100
committerMachiavelli <none@none>2010-03-21 16:51:03 +0100
commit19b84fd889040e491e8abcead8781b4c24887eb0 (patch)
treea313e4b5f23d11209474dd4f739f567c1de322e4 /src
parent13024dee646509789cb855149896c3bc738f7218 (diff)
Missing part of previous commit. Thanks HG for being so coöperative.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 9fbc4c170f5..04397cb15b2 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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