summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2011-06-04 13:31:28 -0600
committerJared Adams <jaxad0127@gmail.com>2011-06-04 13:31:28 -0600
commitd2c548e091f203196d93c011fc65944fb1cdc986 (patch)
tree4b0d8b0677b7f32c73cfae9196f591503dd86494
parente7e99051910a9a8739d8a50225be868e5dc286d6 (diff)
downloadmana-d2c548e091f203196d93c011fc65944fb1cdc986.tar.gz
mana-d2c548e091f203196d93c011fc65944fb1cdc986.tar.bz2
mana-d2c548e091f203196d93c011fc65944fb1cdc986.tar.xz
mana-d2c548e091f203196d93c011fc65944fb1cdc986.zip
Fix sending coordinates for tmwAthena
-rw-r--r--src/net/tmwa/messageout.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index 705b9a96..3197380b 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -68,21 +68,27 @@ void MessageOut::writeInt32(uint32_t value)
mPos += 4;
}
+#define LOBYTE(w) ((unsigned char)(w))
+#define HIBYTE(w) ((unsigned char)(((unsigned short)(w)) >> 8))
+
void MessageOut::writeCoordinates(uint16_t x, uint16_t y, uint8_t direction)
{
char *data = mData + mPos;
mNetwork->mOutSize += 3;
mPos += 3;
- int16_t temp = x;
+ short temp;
+ temp = x;
temp <<= 6;
- data[0] = temp >> 8;
- data[1] = temp;
-
+ data[0] = 0;
+ data[1] = 1;
+ data[2] = 2;
+ data[0] = HIBYTE(temp);
+ data[1] = (unsigned char) temp;
temp = y;
temp <<= 4;
- data[1] |= temp << 8;
- data[2] = temp;
+ data[1] |= HIBYTE(temp);
+ data[2] = LOBYTE(temp);
// Translate direction to eAthena format
switch (direction)