summaryrefslogtreecommitdiff
path: root/src/net/eathena/messageout.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-09 01:14:05 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-09 01:14:05 +0300
commit8d1a43609fcf67bbffb26ab52fdb07f095f602b8 (patch)
tree7a9e548023cdf4f705a3a042aefb66d47645f74a /src/net/eathena/messageout.cpp
parentd9c62405db9a3f8bffaa5789bd63f59a65e29e3a (diff)
downloadplus-8d1a43609fcf67bbffb26ab52fdb07f095f602b8.tar.gz
plus-8d1a43609fcf67bbffb26ab52fdb07f095f602b8.tar.bz2
plus-8d1a43609fcf67bbffb26ab52fdb07f095f602b8.tar.xz
plus-8d1a43609fcf67bbffb26ab52fdb07f095f602b8.zip
improve messageout class.
Diffstat (limited to 'src/net/eathena/messageout.cpp')
-rw-r--r--src/net/eathena/messageout.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp
index f25666526..734ce4057 100644
--- a/src/net/eathena/messageout.cpp
+++ b/src/net/eathena/messageout.cpp
@@ -39,7 +39,7 @@
namespace EAthena
{
-MessageOut::MessageOut(short id):
+MessageOut::MessageOut(const short id):
Net::MessageOut(id),
mNetwork(EAthena::Network::instance())
{
@@ -49,15 +49,15 @@ MessageOut::MessageOut(short id):
writeInt16(id);
}
-void MessageOut::expand(size_t bytes)
+void MessageOut::expand(const size_t bytes)
{
mNetwork->mOutSize += static_cast<unsigned>(bytes);
PacketCounters::incOutBytes(static_cast<int>(bytes));
}
-void MessageOut::writeInt16(int16_t value)
+void MessageOut::writeInt16(const int16_t value)
{
- DEBUGLOG("writeInt16: " + toString(static_cast<int>(value)));
+ DEBUGLOG("writeInt16: " + toStringPrint(static_cast<int>(value)));
expand(2);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int16_t swap = SDL_Swap16(value);
@@ -69,9 +69,9 @@ void MessageOut::writeInt16(int16_t value)
PacketCounters::incOutBytes(2);
}
-void MessageOut::writeInt32(int32_t value)
+void MessageOut::writeInt32(const int32_t value)
{
- DEBUGLOG("writeInt32: " + toString(value));
+ DEBUGLOG("writeInt32: " + toStringPrint(value));
expand(4);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int32_t swap = SDL_Swap32(value);
@@ -87,7 +87,8 @@ void MessageOut::writeInt32(int32_t value)
#define HIBYTE(w) (static_cast<unsigned char>(( \
static_cast<unsigned short>(w)) >> 8))
-void MessageOut::writeCoordinates(unsigned short x, unsigned short y,
+void MessageOut::writeCoordinates(const unsigned short x,
+ const unsigned short y,
unsigned char direction)
{
DEBUGLOG(strprintf("writeCoordinates: %u,%u %u", x, y, direction));
@@ -95,8 +96,7 @@ void MessageOut::writeCoordinates(unsigned short x, unsigned short y,
mNetwork->mOutSize += 3;
mPos += 3;
- short temp;
- temp = x;
+ short temp = x;
temp <<= 6;
data[0] = 0;
data[1] = 1;