aboutsummaryrefslogtreecommitdiff
path: root/src/game/Item.cpp
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-03-15 14:03:13 +0100
committerMachiavelli <none@none>2010-03-15 14:03:13 +0100
commitc47b8a89c1ca0cba199324e0f9d67982b588ffa7 (patch)
tree0e24c1bf10bb78ecab1c064fe70ff67cf17ff6c5 /src/game/Item.cpp
parentce51f24ff307307470be0429850a0bc5b0690e8e (diff)
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
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r--src/game/Item.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index 99e4b460caa..1a5dd558c8f 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -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;