diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-18 17:48:29 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-18 17:49:00 +0200 |
commit | f98d003e354a1792117b7cbc771d1dd91475a156 (patch) | |
tree | dc2a297f7c4026394c9954ae4bfd4abd22ef9612 /src/net/tmwa/messageout.cpp | |
parent | bb0a6cb25b2985fd1f74c9d27d5a46f6863e2dee (diff) | |
download | manaplus-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/tmwa/messageout.cpp')
-rw-r--r-- | src/net/tmwa/messageout.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index c12105581..17314937d 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -55,7 +55,7 @@ void MessageOut::expand(size_t bytes) void MessageOut::writeInt16(Sint16 value) { - DEBUGLOG("writeInt16: " + toString((int)value)); + DEBUGLOG("writeInt16: " + toString(static_cast<int>(value))); expand(2); #if SDL_BYTEORDER == SDL_BIG_ENDIAN Sint16 swap = SDL_Swap16(value); @@ -81,8 +81,8 @@ void MessageOut::writeInt32(Sint32 value) PacketCounters::incOutBytes(4); } -#define LOBYTE(w) ((unsigned char)(w)) -#define HIBYTE(w) ((unsigned char)(((unsigned short)(w)) >> 8)) +#define LOBYTE(w) (static_cast<unsigned char>(w)) +#define HIBYTE(w) (static_cast<unsigned char>((static_cast<unsigned short>(w)) >> 8)) void MessageOut::writeCoordinates(unsigned short x, unsigned short y, unsigned char direction) @@ -99,7 +99,7 @@ void MessageOut::writeCoordinates(unsigned short x, unsigned short y, data[1] = 1; data[2] = 2; data[0] = HIBYTE(temp); - data[1] = (unsigned char) temp; + data[1] = static_cast<unsigned char>(temp); temp = y; temp <<= 4; data[1] |= HIBYTE(temp); @@ -134,7 +134,7 @@ void MessageOut::writeCoordinates(unsigned short x, unsigned short y, break; default: // OOPSIE! Impossible or unknown - direction = (unsigned char) -1; + direction = static_cast<unsigned char>(-1); } data[2] |= direction; PacketCounters::incOutBytes(3); |