summaryrefslogtreecommitdiff
path: root/src/net/messagein.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/messagein.h')
-rw-r--r--src/net/messagein.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/net/messagein.h b/src/net/messagein.h
index e6118a04..31b4dbfc 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -22,8 +22,7 @@
#ifndef NET_MESSAGEIN_H
#define NET_MESSAGEIN_H
-#include <SDL_types.h>
-
+#include <cstdint>
#include <string>
namespace Net {
@@ -39,7 +38,7 @@ class MessageIn
/**
* Returns the message ID.
*/
- int getId() const { return mId; }
+ uint16_t getId() const { return mId; }
/**
* Returns the message length.
@@ -51,28 +50,39 @@ class MessageIn
*/
unsigned int getUnreadLength() const { return mLength - mPos; }
- virtual int readInt8(); /**< Reads a byte. */
- virtual int readInt16() = 0; /**< Reads a short. */
- virtual int readInt32() = 0; /**< Reads a long. */
+ /**
+ * Reads an unsigned 8-bit integer from the message.
+ */
+ virtual uint8_t readInt8();
+
+ /**
+ * Reads an unsigned 16-bit integer from the message.
+ */
+ virtual uint16_t readInt16() = 0;
+
+ /**
+ * Reads an unsigned 32-bit integer from the message.
+ */
+ virtual uint32_t readInt32() = 0;
/**
* Reads a 3-byte block containing tile-based coordinates. Used by
* manaserv.
*/
- virtual void readCoordinates(Uint16 &x, Uint16 &y);
+ virtual void readCoordinates(uint16_t &x, uint16_t &y);
/**
* Reads a special 3 byte block used by eAthena, containing x and y
* coordinates and direction.
*/
- virtual void readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction);
+ virtual void readCoordinates(uint16_t &x, uint16_t &y, uint8_t &direction);
/**
* Reads a special 5 byte block used by eAthena, containing a source
* and destination coordinate pair.
*/
- virtual void readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
- Uint16 &dstX, Uint16 &dstY);
+ virtual void readCoordinatePair(uint16_t &srcX, uint16_t &srcY,
+ uint16_t &dstX, uint16_t &dstY);
/**
* Skips a given number of bytes.
@@ -89,9 +99,6 @@ class MessageIn
virtual ~MessageIn() {}
protected:
- /**
- * Constructor.
- */
MessageIn(const char *data, unsigned int length);
const char *mData; /**< The message data. */
@@ -106,6 +113,6 @@ class MessageIn
unsigned int mPos;
};
-}
+} // namespace Net
#endif // NET_MESSAGEIN_H