mirror of
https://github.com/edubart/otclient.git
synced 2025-04-25 23:39:20 +02:00
Make OutputMessage::addRawString available in Lua (#1218)
This commit is contained in:
parent
e6861d79c9
commit
dab86e6109
@ -818,6 +818,7 @@ void Application::registerLuaFunctions()
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addU32", &OutputMessage::addU32);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addU64", &OutputMessage::addU64);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addString", &OutputMessage::addString);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addRawString", &OutputMessage::addRawString);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addPaddingBytes", &OutputMessage::addPaddingBytes);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("encryptRsa", &OutputMessage::encryptRsa);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("getMessageSize", &OutputMessage::getMessageSize);
|
||||
|
@ -89,6 +89,17 @@ void OutputMessage::addString(const std::string& buffer)
|
||||
m_messageSize += len;
|
||||
}
|
||||
|
||||
void OutputMessage::addRawString(const std::string& buffer)
|
||||
{
|
||||
int len = buffer.length();
|
||||
if (len > MAX_STRING_LENGTH)
|
||||
throw stdext::exception(stdext::format("string length > %d", MAX_STRING_LENGTH));
|
||||
checkWrite(len);
|
||||
memcpy((char*)(m_buffer + m_writePos), buffer.c_str(), len);
|
||||
m_writePos += len;
|
||||
m_messageSize += len;
|
||||
}
|
||||
|
||||
void OutputMessage::addPaddingBytes(int bytes, uint8 byte)
|
||||
{
|
||||
if(bytes <= 0)
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
void addU32(uint32 value);
|
||||
void addU64(uint64 value);
|
||||
void addString(const std::string& buffer);
|
||||
void addRawString(const std::string& buffer);
|
||||
void addPaddingBytes(int bytes, uint8 byte = 0);
|
||||
|
||||
void encryptRsa();
|
||||
|
Loading…
x
Reference in New Issue
Block a user