- Overload Item::SetState with player argument where possible to ensure updated data is saved to DB properly.

- Alter Item::SetEnchantmentDuration function, add parameter Player* because GetOwner() cannot be called in the function due to hashtable locking in the SaveAllPlayers process.
- Remove a sanity check prior to Item::AddToUpdateQueueOf, so assertions can detect whenever a higher level function was not called properly. Please report any crashes related to these assertions to get them resolved asap.

--HG--
branch : trunk
This commit is contained in:
Machiavelli committed 2010-03-16 01:05:56 +01:00
1 parent 5b277b11a7
commit b0b17e56de
4 files changed
+13 -13

No files matched your search

+3 -3
View File
@@ -12558,7 +12558,7 @@ void Player::RemoveEnchantmentDurations(Item *item)
if (itr->item == item)
{
// save duration in item
item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration);
item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration, this);
itr = m_enchantDuration.erase(itr);
}
else
@@ -12624,7 +12624,7 @@ void Player::AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 durat
{
if (itr->item == item && itr->slot == slot)
{
itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration);
itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
m_enchantDuration.erase(itr);
break;
}
@@ -17456,7 +17456,7 @@ void Player::_SaveInventory()
// update enchantment durations
for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
itr->item->SetEnchantmentDuration(itr->slot,itr->leftduration);
itr->item->SetEnchantmentDuration(itr->slot,itr->leftduration, this);
// if no changes
if (m_itemUpdateQueue.empty())