34 PRAGMA48(GCC diagnostic ignored
"-Wshadow")
35 #include <SDL_endian.h>
40 #ifndef SDL_BIG_ENDIAN
41 #error missing SDL_endian.h
58 DEBUGLOG2(
"Send packet", 0,
"MessageOut");
74 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
75 int16_t swap = SDL_Swap16(value);
93 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
94 int32_t swap = SDL_Swap32(value);
105 const char *
const str)
118 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
119 int32_t swap = SDL_Swap64(value);
136 #ifdef ENABLEDEBUGLOG
137 std::string text =
strprintf(
"writeFloat: %f", value);
145 #define LOBYTE(w) (CAST_U8(w))
146 #define HIBYTE(w) (CAST_U8((CAST_U16(w)) >> 8))
150 unsigned char direction,
151 const char *
const str)
157 unsigned char *
const data =
reinterpret_cast<unsigned char*
>(
mData)
174 data[2] |= direction;
179 const char *
const str)
181 int stringLength =
CAST_S32(
string.length());
186 length = stringLength;
188 else if (length < stringLength)
191 stringLength = length;
199 if (length > stringLength)
203 length - stringLength);
212 const char *
const str)
214 int stringLength =
CAST_S32(
string.length());
219 length = stringLength;
221 else if (length < stringLength)
224 stringLength = length;
232 if (length > stringLength)
236 length - stringLength);
unsigned int getDataSize() const
static unsigned char toServerDirection(unsigned char direction) A_CONST
const char * getData() const
void writeInt64(const int64_t value, const char *const str)
virtual void expand(size_t size) const =0
void writeInt32(const int32_t value, const char *const str)
void writeInt16(const int16_t value, const char *const str)
virtual void writeInt8(const int8_t value, const char *const str)
void writeStringNoLog(const std::string &string, int length, const char *const str)
void writeString(const std::string &string, int length, const char *const str)
void writeCoordinates(const uint16_t x, const uint16_t y, unsigned char direction, const char *const str)
MessageOut(const int16_t id)
void writeItemId(const int32_t value, const char *const str)
void writeBeingId(const BeingId value, const char *const str)
void writeFloat(const float value, const char *const str)
static void incOutPackets()
#define DEBUGLOG2(str, pos, comment)
std::string toStringPrint(const unsigned int val)
std::string strprintf(const char *const format,...)