mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Working zone and world communication yay
This commit is contained in:
@@ -32,7 +32,10 @@ void EQ::Net::ServertalkLegacyClient::Send(uint16_t opcode, EQ::Net::Packet &p)
|
||||
|
||||
void EQ::Net::ServertalkLegacyClient::SendPacket(ServerPacket *p)
|
||||
{
|
||||
EQ::Net::StaticPacket pout(p->pBuffer, p->size);
|
||||
EQ::Net::DynamicPacket pout;
|
||||
if (p->pBuffer) {
|
||||
pout.PutData(0, p->pBuffer, p->size);
|
||||
}
|
||||
Send(p->opcode, pout);
|
||||
}
|
||||
|
||||
@@ -41,6 +44,11 @@ void EQ::Net::ServertalkLegacyClient::OnMessage(uint16_t opcode, std::function<v
|
||||
m_message_callbacks.insert(std::make_pair(opcode, cb));
|
||||
}
|
||||
|
||||
void EQ::Net::ServertalkLegacyClient::OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb)
|
||||
{
|
||||
m_message_callback = cb;
|
||||
}
|
||||
|
||||
void EQ::Net::ServertalkLegacyClient::Connect()
|
||||
{
|
||||
if (m_addr.length() == 0 || m_port == 0 || m_connection || m_connecting) {
|
||||
@@ -116,6 +124,10 @@ void EQ::Net::ServertalkLegacyClient::ProcessReadBuffer()
|
||||
if (cb != m_message_callbacks.end()) {
|
||||
cb->second(opcode, p);
|
||||
}
|
||||
|
||||
if (m_message_callback) {
|
||||
m_message_callback(opcode, p);
|
||||
}
|
||||
}
|
||||
else {
|
||||
EQ::Net::StaticPacket p(&m_buffer[current + 4], length);
|
||||
@@ -124,6 +136,10 @@ void EQ::Net::ServertalkLegacyClient::ProcessReadBuffer()
|
||||
if (cb != m_message_callbacks.end()) {
|
||||
cb->second(opcode, p);
|
||||
}
|
||||
|
||||
if (m_message_callback) {
|
||||
m_message_callback(opcode, p);
|
||||
}
|
||||
}
|
||||
|
||||
current += length + 4;
|
||||
|
||||
Reference in New Issue
Block a user