diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-03-16 00:37:34 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-03-16 00:37:34 +0100 |
commit | 786df24ec5d10e4251fa69426c53f9c2e5d545f4 (patch) | |
tree | 272779bd871303204bda526bc5b6841bdc8e1928 /src/net/tmwa/inventoryhandler.cpp | |
parent | 001b6f0f7db78bf7987e302a085b9d8469d59f68 (diff) | |
download | mana-786df24ec5d10e4251fa69426c53f9c2e5d545f4.tar.gz mana-786df24ec5d10e4251fa69426c53f9c2e5d545f4.tar.bz2 mana-786df24ec5d10e4251fa69426c53f9c2e5d545f4.tar.xz mana-786df24ec5d10e4251fa69426c53f9c2e5d545f4.zip |
Fixed the attack range handling for both servers.
The attack range is always the default for manaserv, as proper
equipment handling is to be added.
Anyway, now the proper attack range is handled in tmwAthena
and is always set a proper minimum for both protocols.
Diffstat (limited to 'src/net/tmwa/inventoryhandler.cpp')
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 1d99eca4..8ec97a38 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(-1); + } 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(-1); + } + } break; case SMSG_PLAYER_ARROW_EQUIP: |