diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-22 15:56:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-22 15:56:51 +0300 |
commit | 9239957b3a21a1498323b7af2b2910bc75f72859 (patch) | |
tree | 5cc784d0a29c0d452baf75b3023783db488d3530 /src/net/messageout.cpp | |
parent | c8c04113ea360bdf542393001e45eb1ea9f317d1 (diff) | |
download | manaplus-9239957b3a21a1498323b7af2b2910bc75f72859.tar.gz manaplus-9239957b3a21a1498323b7af2b2910bc75f72859.tar.bz2 manaplus-9239957b3a21a1498323b7af2b2910bc75f72859.tar.xz manaplus-9239957b3a21a1498323b7af2b2910bc75f72859.zip |
add function for convert server direction into client direction.
Diffstat (limited to 'src/net/messageout.cpp')
-rw-r--r-- | src/net/messageout.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index e67044614..2d1389581 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -136,4 +136,41 @@ unsigned int MessageOut::getDataSize() const return mDataSize; } +unsigned char MessageOut::toServerDirection(unsigned char direction) +{ + // Translate direction to eAthena format + switch (direction) + { + case 1: // DOWN + direction = 0; + break; + case 3: // DOWN | LEFT + direction = 1; + break; + case 2: // LEFT + direction = 2; + break; + case 6: // LEFT | UP + direction = 3; + break; + case 4: // UP + direction = 4; + break; + case 12: // UP | RIGHT + direction = 5; + break; + case 8: // RIGHT + direction = 6; + break; + case 9: // RIGHT + DOWN + direction = 7; + break; + default: + // OOPSIE! Impossible or unknown + direction = static_cast<unsigned char>(-1); + break; + } + return direction; +} + } // namespace Net |