summaryrefslogtreecommitdiff
path: root/src/net/messagein.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-18 17:48:29 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-18 17:49:00 +0200
commitf98d003e354a1792117b7cbc771d1dd91475a156 (patch)
treedc2a297f7c4026394c9954ae4bfd4abd22ef9612 /src/net/messagein.cpp
parentbb0a6cb25b2985fd1f74c9d27d5a46f6863e2dee (diff)
downloadmanaplus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.gz
manaplus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.bz2
manaplus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.xz
manaplus-f98d003e354a1792117b7cbc771d1dd91475a156.zip
Fix most old style cast except manaserv and libxml2 defines.
Diffstat (limited to 'src/net/messagein.cpp')
-rw-r--r--src/net/messagein.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index e39a443f1..9ffc052f6 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -30,8 +30,8 @@
#include "utils/stringutils.h"
#define MAKEWORD(low, high) \
- ((unsigned short)(((unsigned char)(low)) | \
- ((unsigned short)((unsigned char)(high))) << 8))
+ (static_cast<unsigned short>((static_cast<unsigned char>(low)) | \
+ (static_cast<unsigned short>(static_cast<unsigned char>(high))) << 8))
namespace Net
{
@@ -121,14 +121,16 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
break;
}
default:
- logger->log("incorrect direction: %d", (int)direction);
+ logger->log("incorrect direction: %d",
+ static_cast<int>(direction));
// OOPSIE! Impossible or unknown
direction = 0;
}
}
mPos += 3;
PacketCounters::incInBytes(3);
- DEBUGLOG("readCoordinates: " + toString((int)x) + "," + toString((int)y));
+ DEBUGLOG("readCoordinates: " + toString(static_cast<int>(x))
+ + "," + toString(static_cast<int>(y)));
}
void MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
@@ -151,9 +153,10 @@ void MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
srcY = static_cast<unsigned short>(temp >> 4);
}
mPos += 5;
- DEBUGLOG("readCoordinatePair: " + toString((int)srcX) + ","
- + toString((int)srcY) + " " + toString((int)dstX) + ","
- + toString((int)dstY));
+ DEBUGLOG("readCoordinatePair: " + toString(static_cast<int>(srcX)) + ","
+ + toString(static_cast<int>(srcY)) + " "
+ + toString(static_cast<int>(dstX)) + ","
+ + toString(static_cast<int>(dstY)));
PacketCounters::incInBytes(5);
}
@@ -161,7 +164,7 @@ void MessageIn::skip(unsigned int length)
{
mPos += length;
PacketCounters::incInBytes(length);
- DEBUGLOG("skip: " + toString((int)length));
+ DEBUGLOG("skip: " + toString(static_cast<int>(length)));
}
std::string MessageIn::readString(int length)