summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-04 18:29:22 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-12 03:04:25 +0100
commit6cf1c2fc269626f9c621ab4a5e72dcf19ddfecd1 (patch)
treea9f1ede20d9e5e7a8115c9a333e769c7c1d481fc
parent2449c6b9c236829d4f43f260cdc19f672222f4a5 (diff)
downloadmanaserv-6cf1c2fc269626f9c621ab4a5e72dcf19ddfecd1.tar.gz
manaserv-6cf1c2fc269626f9c621ab4a5e72dcf19ddfecd1.tar.xz
manaserv-6cf1c2fc269626f9c621ab4a5e72dcf19ddfecd1.zip
Made the server warn the player when equip/unequip failed.
Reviewed-by: Erik Schilling
-rw-r--r--src/game-server/gamehandler.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index e6c4737..af6cff1 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -576,14 +576,25 @@ void GameHandler::handleWalk(GameClient &client, MessageIn &message)
void GameHandler::handleEquip(GameClient &client, MessageIn &message)
{
const int slot = message.readInt16();
- Inventory(client.character).equip(slot);
+ if (!Inventory(client.character).equip(slot))
+ {
+ MessageOut msg(GPMSG_SAY);
+ msg.writeInt16(0); // From the server
+ msg.writeString("Unable to equip.");
+ client.send(msg);
+ }
}
void GameHandler::handleUnequip(GameClient &client, MessageIn &message)
{
- const int slot = message.readInt16();
- if (slot >= 0 && slot < INVENTORY_SLOTS)
- Inventory(client.character).unequip(slot);
+ const int itemInstance = message.readInt16();
+ if (!Inventory(client.character).unequip(itemInstance))
+ {
+ MessageOut msg(GPMSG_SAY);
+ msg.writeInt16(0); // From the server
+ msg.writeString("Unable to unequip.");
+ client.send(msg);
+ }
}
void GameHandler::handleMoveItem(GameClient &client, MessageIn &message)