summaryrefslogtreecommitdiff
path: root/src/net/messagein.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2011-06-03 11:19:20 -0600
committerJared Adams <jaxad0127@gmail.com>2011-06-03 12:08:26 -0600
commit3c0cb0e058324ee1d3116017f14387e9a6004442 (patch)
treeb9c00c3fdf1dff7e4c07bf4f8c83c2e7bc03c0f7 /src/net/messagein.cpp
parent894038adf52a3e2b42542239a147d6c1cc1ad204 (diff)
downloadmana-3c0cb0e058324ee1d3116017f14387e9a6004442.tar.gz
mana-3c0cb0e058324ee1d3116017f14387e9a6004442.tar.bz2
mana-3c0cb0e058324ee1d3116017f14387e9a6004442.tar.xz
mana-3c0cb0e058324ee1d3116017f14387e9a6004442.zip
Replace SDL_types.h with cstdint
This required moving to C++0x, so it does that too, and fixes a few errors with that. Reviewed-by: Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>
Diffstat (limited to 'src/net/messagein.cpp')
-rw-r--r--src/net/messagein.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index d9392379..ef9a36f3 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -25,6 +25,8 @@
((unsigned short)(((unsigned char)(low)) | \
((unsigned short)((unsigned char)(high))) << 8))
+#include <cstring>
+
namespace Net {
MessageIn::MessageIn(const char *data, unsigned int length):
@@ -34,9 +36,9 @@ MessageIn::MessageIn(const char *data, unsigned int length):
{
}
-Uint8 MessageIn::readInt8()
+uint8_t MessageIn::readInt8()
{
- Uint8 value = 0;
+ uint8_t value = 0;
if (mPos < mLength)
{
value = mData[mPos];
@@ -45,7 +47,7 @@ Uint8 MessageIn::readInt8()
return value;
}
-void MessageIn::readCoordinates(Uint16 &x, Uint16 &y)
+void MessageIn::readCoordinates(uint16_t &x, uint16_t &y)
{
if (mPos + 3 <= mLength)
{
@@ -56,12 +58,12 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y)
mPos += 3;
}
-void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
+void MessageIn::readCoordinates(uint16_t &x, uint16_t &y, uint8_t &direction)
{
if (mPos + 3 <= mLength)
{
const char *data = mData + mPos;
- Sint16 temp;
+ uint16_t temp;
temp = MAKEWORD(data[1] & 0x00c0, data[0] & 0x00ff);
x = temp >> 6;
@@ -70,7 +72,7 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
direction = data[2] & 0x000f;
- // Translate from eAthena format
+ // Translate from tmwAthena format
switch (direction)
{
case 0:
@@ -108,13 +110,13 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
mPos += 3;
}
-void MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
- Uint16 &dstX, Uint16 &dstY)
+void MessageIn::readCoordinatePair(uint16_t &srcX, uint16_t &srcY,
+ uint16_t &dstX, uint16_t &dstY)
{
if (mPos + 5 <= mLength)
{
const char *data = mData + mPos;
- Sint16 temp;
+ uint16_t temp;
temp = MAKEWORD(data[3], data[2] & 0x000f);
dstX = temp >> 2;