From 3bce14c324e1d7bbd058e18072acc7bd953d6475 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sat, 2 Sep 2006 13:03:20 +0000 Subject: Removed pixel-based synchronisation. Added variable length move messages. --- src/net/messagein.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/net/messagein.cpp') diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 2c452a4d..a1707e06 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -77,6 +77,17 @@ long MessageIn::readLong() return value; } +void MessageIn::readCoordinates(Uint16 &x, Uint16 &y) +{ + if (mPos + 3 <= mLength) + { + unsigned char const *p = reinterpret_cast< unsigned char const * >(mData + mPos); + x = p[0] | ((p[1] & 0x07) << 8); + y = (p[1] >> 3) | ((p[2] & 0x3F) << 5); + } + mPos += 3; +} + std::string MessageIn::readString(int length) { // Get string length -- cgit v1.2.3-70-g09d2