mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 21:13:26 +02:00
login protocol cancel
This commit is contained in:
@@ -11,45 +11,45 @@ void InputMessage::reset()
|
||||
m_messageSize = 2;
|
||||
}
|
||||
|
||||
uint8 InputMessage::getU8(bool blockReadPos)
|
||||
uint8 InputMessage::getU8(bool peek)
|
||||
{
|
||||
assert(canRead(1));
|
||||
uint8 v = m_buffer[m_readPos];
|
||||
|
||||
if(!blockReadPos)
|
||||
if(!peek)
|
||||
m_readPos += 1;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
uint16 InputMessage::getU16(bool blockReadPos)
|
||||
uint16 InputMessage::getU16(bool peek)
|
||||
{
|
||||
assert(canRead(2));
|
||||
uint16 v = *(uint16_t*)(m_buffer + m_readPos);
|
||||
|
||||
if(!blockReadPos)
|
||||
if(!peek)
|
||||
m_readPos += 2;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32 InputMessage::getU32(bool blockReadPos)
|
||||
uint32 InputMessage::getU32(bool peek)
|
||||
{
|
||||
assert(canRead(4));
|
||||
uint32 v = *(uint32*)(m_buffer + m_readPos);
|
||||
|
||||
if(!blockReadPos)
|
||||
if(!peek)
|
||||
m_readPos += 4;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
uint64 InputMessage::getU64(bool blockReadPos)
|
||||
uint64 InputMessage::getU64(bool peek)
|
||||
{
|
||||
assert(canRead(8));
|
||||
uint64 v = *(uint64*)(m_buffer + m_readPos);
|
||||
|
||||
if(!blockReadPos)
|
||||
if(!peek)
|
||||
m_readPos += 8;
|
||||
|
||||
return v;
|
||||
|
@@ -20,17 +20,17 @@ public:
|
||||
|
||||
void reset();
|
||||
|
||||
uint8 getU8(bool blockReadPos = false);
|
||||
uint16 getU16(bool blockReadPos = false);
|
||||
uint32 getU32(bool blockReadPos = false);
|
||||
uint64 getU64(bool blockReadPos = false);
|
||||
uint8 getU8(bool peek = false);
|
||||
uint16 getU16(bool peek = false);
|
||||
uint32 getU32(bool peek = false);
|
||||
uint64 getU64(bool peek = false);
|
||||
std::string getString();
|
||||
|
||||
void skipBytes(uint16 bytes) { m_readPos += bytes; }
|
||||
uint8* getBuffer() { return m_buffer; }
|
||||
uint16 getMessageSize() { return m_messageSize; }
|
||||
void setMessageSize(uint16 messageSize) { m_messageSize = messageSize; }
|
||||
bool end() { return m_readPos == m_messageSize; }
|
||||
bool eof() { return m_readPos == m_messageSize; }
|
||||
|
||||
private:
|
||||
bool canRead(int bytes);
|
||||
|
Reference in New Issue
Block a user