diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-08 14:44:50 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-08 14:44:50 +0000 |
commit | 96ed6284affefcba1b0ded75e4ef88e52b430c4d (patch) | |
tree | 6495166390f2279d8fb68b900191795ead09fda4 /src/net | |
parent | e481ad5466eb2b87036515a2a15166e41828c31f (diff) | |
download | manaserv-96ed6284affefcba1b0ded75e4ef88e52b430c4d.tar.gz manaserv-96ed6284affefcba1b0ded75e4ef88e52b430c4d.tar.xz manaserv-96ed6284affefcba1b0ded75e4ef88e52b430c4d.zip |
Changed some argument types. Added untested protocol for moving objects between slots of inventory. Fixed position of the cleaning bit for looks, so that it actually fits into network data.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/messageout.cpp | 11 | ||||
-rw-r--r-- | src/net/messageout.hpp | 11 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index 57b2db7..7753d9d 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -43,7 +43,7 @@ MessageOut::MessageOut(): mDataSize = INITIAL_DATA_CAPACITY; } -MessageOut::MessageOut(short id): +MessageOut::MessageOut(int id): mPos(0) { mData = (char*) malloc(INITIAL_DATA_CAPACITY); @@ -79,16 +79,14 @@ MessageOut::expand(size_t bytes) } } -void -MessageOut::writeByte(char value) +void MessageOut::writeByte(int value) { expand(mPos + 1); mData[mPos] = value; mPos += 1; } -void -MessageOut::writeShort(short value) +void MessageOut::writeShort(int value) { expand(mPos + 2); uint16_t t = ENET_HOST_TO_NET_16(value); @@ -96,8 +94,7 @@ MessageOut::writeShort(short value) mPos += 2; } -void -MessageOut::writeLong(long value) +void MessageOut::writeLong(int value) { expand(mPos + 4); uint32_t t = ENET_HOST_TO_NET_32(value); diff --git a/src/net/messageout.hpp b/src/net/messageout.hpp index 3515476..2d0490f 100644 --- a/src/net/messageout.hpp +++ b/src/net/messageout.hpp @@ -40,7 +40,7 @@ class MessageOut /** * Constructor that takes a message ID. */ - MessageOut(short id); + MessageOut(int id); /** * Destructor. @@ -52,14 +52,11 @@ class MessageOut */ void clear(); - void - writeByte(char value); /**< Writes a byte. */ + void writeByte(int value); /**< Writes an integer on one byte. */ - void - writeShort(short value); /**< Writes a short. */ + void writeShort(int value); /**< Writes an integer on two bytes. */ - void - writeLong(long value); /**< Writes a long. */ + void writeLong(int value); /**< Writes an integer on four bytes. */ /** * Writes a 3-byte block containing tile-based coordinates. |