diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-09-02 13:05:06 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-09-02 13:05:06 +0000 |
commit | 0f3f5ed0b20a34dfa787365e224ba3f49bbc9995 (patch) | |
tree | 37ad2a3aebeca57d859cffe0cbb92822a40349c4 /src/messageout.cpp | |
parent | 379c0e936e090a19d295d8514cf94b4fb367eae6 (diff) | |
download | manaserv-0f3f5ed0b20a34dfa787365e224ba3f49bbc9995.tar.gz manaserv-0f3f5ed0b20a34dfa787365e224ba3f49bbc9995.tar.bz2 manaserv-0f3f5ed0b20a34dfa787365e224ba3f49bbc9995.tar.xz manaserv-0f3f5ed0b20a34dfa787365e224ba3f49bbc9995.zip |
Removed pixel-based synchronisation. Added variable length move messages.
Diffstat (limited to 'src/messageout.cpp')
-rw-r--r-- | src/messageout.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/messageout.cpp b/src/messageout.cpp index 71e81542..7b547bb1 100644 --- a/src/messageout.cpp +++ b/src/messageout.cpp @@ -30,7 +30,7 @@ #include <enet/enet.h> /** 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) { |