Skip to content

Commit

Permalink
Network: Minor rework of code to make it same as wotlk
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Mar 24, 2024
1 parent 2d8a2f4 commit 13603a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/game/Server/WorldSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ void WorldSocket::SendPacket(const WorldPacket& pct, bool immediate)
if (pct.size() > 0)
{
// allocate array for full message
std::shared_ptr<std::vector<char>> fullMessage = std::make_shared<std::vector<char>>(sizeof(header) + pct.size());
std::memcpy(fullMessage->data(), reinterpret_cast<const char*>(&header), sizeof(header)); // copy header
std::memcpy((fullMessage->data() + sizeof(header)), reinterpret_cast<const char*>(pct.contents()), pct.size()); // copy packet
std::shared_ptr<std::vector<char>> fullMessage = std::make_shared<std::vector<char>>(header.headerSize() + pct.size());
std::memcpy(fullMessage->data(), header.data(), header.headerSize()); // copy header
std::memcpy((fullMessage->data() + header.headerSize()), reinterpret_cast<const char*>(pct.contents()), pct.size()); // copy packet
auto self(shared_from_this());
Write(fullMessage->data(), fullMessage->size(), [self, fullMessage](const boost::system::error_code& error, std::size_t read) {});
}
Expand Down

0 comments on commit 13603a7

Please sign in to comment.