18 #include "precompiled.h"
26 #undef ALLNETMSGS_DONT_CREATE_NMTS
27 #define ALLNETMSGS_IMPLEMENT
55 if (pStart + 3 > pEnd)
57 LOGERROR(L
"CNetMessage: Corrupt packet (smaller than header)");
61 const u8* pBuffer = pStart;
69 if (pStart + size != pEnd)
71 LOGERROR(L
"CNetMessage: Corrupt packet (incorrect size)");
89 return "MESSAGE_TYPE_NONE { Undefined Message }";
91 return "Unknown Message " + CStr::FromInt(
GetType());
111 pNewMessage =
new CPlayerAssignmentMessage;
115 pNewMessage =
new CFileTransferRequestMessage;
119 pNewMessage =
new CFileTransferResponseMessage;
123 pNewMessage =
new CFileTransferDataMessage;
127 pNewMessage =
new CFileTransferAckMessage;
131 pNewMessage =
new CJoinSyncStartMessage;
135 pNewMessage =
new CLoadedGameMessage;
139 pNewMessage =
new CSrvHandshakeMessage;
143 pNewMessage =
new CSrvHandshakeResponseMessage;
147 pNewMessage =
new CCliHandshakeMessage;
151 pNewMessage =
new CAuthenticateMessage;
155 pNewMessage =
new CAuthenticateResultMessage;
159 pNewMessage =
new CGameStartMessage;
163 pNewMessage =
new CEndCommandBatchMessage;
167 pNewMessage =
new CSyncCheckMessage;
171 pNewMessage =
new CSyncErrorMessage;
175 pNewMessage =
new CChatMessage;
183 LOGERROR(L
"CNetMessageFactory::CreateMessage(): Unknown message type '%d' received", header.
GetType());
188 pNewMessage->
Deserialize((
const u8*)pData, (
const u8*)pData + dataSize);
#define Deserialize_int_1(_pos, _val)
The list of messages used by the network subsystem.
virtual u8 * Serialize(u8 *pBuffer) const
Serialize the message into the specified buffer parameter.
#define Serialize_int_1(_pos, _val)
Special message type for updated to game startup settings.
NetMessageType GetType() const
Retrieves the message type.
The base class for all network messages exchanged within the game.
#define Deserialize_int_2(_pos, _val)
virtual size_t GetSerializedLength() const
Retrieves the size in bytes of the serialized message.
#define Serialize_int_2(_pos, _val)
Abstraction around a SpiderMonkey JSContext.
virtual const u8 * Deserialize(const u8 *pStart, const u8 *pEnd)
Deserializes the message from the specified buffer.
static CNetMessage * CreateMessage(const void *pData, size_t dataSize, ScriptInterface &scriptInterface)
Factory method which creates a message object based on the given data.
virtual CStr ToString() const
Returns a string representation for the message.
Special message type for simulation commands.