summaryrefslogtreecommitdiff
path: root/src/game-server/inventory.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-08 15:00:44 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-08 15:00:44 +0000
commit112137cb64eb66b266ecb11fe50accebb6e38f0b (patch)
tree1c1ca351c5c97cb80b70d272e73d61a11d554ff2 /src/game-server/inventory.cpp
parent96ed6284affefcba1b0ded75e4ef88e52b430c4d (diff)
downloadmanaserv-112137cb64eb66b266ecb11fe50accebb6e38f0b.tar.gz
manaserv-112137cb64eb66b266ecb11fe50accebb6e38f0b.tar.bz2
manaserv-112137cb64eb66b266ecb11fe50accebb6e38f0b.tar.xz
manaserv-112137cb64eb66b266ecb11fe50accebb6e38f0b.zip
Untested means full of trivial bugs.
Diffstat (limited to 'src/game-server/inventory.cpp')
-rw-r--r--src/game-server/inventory.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/game-server/inventory.cpp b/src/game-server/inventory.cpp
index 49442a5c..d3e3321d 100644
--- a/src/game-server/inventory.cpp
+++ b/src/game-server/inventory.cpp
@@ -433,7 +433,6 @@ int Inventory::move(int slot1, int slot2, int amount)
}
// Swap between two different stacks.
-
if (it1.amount != amount)
{
return amount;
@@ -469,6 +468,10 @@ int Inventory::move(int slot1, int slot2, int amount)
}
// Fill second slot.
+ msg.writeByte(slot2 + EQUIP_CLIENT_INVENTORY);
+ msg.writeShort(id);
+ msg.writeByte(nb);
+
for (std::vector< InventoryItem >::iterator i = mPoss->inventory.begin(),
i_end = mPoss->inventory.end(); i != i_end; ++i)
{
@@ -491,7 +494,7 @@ int Inventory::move(int slot1, int slot2, int amount)
// One single empty slot in the range.
i->itemId = id;
i->amount = nb;
- break;
+ return amount;
}
InventoryItem it = { id, nb };
@@ -501,26 +504,24 @@ int Inventory::move(int slot1, int slot2, int amount)
{
// First slot in an empty range.
mPoss->inventory.insert(i + 1, it);
- break;
+ return amount;
}
if (slot2 == i->amount)
{
// Last slot in an empty range.
mPoss->inventory.insert(i, it);
- break;
+ return amount;
}
InventoryItem it3 = { 0, slot2 };
i->amount -= slot2;
i = mPoss->inventory.insert(i, it);
mPoss->inventory.insert(i, it3);
- break;
+ return amount;
}
- msg.writeByte(slot2 + EQUIP_CLIENT_INVENTORY);
- msg.writeShort(id);
- msg.writeByte(nb);
+ assert(false);
return amount;
}