#include <messagein.hpp>
Public Member Functions | |
MessageIn (const char *data, int length) | |
Constructor. | |
int | getId () const |
Returns the message ID. | |
int | getLength () const |
Returns the total length of this message. | |
int | readByte () |
Reads a byte. | |
int | readShort () |
Reads a short. | |
int | readLong () |
Reads a long. | |
std::string | readString (int length=-1) |
Reads a string. | |
int | getUnreadLength () const |
Returns the length of unread data. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const MessageIn &msg) |
Streams message ID and length to the given output stream. |
Definition at line 32 of file messagein.hpp.
int MessageIn::readByte | ( | ) |
Reads a byte.
Definition at line 39 of file messagein.cpp.
Referenced by GameHandler::processMessage().
int MessageIn::readShort | ( | ) |
Reads a short.
Definition at line 50 of file messagein.cpp.
Referenced by GameHandler::handleWalk(), MessageIn(), GameHandler::processMessage(), AccountConnection::processMessage(), ServerHandler::processMessage(), readString(), and AccountConnection::sendPost().
int MessageIn::readLong | ( | ) |
Reads a long.
Definition at line 63 of file messagein.cpp.
Referenced by Character::Character(), GameHandler::processMessage(), AccountConnection::processMessage(), and ServerHandler::processMessage().
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 76 of file messagein.cpp.
References readShort().
Referenced by Character::Character(), GameHandler::processMessage(), AccountConnection::processMessage(), ChatHandler::processMessage(), ServerHandler::processMessage(), and AccountConnection::sendPost().