#include <messagein.h>
Definition at line 33 of file messagein.h.
Public Member Functions | |
MessageIn (const char *data, unsigned int length) | |
Constructor. | |
int | getId () const |
Returns the message ID. | |
unsigned int | getLength () const |
Returns the message length. | |
unsigned int | getUnreadLength () const |
Returns the length of unread data. | |
int | readInt8 () |
Reads a byte. | |
int | readInt16 () |
Reads a short. | |
int | readInt32 () |
Reads a long. | |
void | readCoordinates (Uint16 &x, Uint16 &y) |
Reads a 3-byte block containing tile-based coordinates. | |
void | readCoordinates (Uint16 &x, Uint16 &y, Uint8 &direction) |
Reads a special 3 byte block used by eAthena, containing x and y coordinates and direction. | |
void | readCoordinatePair (Uint16 &srcX, Uint16 &srcY, Uint16 &dstX, Uint16 &dstY) |
Reads a special 5 byte block used by eAthena, containing a source and destination coordinate pair. | |
void | skip (unsigned int length) |
Skips a given number of bytes. | |
std::string | readString (int length=-1) |
Reads a string. | |
Private Attributes | |
const char * | mData |
The message data. | |
unsigned int | mLength |
The length of the data. | |
unsigned short | mId |
The message ID. | |
unsigned int | mPos |
Actual position in the packet. |
MessageIn::MessageIn | ( | const char * | data, | |
unsigned int | length | |||
) |
int MessageIn::getId | ( | ) | const [inline] |
unsigned int MessageIn::getLength | ( | ) | const [inline] |
unsigned int MessageIn::getUnreadLength | ( | ) | const [inline] |
int MessageIn::readInt8 | ( | ) |
int MessageIn::readInt16 | ( | ) |
int MessageIn::readInt32 | ( | ) |
void MessageIn::readCoordinates | ( | Uint16 & | x, | |
Uint16 & | y | |||
) |
Reads a 3-byte block containing tile-based coordinates.
Used by tmwserv.
Definition at line 97 of file messagein.cpp.
void MessageIn::readCoordinates | ( | Uint16 & | x, | |
Uint16 & | y, | |||
Uint8 & | direction | |||
) |
Reads a special 3 byte block used by eAthena, containing x and y coordinates and direction.
Definition at line 108 of file messagein.cpp.
void MessageIn::readCoordinatePair | ( | Uint16 & | srcX, | |
Uint16 & | srcY, | |||
Uint16 & | dstX, | |||
Uint16 & | dstY | |||
) |
Reads a special 5 byte block used by eAthena, containing a source and destination coordinate pair.
Definition at line 157 of file messagein.cpp.
void MessageIn::skip | ( | unsigned int | length | ) |
std::string MessageIn::readString | ( | int | length = -1 |
) |
Reads a string.
If a length is not given (-1), it is assumed that the length of the string is stored in a short at the start of the string.
Definition at line 184 of file messagein.cpp.
const char* MessageIn::mData [private] |
unsigned int MessageIn::mLength [private] |
unsigned short MessageIn::mId [private] |
unsigned int MessageIn::mPos [private] |
Actual position in the packet.
From 0 to packet->length. A value bigger than packet->length means EOP was reached when reading it.
Definition at line 101 of file messagein.h.