Clean up MOTD processing

This commit is contained in:
Michael Cook (mackal) 2021-03-05 15:24:40 -05:00
parent 66f89416d5
commit 224c26620e

View File

@ -473,20 +473,16 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
break; break;
} }
case ServerOP_Motd: { case ServerOP_Motd: {
ServerMotd_Struct* smotd = (ServerMotd_Struct*)pack->pBuffer; if (pack->size != sizeof(ServerMotd_Struct))
EQApplicationPacket *outapp; break;
outapp = new EQApplicationPacket(OP_MOTD);
char tmp[500] = { 0 };
sprintf(tmp, "%s", smotd->motd);
outapp->size = strlen(tmp) + 1; ServerMotd_Struct *smotd = (ServerMotd_Struct *)pack->pBuffer;
outapp->pBuffer = new uchar[outapp->size]; SerializeBuffer buf(100);
memset(outapp->pBuffer, 0, outapp->size); buf.WriteString(smotd->motd);
strcpy((char*)outapp->pBuffer, tmp);
entity_list.QueueClients(0, outapp); auto outapp = std::make_unique<EQApplicationPacket>(OP_MOTD, buf);
safe_delete(outapp);
entity_list.QueueClients(0, outapp.get());
break; break;
} }
case ServerOP_ShutdownAll: { case ServerOP_ShutdownAll: {