diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-19 12:28:42 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-19 12:28:42 +0000 |
commit | 2c4d4ecc19fc8308b2772e4ffe6570ca362264d1 (patch) | |
tree | a4b6d78a89bfd12b3667129bd0bae63a805682cd /src/net/messageout.cpp | |
parent | cf0f74488b0f2057bc535774dc6a2c871311932f (diff) | |
download | mana-client-2c4d4ecc19fc8308b2772e4ffe6570ca362264d1.tar.gz mana-client-2c4d4ecc19fc8308b2772e4ffe6570ca362264d1.tar.bz2 mana-client-2c4d4ecc19fc8308b2772e4ffe6570ca362264d1.tar.xz mana-client-2c4d4ecc19fc8308b2772e4ffe6570ca362264d1.zip |
Got rid of writeSet() calls.
Diffstat (limited to 'src/net/messageout.cpp')
-rw-r--r-- | src/net/messageout.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index daf5ebf4..e7928a4d 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -36,8 +36,6 @@ MessageOut::MessageOut(): mDataSize(0), mPos(0) { - // TODO: data not to be already allocated, keep it this way unitl full - // conversion mData = out + out_size; } @@ -64,6 +62,7 @@ void MessageOut::writeByte(char value) expand(mPos + sizeof(char)); mData[mPos] = value; mPos += sizeof(char); + out_size += sizeof(char); } void MessageOut::writeShort(short value) @@ -76,6 +75,7 @@ void MessageOut::writeShort(short value) #endif //SDLNet_Write16(value, &mData[mPos]); mPos += sizeof(short); + out_size += sizeof(short); } void MessageOut::writeLong(long value) @@ -88,6 +88,7 @@ void MessageOut::writeLong(long value) #endif //SDLNet_Write32(value, &mData[mPos]); mPos += sizeof(long); + out_size += sizeof(long); } void MessageOut::writeString(const std::string &string, int length) @@ -110,12 +111,14 @@ void MessageOut::writeString(const std::string &string, int length) // Write the actual string memcpy(&mData[mPos], (void*)toWrite.c_str(), toWrite.length()); mPos += toWrite.length(); + out_size += toWrite.length(); // Pad remaining space with zeros if (length > (int)toWrite.length()) { memset(&mData[mPos], '\0', length - toWrite.length()); mPos += length - toWrite.length(); + out_size += length - toWrite.length(); } } |