summaryrefslogtreecommitdiff
path: root/src/net/ea/inventoryhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-08 01:00:52 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-08 01:02:48 +0300
commit29187a2582c04e3ede63f9c58f09dbbe34834a30 (patch)
tree93b77c0ad573af9c6d52a6932e76f6c223e2c8f3 /src/net/ea/inventoryhandler.cpp
parentaf98cb5dea5644e0d95a5bf41c03655e4ab808ef (diff)
downloadmanaplus-29187a2582c04e3ede63f9c58f09dbbe34834a30.tar.gz
manaplus-29187a2582c04e3ede63f9c58f09dbbe34834a30.tar.bz2
manaplus-29187a2582c04e3ede63f9c58f09dbbe34834a30.tar.xz
manaplus-29187a2582c04e3ede63f9c58f09dbbe34834a30.zip
Add checks and fix code style.
Diffstat (limited to 'src/net/ea/inventoryhandler.cpp')
-rw-r--r--src/net/ea/inventoryhandler.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 1de681007..788b7f0fc 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -316,10 +316,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
if (err)
{
if (player_node)
- {
- player_node->pickedUp(itemInfo, 0, identified,
- floorId, err);
- }
+ player_node->pickedUp(itemInfo, 0, identified, floorId, err);
}
else
{
@@ -334,13 +331,13 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
Item *item = inventory->getItem(index);
if (item && item->getId() == itemId)
- amount += inventory->getItem(index)->getQuantity();
+ amount += item->getQuantity();
if (serverVersion < 1 && identified > 1)
identified = 1;
inventory->setItem(index, itemId, amount, refine,
- identified, equipType != 0);
+ identified, equipType != 0);
}
}
}
@@ -451,7 +448,6 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
{
int index, amount, itemId, refine;
unsigned char identified;
-// int cards[4];
// Move an item into storage
index = msg.readInt16() - STORAGE_OFFSET;
@@ -475,8 +471,8 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
if (serverVersion < 1 && identified > 1)
identified = 1;
- mStorage->setItem(index, itemId, amount, refine,
- identified, false);
+ mStorage->setItem(index, itemId, amount,
+ refine, identified, false);
}
}
}
@@ -502,7 +498,6 @@ void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg)
void InventoryHandler::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED)
{
// Storage access has been closed
-
// Storage window deletes itself
mStorageWindow = 0;
@@ -569,12 +564,9 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
{
- int index, equipType;
- int flag;
-
- index = msg.readInt16() - INVENTORY_OFFSET;
- equipType = msg.readInt16();
- flag = msg.readInt8();
+ int index = msg.readInt16() - INVENTORY_OFFSET;
+ int equipType = msg.readInt16();
+ int flag = msg.readInt8();
if (!flag)
SERVER_NOTICE(_("Unable to equip."))
@@ -584,12 +576,9 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg)
{
- int equipType;
- int flag;
-
msg.readInt16(); // inder val - INVENTORY_OFFSET;
- equipType = msg.readInt16();
- flag = msg.readInt8();
+ int equipType = msg.readInt16();
+ int flag = msg.readInt8();
if (flag)
mEquips.setEquipment(getSlot(equipType), -1);