diff options
Diffstat (limited to 'src/net/messagein.cpp')
-rw-r--r-- | src/net/messagein.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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 |