Fix issue with .save or .saveall where either the core would freeze, or items would not be saved to the DB properly.

Fixes issue #381
Fixes issue #477

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-03-15 14:03:13 +01:00
parent ce51f24ff3
commit c47b8a89c1

View File

@@ -643,17 +643,10 @@ void Item::SetState(ItemUpdateState state, Player *forplayer)
void Item::AddToUpdateQueueOf(Player *player)
{
if (IsInUpdateQueue()) return;
if (IsInUpdateQueue())
return;
if (!player)
{
player = GetOwner();
if (!player)
{
sLog.outDebug("Item::AddToUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID()));
return;
}
}
ASSERT(player != NULL);
if (player->GetGUID() != GetOwnerGUID())
{
@@ -661,7 +654,8 @@ void Item::AddToUpdateQueueOf(Player *player)
return;
}
if (player->m_itemUpdateQueueBlocked) return;
if (player->m_itemUpdateQueueBlocked)
return;
player->m_itemUpdateQueue.push_back(this);
uQueuePos = player->m_itemUpdateQueue.size()-1;
@@ -669,17 +663,10 @@ void Item::AddToUpdateQueueOf(Player *player)
void Item::RemoveFromUpdateQueueOf(Player *player)
{
if (!IsInUpdateQueue()) return;
if (!IsInUpdateQueue())
return;
if (!player)
{
player = GetOwner();
if (!player)
{
sLog.outDebug("Item::RemoveFromUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID()));
return;
}
}
ASSERT(player != NULL)
if (player->GetGUID() != GetOwnerGUID())
{
@@ -687,7 +674,8 @@ void Item::RemoveFromUpdateQueueOf(Player *player)
return;
}
if (player->m_itemUpdateQueueBlocked) return;
if (player->m_itemUpdateQueueBlocked)
return;
player->m_itemUpdateQueue[uQueuePos] = NULL;
uQueuePos = -1;