18 #include "precompiled.h"
32 LOGMESSAGE(L
"Net: Sending message %hs of size %lu to %hs", message->
ToString().c_str(), (
unsigned long)packet->dataLength, peerName);
37 LOGERROR(L
"Net: Failed to send packet to peer");
56 std::vector<u8> buffer;
63 ENetPacket* packet = enet_packet_create(&buffer[0], size, ENET_PACKET_FLAG_RELIABLE);
65 LOGERROR(L
"Net: Failed to construct packet");
72 int ret = enet_initialize();
struct _ENetPeer ENetPeer
static bool SendMessage(const CNetMessage *message, ENetPeer *peer, const char *peerName)
Transmit a message to the given peer.
static void Initialize()
Initialize ENet.
virtual u8 * Serialize(u8 *pBuffer) const
Serialize the message into the specified buffer parameter.
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
static ENetPacket * CreatePacket(const CNetMessage *message)
Construct an ENet packet by serialising the given message.
Various declarations shared by networking code.
The base class for all network messages exchanged within the game.
struct _ENetPacket ENetPacket
virtual size_t GetSerializedLength() const
Retrieves the size in bytes of the serialized message.
static const int DEFAULT_CHANNEL
static void Deinitialize()
Deinitialize ENet.
virtual CStr ToString() const
Returns a string representation for the message.