diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2011-08-26 21:48:00 +0800 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2011-09-02 16:08:20 +0800 |
commit | 31970d5255e43de6f06ef6ae4c67d781632ecd1f (patch) | |
tree | 24589f2dee34fedae497cfceb1637771e1519737 | |
parent | 234bcab257567ed0d7975acee29894880f21eba2 (diff) | |
download | manaserv-31970d5255e43de6f06ef6ae4c67d781632ecd1f.tar.gz manaserv-31970d5255e43de6f06ef6ae4c67d781632ecd1f.tar.bz2 manaserv-31970d5255e43de6f06ef6ae4c67d781632ecd1f.tar.xz manaserv-31970d5255e43de6f06ef6ae4c67d781632ecd1f.zip |
Prevented char from picking up items when inventory is full.
Resolves: Mana-Mantis: #379.
Reviewed-by: Bertram.
-rw-r--r-- | src/game-server/gamehandler.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp index 58d289f0..4c69da20 100644 --- a/src/game-server/gamehandler.cpp +++ b/src/game-server/gamehandler.cpp @@ -472,15 +472,20 @@ void GameHandler::handlePickup(GameClient &client, MessageIn &message) { Item *item = static_cast< Item * >(o); ItemClass *ic = item->getItemClass(); - Inventory(client.character).insert(ic->getDatabaseID(), - item->getAmount()); - GameState::remove(item); - // log transaction - std::stringstream str; - str << "User picked up item " << ic->getDatabaseID() - << " at " << opos.x << "x" << opos.y; - accountHandler->sendTransaction(client.character->getDatabaseID(), - TRANS_ITEM_PICKUP, str.str()); + if (!Inventory(client.character).insert(ic->getDatabaseID(), + item->getAmount())) + { + + GameState::remove(item); + // log transaction + std::stringstream str; + str << "User picked up item " << ic->getDatabaseID() + << " at " << opos.x << "x" << opos.y; + accountHandler->sendTransaction( + client.character->getDatabaseID(), + TRANS_ITEM_PICKUP, str.str() + ); + } break; } } |