Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
640 B
2
Indexable
Never
 auto data{ world->Pack() };
        GameUpdatePacket* update_packet{ static_cast<GameUpdatePacket*>(std::malloc(sizeof(GameUpdatePacket) + data.size())) };
        update_packet->m_type = NET_GAME_PACKET_SEND_MAP_DATA;
        update_packet->m_net_id = -1;
        update_packet->m_flags |= NET_GAME_PACKET_FLAGS_EXTENDED;
        update_packet->m_data_size = static_cast<uint32_t>(data.size());
        std::memcpy(&update_packet->m_data, data.data(), data.size());
        player->SendPacket(NET_MESSAGE_GAME_PACKET, update_packet, sizeof(GameUpdatePacket) + data.size());
        
        data.clear();
        std::free(update_packet);