diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-10-25 16:08:39 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-10-25 16:14:09 +0200 |
commit | 3f79baabbd9bbe83fdd3b06abda33055b42735a0 (patch) | |
tree | 5254127a6f9b817c772e7e3b2e17d8bc3c1e926d | |
parent | 20a5f67808ca6ee14117e9b7d13606cba81e0442 (diff) | |
download | manaserv-3f79baabbd9bbe83fdd3b06abda33055b42735a0.tar.gz manaserv-3f79baabbd9bbe83fdd3b06abda33055b42735a0.tar.bz2 manaserv-3f79baabbd9bbe83fdd3b06abda33055b42735a0.tar.xz manaserv-3f79baabbd9bbe83fdd3b06abda33055b42735a0.zip |
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
-rw-r--r-- | src/game-server/inventory.cpp | 6 |
1 files 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++); } } |