From 3f79baabbd9bbe83fdd3b06abda33055b42735a0 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 25 Oct 2010 16:08:39 +0200 Subject: Avoid assertion when removing unknown items Don't try to notify the client when automatically removing unknown items, since at this point the client hasn't connected yet. Reviewed-by: Freeyorp --- src/game-server/inventory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game-server/inventory.cpp b/src/game-server/inventory.cpp index 94dea47a..90d9889d 100644 --- a/src/game-server/inventory.cpp +++ b/src/game-server/inventory.cpp @@ -261,13 +261,14 @@ void Inventory::initialise() /* * Construct a set of itemIds to keep track of duplicate itemIds. */ - for (it1 = mPoss->inventory.begin(); it1 != mPoss->inventory.end(); ++it1) + for (it1 = mPoss->inventory.begin(); it1 != mPoss->inventory.end();) { ItemClass *item = itemManager->getItem(it1->second.itemId); if (item) { if (itemIds.insert(it1->second.itemId).second) item->useTrigger(mClient, ITT_IN_INVY); + ++it1; } else { @@ -275,8 +276,7 @@ void Inventory::initialise() << it1->second.itemId << " from the inventory of '" << mClient->getName() << "'!"); - removeFromSlot(it1->first, - it1->second.amount); + mPoss->inventory.erase(it1++); } } -- cgit v1.2.3-70-g09d2