From 0f3f5ed0b20a34dfa787365e224ba3f49bbc9995 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sat, 2 Sep 2006 13:05:06 +0000 Subject: Removed pixel-based synchronisation. Added variable length move messages. --- src/messageout.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/messageout.cpp') diff --git a/src/messageout.cpp b/src/messageout.cpp index 71e8154..7b547bb 100644 --- a/src/messageout.cpp +++ b/src/messageout.cpp @@ -30,7 +30,7 @@ #include /** Initial amount of bytes allocated for the messageout data buffer. */ -const unsigned int INITIAL_DATA_CAPACITY = 2; +const unsigned int INITIAL_DATA_CAPACITY = 16; /** Factor by which the messageout data buffer is increased when too small. */ const unsigned int CAPACITY_GROW_FACTOR = 2; @@ -97,6 +97,16 @@ MessageOut::writeLong(long value) mPos += 4; } +void MessageOut::writeCoordinates(int x, int y) +{ + expand(mPos + 3); + char *p = mData + mPos; + p[0] = x & 0x00FF; + p[1] = ((x & 0x0700) >> 8) | ((y & 0x001F) << 3); + p[2] = (y & 0x07E0) >> 5; + mPos += 3; +} + void MessageOut::writeString(const std::string &string, int length) { -- cgit