ManaPlus
Public Member Functions | Private Member Functions | Private Attributes
TmwAthena::MessageOut Class Reference

#include <messageout.h>

Inheritance diagram for TmwAthena::MessageOut:
Net::MessageOut

Public Member Functions

 MessageOut (const int16_t id)
 
 ~MessageOut ()
 
- Public Member Functions inherited from Net::MessageOut
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
 
void resetPos ()
 

Private Member Functions

void expand (const size_t size) const
 

Private Attributes

NetworkmNetwork
 

Additional Inherited Members

- Static Public Member Functions inherited from Net::MessageOut
static unsigned char toServerDirection (unsigned char direction) A_CONST
 
- Protected Member Functions inherited from Net::MessageOut
 MessageOut (const int16_t id)
 
- Protected Attributes inherited from Net::MessageOut
char * mData
 
unsigned int mDataSize
 
unsigned int mPos
 
uint16_t mId
 
bool mIgnore
 

Detailed Description

Used for building an outgoing message.

Definition at line 41 of file messageout.h.

Constructor & Destructor Documentation

◆ MessageOut()

TmwAthena::MessageOut::MessageOut ( const int16_t  id)
explicit

Constructor.

Definition at line 37 of file messageout.cpp.

37  :
38  Net::MessageOut(id),
40 {
43 }
#define CAST_SIZE
Definition: cast.h:34
unsigned int mOutSize
Definition: network.h:106
void fixSendBuffer()
Definition: network.cpp:362
char * mOutBuffer
Definition: network.h:104
static Network * instance()
Definition: network.cpp:179

References CAST_SIZE, Ea::Network::fixSendBuffer(), Net::MessageOut::mData, mNetwork, Ea::Network::mOutBuffer, and Ea::Network::mOutSize.

◆ ~MessageOut()

TmwAthena::MessageOut::~MessageOut ( )
virtual

Reimplemented from Net::MessageOut.

Definition at line 45 of file messageout.cpp.

46 {
47  DEBUGLOG2("writeEnd: ", mPos, "position after end of packet");
48 }
unsigned int mPos
Definition: messageout.h:134
#define DEBUGLOG2(str, pos, comment)
Definition: logger.h:42

References DEBUGLOG2, and Net::MessageOut::mPos.

Member Function Documentation

◆ expand()

void TmwAthena::MessageOut::expand ( const size_t  size) const
privatevirtual

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.

Implements Net::MessageOut.

Definition at line 50 of file messageout.cpp.

51 {
52  mNetwork->mOutSize += CAST_U32(bytes);
54 }
#define CAST_S32
Definition: cast.h:30
#define CAST_U32
Definition: cast.h:31
static void incOutBytes(const int cnt)

References CAST_S32, CAST_U32, PacketCounters::incOutBytes(), mNetwork, and Ea::Network::mOutSize.

Field Documentation

◆ mNetwork

Network* TmwAthena::MessageOut::mNetwork
private

Definition at line 56 of file messageout.h.

Referenced by expand(), and MessageOut().


The documentation for this class was generated from the following files: