Code:
void Super::send_server(uint8 * buf, int size)
{
if(m_hook == 0)
return;
m_hook->send_server(buf, size);
trace_printf("-------------- Super to server ");
MessageType & type = m_message_types[*buf];
trace_printf("%s\n", type.name);
trace_dump(buf, size);
}
void Super::send_client(uint8 * buf, int size)
{
if(m_hook == 0)
return;
m_hook->send_client(buf, size);
trace_printf("-------------- Super to client ");
MessageType & type = m_message_types[*buf];
trace_printf("%s\n", type.name);
trace_dump(buf, size);
}
void Super::client_print(const char * text)
{
int size = 44 + strlen(text) + 1;
uint8 * buf = new uint8[size];
buf[0] = CODE_SERVER_TALK;
pack_big_uint16(buf + 1, size);
pack_big_uint32(buf + 3, INVALID_SERIAL); // serial
pack_big_uint16(buf + 7, 0); // graphic
buf[9] = 0; // mode (0=normal)
//pack_big_uint16(buf + 10, 0x03b2); // colour (0x03b2=grey)
pack_big_uint16(buf + 10, 0x0440); // colour
pack_big_uint16(buf + 12, 3); // font
strcpy(reinterpret_cast<char *>(buf + 14), "Super"); // name
strcpy(reinterpret_cast<char *>(buf + 44), text);
send_client(buf, size);
delete /*[]*/ buf;
}
void Super::client_print(const string & text)
{
client_print(text.c_str());
}