summaryrefslogtreecommitdiffstats
path: root/src/game-server/inventory.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-11-01 16:47:04 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-11-01 17:16:05 +0100
commit4e0cd127c49f9d209ed45ab620a7cccb4f608950 (patch)
treed1d6318beb4511d0d7bcbf2de0da39279736be44 /src/game-server/inventory.cpp
parent5922e27d2bc4d2b5ab906afbe2bc029ac90cb2ed (diff)
downloadmanaserv-4e0cd127c49f9d209ed45ab620a7cccb4f608950.tar.gz
manaserv-4e0cd127c49f9d209ed45ab620a7cccb4f608950.tar.xz
manaserv-4e0cd127c49f9d209ed45ab620a7cccb4f608950.zip
Removed the inventory check
We can't arbitrarily remove inventory items on initialization, and shouldn't have to, because what's in the DB was correct when it was stored. Also, there should be no need to check the inventory after inserting items, since the insert method should already make sure not to insert items when there is no space. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/game-server/inventory.cpp')
-rw-r--r--src/game-server/inventory.cpp46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/game-server/inventory.cpp b/src/game-server/inventory.cpp
index e486f7c..1c52bcf 100644
--- a/src/game-server/inventory.cpp
+++ b/src/game-server/inventory.cpp
@@ -134,50 +134,6 @@ void Inventory::initialize()
++it2;
}
-
- checkInventorySize();
-}
-
-void Inventory::checkInventorySize()
-{
- /*
- * Check that the inventory size is greater than or equal to the size
- * needed.
- * If not, forcibly drop items from the end until it is.
- * Check that inventory capacity is greater than or equal to zero.
- * If not, forcibly drop items from the end until it is.
- */
- while (mPoss->inventory.size() > INVENTORY_SLOTS
- || mCharacter->getModifiedAttribute(ATTR_INV_CAPACITY) < 0)
- {
- LOG_WARN("Inventory: oversize inventory! Deleting '"
- << mPoss->inventory.rbegin()->second.amount
- << "' items of type '"
- << mPoss->inventory.rbegin()->second.itemId
- << "' from slot '"
- << mPoss->inventory.rbegin()->first
- << "' of character '"
- << mCharacter->getName()
- << "'!");
-
- // Remove the items from inventory
- removeFromSlot(mPoss->inventory.rbegin()->first,
- mPoss->inventory.rbegin()->second.amount);
-
- // Drop them on the floor
- ItemClass *ic = itemManager->getItem(mPoss->inventory.rbegin()->first);
- int nb = mPoss->inventory.rbegin()->second.amount;
- Item *item = new Item(ic, nb);
- item->setMap(mCharacter->getMap());
- item->setPosition(mCharacter->getPosition());
- if (!GameState::insert(item))
- {
- // Warn about drop failure
- LOG_WARN("Impossible to drop " << nb << " item(s) id: "
- << ic->getDatabaseID() << " for character: '"
- << mCharacter->getName() << "'!");
- }
- }
}
unsigned int Inventory::getItem(unsigned int slot) const
@@ -258,8 +214,6 @@ unsigned int Inventory::insert(unsigned int itemId, unsigned int amount)
if (invMsg.getLength() > 2)
gameHandler->sendTo(mCharacter, invMsg);
- checkInventorySize();
-
return amount;
}