summaryrefslogtreecommitdiff
path: root/src/net/manaserv/beinghandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-09 12:14:21 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-09 12:14:21 +0100
commit59a01fcf92ce43caf6b385659deddfa49c086ee8 (patch)
tree96060e18caf57f146fd38176f49d0e456ad06944 /src/net/manaserv/beinghandler.cpp
parentf704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d (diff)
downloadmana-59a01fcf92ce43caf6b385659deddfa49c086ee8.tar.gz
mana-59a01fcf92ce43caf6b385659deddfa49c086ee8.tar.bz2
mana-59a01fcf92ce43caf6b385659deddfa49c086ee8.tar.xz
mana-59a01fcf92ce43caf6b385659deddfa49c086ee8.zip
Fix other direction discrepancies on the client.
This fix the change dir (with alt key), attacks directions, and the direction of a being standing when you come in its range. Reviewed-by: Jaxad. Resolves: Mana-mantis #257
Diffstat (limited to 'src/net/manaserv/beinghandler.cpp')
-rw-r--r--src/net/manaserv/beinghandler.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp
index 12a044ee..6e9b3645 100644
--- a/src/net/manaserv/beinghandler.cpp
+++ b/src/net/manaserv/beinghandler.cpp
@@ -155,6 +155,7 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg)
Being::Action action = (Being::Action)msg.readInt8();
int px = msg.readInt16();
int py = msg.readInt16();
+ BeingDirection direction = (BeingDirection)msg.readInt8();
Being *being;
switch (type)
@@ -196,6 +197,7 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg)
being->setPosition(px, py);
being->setDestination(px, py);
+ being->setDirection(direction);
being->setAction(action);
}
@@ -257,19 +259,13 @@ void BeingHandler::handleBeingsMoveMessage(Net::MessageIn &msg)
void BeingHandler::handleBeingAttackMessage(Net::MessageIn &msg)
{
Being *being = actorSpriteManager->findBeing(msg.readInt16());
- const int direction = msg.readInt8();
+ const BeingDirection direction = (BeingDirection) msg.readInt8();
const int attackType = msg.readInt8();
if (!being)
return;
- switch (direction)
- {
- case DIRECTION_UP: being->setDirection(Being::UP); break;
- case DIRECTION_DOWN: being->setDirection(Being::DOWN); break;
- case DIRECTION_LEFT: being->setDirection(Being::LEFT); break;
- case DIRECTION_RIGHT: being->setDirection(Being::RIGHT); break;
- }
+ being->setDirection(direction);
being->setAction(Being::ATTACK, attackType);
}
@@ -349,16 +345,7 @@ void BeingHandler::handleBeingDirChangeMessage(Net::MessageIn &msg)
// The direction for the player's character is handled on client side.
if (being != player_node)
- {
- switch (data)
- {
- case DIRECTION_UP: being->setDirection(Being::UP); break;
- case DIRECTION_DOWN: being->setDirection(Being::DOWN); break;
- case DIRECTION_LEFT: being->setDirection(Being::LEFT); break;
- case DIRECTION_RIGHT: being->setDirection(Being::RIGHT); break;
- default: break;
- }
- }
+ being->setDirection((BeingDirection) data);
}
} // namespace ManaServ