![]() |
ManaPlus
|
#include <messageout.h>
Public Member Functions | |
| virtual void | writeInt8 (const int8_t value, const char *const str) |
| void | writeInt16 (const int16_t value, const char *const str) |
| void | writeInt32 (const int32_t value, const char *const str) |
| void | writeItemId (const int32_t value, const char *const str) |
| void | writeInt64 (const int64_t value, const char *const str) |
| void | writeBeingId (const BeingId value, const char *const str) |
| void | writeCoordinates (const uint16_t x, const uint16_t y, unsigned char direction, const char *const str) |
| void | writeString (const std::string &string, int length, const char *const str) |
| void | writeStringNoLog (const std::string &string, int length, const char *const str) |
| void | writeFloat (const float value, const char *const str) |
| const char * | getData () const |
| unsigned int | getDataSize () const |
| virtual | ~MessageOut () |
| void | resetPos () |
Static Public Member Functions | |
| static unsigned char | toServerDirection (unsigned char direction) A_CONST |
Protected Member Functions | |
| MessageOut (const int16_t id) | |
| virtual void | expand (size_t size) const =0 |
Protected Attributes | |
| char * | mData |
| unsigned int | mDataSize |
| unsigned int | mPos |
| uint16_t | mId |
| bool | mIgnore |
Used for building an outgoing message.
Definition at line 48 of file messageout.h.
|
inlinevirtual |
Reimplemented in TmwAthena::MessageOut, and EAthena::MessageOut.
Definition at line 108 of file messageout.h.
|
explicitprotected |
Constructor.
Definition at line 49 of file messageout.cpp.
References DEBUGLOG2, IGNOREDEBUGLOG, and PacketCounters::incOutPackets().
|
protectedpure virtual |
Expand the packet data to be able to hold more data.
NOTE: For performance enhancements this method could allocate extra memory in advance instead of expanding size every time more data is added.
Implemented in TmwAthena::MessageOut, and EAthena::MessageOut.
Referenced by writeCoordinates(), writeFloat(), writeInt16(), writeInt32(), writeInt64(), writeInt8(), writeString(), and writeStringNoLog().
| const char * Net::MessageOut::getData | ( | ) | const |
Returns the content of the message.
Definition at line 243 of file messageout.cpp.
References mData.
| unsigned int Net::MessageOut::getDataSize | ( | ) | const |
Returns the length of the data.
Definition at line 248 of file messageout.cpp.
References mDataSize.
|
inline |
|
static |
Definition at line 253 of file messageout.cpp.
References CAST_U8.
Referenced by EAthena::PlayerHandler::setDirection(), EAthena::HomunculusHandler::setDirection(), EAthena::MercenaryHandler::setDirection(), EAthena::PetHandler::setDirection(), and writeCoordinates().
| void Net::MessageOut::writeBeingId | ( | const BeingId | value, |
| const char *const | str | ||
| ) |
Definition at line 129 of file messageout.cpp.
References toInt, and writeInt32().
| void Net::MessageOut::writeCoordinates | ( | const uint16_t | x, |
| const uint16_t | y, | ||
| unsigned char | direction, | ||
| const char *const | str | ||
| ) |
Definition at line 148 of file messageout.cpp.
References CAST_SIZE, CAST_U32, CAST_U8, data, DEBUGLOG2, expand(), HIBYTE, LOBYTE, mData, mPos, strprintf(), toServerDirection(), x, and y.
| void Net::MessageOut::writeFloat | ( | const float | value, |
| const char *const | str | ||
| ) |
Definition at line 134 of file messageout.cpp.
References CAST_SIZE, DEBUGLOG2, expand(), mData, mPos, and strprintf().
| void Net::MessageOut::writeInt16 | ( | const int16_t | value, |
| const char *const | str | ||
| ) |
Writes a long.
Definition at line 71 of file messageout.cpp.
References CAST_SIZE, CAST_U16, CAST_U32, DEBUGLOG2, expand(), mData, mPos, and toStringPrint().
Referenced by EAthena::ChatHandler::sendRaw(), TmwAthena::ChatHandler::sendRaw(), writeItemId(), writeString(), and writeStringNoLog().
| void Net::MessageOut::writeInt32 | ( | const int32_t | value, |
| const char *const | str | ||
| ) |
Definition at line 88 of file messageout.cpp.
References CAST_SIZE, CAST_U32, DEBUGLOG2, expand(), mData, mPos, and toStringPrint().
Referenced by writeBeingId(), and writeItemId().
| void Net::MessageOut::writeInt64 | ( | const int64_t | value, |
| const char *const | str | ||
| ) |
Definition at line 113 of file messageout.cpp.
References CAST_SIZE, CAST_U32, DEBUGLOG2, expand(), mData, mPos, and toStringPrint().
|
virtual |
< Writes a byte. Writes a short.
Definition at line 61 of file messageout.cpp.
References CAST_U32, CAST_U8, DEBUGLOG2, expand(), mData, mPos, and toStringPrint().
| void Net::MessageOut::writeItemId | ( | const int32_t | value, |
| const char *const | str | ||
| ) |
Definition at line 104 of file messageout.cpp.
References CAST_S16, itemIdLen, writeInt16(), and writeInt32().
| void Net::MessageOut::writeString | ( | const std::string & | string, |
| int | length, | ||
| const char *const | str | ||
| ) |
Writes a string. If a fixed length is not given (-1), it is stored as a short at the start of the string.
Definition at line 177 of file messageout.cpp.
References CAST_S16, CAST_S32, CAST_SIZE, DEBUGLOG2, expand(), mData, mPos, and writeInt16().
| void Net::MessageOut::writeStringNoLog | ( | const std::string & | string, |
| int | length, | ||
| const char *const | str | ||
| ) |
Writes a string. If a fixed length is not given (-1), it is stored as a short at the start of the string.
Definition at line 210 of file messageout.cpp.
References CAST_S16, CAST_S32, CAST_SIZE, DEBUGLOG2, expand(), mData, mPos, and writeInt16().
|
protected |
Data building up.
Definition at line 132 of file messageout.h.
Referenced by getData(), EAthena::MessageOut::MessageOut(), TmwAthena::MessageOut::MessageOut(), writeCoordinates(), writeFloat(), writeInt16(), writeInt32(), writeInt64(), writeInt8(), writeString(), and writeStringNoLog().
|
protected |
|
protected |
Definition at line 135 of file messageout.h.
|
protected |
Definition at line 136 of file messageout.h.
|
protected |
Position in the data.
Definition at line 134 of file messageout.h.
Referenced by resetPos(), writeCoordinates(), writeFloat(), writeInt16(), writeInt32(), writeInt64(), writeInt8(), writeString(), writeStringNoLog(), EAthena::MessageOut::~MessageOut(), and TmwAthena::MessageOut::~MessageOut().