summaryrefslogtreecommitdiff
path: root/src/net/tmwa/inventoryhandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-26 23:40:37 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-26 23:40:37 +0200
commit2d0e84449b14615bdacb6f897791628662bbfd39 (patch)
tree08019ae6c24c6da25e25da027d04ad008c25d6a2 /src/net/tmwa/inventoryhandler.cpp
parent42605753159d7b63276351311e0fd43874a3366b (diff)
parent0056412ed33b941d72a175dcd3f025abcd8fc02b (diff)
downloadmana-2d0e84449b14615bdacb6f897791628662bbfd39.tar.gz
mana-2d0e84449b14615bdacb6f897791628662bbfd39.tar.bz2
mana-2d0e84449b14615bdacb6f897791628662bbfd39.tar.xz
mana-2d0e84449b14615bdacb6f897791628662bbfd39.zip
Made the client use a unique kind of movement code.
This is fixng many issues and (hopefully) will make the movement rendering much smoother. Merge branch 'master' of gitorious.org:~bertram/mana/mana-movement-code-merge Conflicts: src/being.cpp src/net/manaserv/beinghandler.cpp Resolves: TMW-Mantis #946. Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/net/tmwa/inventoryhandler.cpp')
-rw-r--r--src/net/tmwa/inventoryhandler.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 18e8febc..1340a091 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -24,6 +24,7 @@
#include "configuration.h"
#include "equipment.h"
#include "event.h"
+#include "game.h"
#include "inventory.h"
#include "item.h"
#include "itemshortcut.h"
@@ -408,13 +409,33 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
flag = msg.readInt8();
if (!flag)
+ {
SERVER_NOTICE(_("Unable to unequip."))
+ }
else
+ {
mEquips.setEquipment(getSlot(equipType), -1);
+ // Reset the attack range to unarmed.
+ player_node->setAttackRange(ATTACK_RANGE_NOT_SET);
+ }
break;
case SMSG_PLAYER_ATTACK_RANGE:
- player_node->setAttackRange(msg.readInt16());
+ {
+ // The range is in tiles, so we translate it back to pixels
+ Map *map = Game::instance()->getCurrentMap();
+ if (map)
+ {
+ player_node->setAttackRange(msg.readInt16()
+ * map->getTileWidth());
+ }
+ else
+ {
+ logger->log("Couldn't set attacke range due to the lack"
+ "of an initialized map.");
+ player_node->setAttackRange(ATTACK_RANGE_NOT_SET);
+ }
+ }
break;
case SMSG_PLAYER_ARROW_EQUIP: