network
Class CNetMessage
ISerializable
|
+--CNetMessage
in NetMessage.h
in NetMessage.cpp
- Direct Known Subclasses:
- CCloseRequestMessage, CConnectCompleteMessage, CNetErrorMessage
- class CNetMessage
- extends ISerializable
The base class for network messages
|
Method Summary |
static CNetCommand* |
CommandFromJSArgs( const CEntityList& entities, JSContext* cx, uintN argc, jsval* argv, bool isQueued )
|
virtual CNetMessage* |
Copy() const
Copy the message |
static CNetMessage* |
CreateEntityIntMessage( const CEntityList& entities, const int type, HEntity& target, int action )
|
static CNetMessage* |
CreatePositionMessage( const CEntityList& entities, const int type, CVector2D pos )
|
static CNetMessage* |
CreateProduceMessage( const CEntityList& entities, const int type, int proType, const CStrW& name )
|
inline operator |
CStr() const
|
const u8* |
Deserialize( const u8* pos, const u8* UNUSED( end ) )
|
static CNetMessage* |
DeserializeMessage( ENetMessageType type, u8* buffer, uint length )
Deserialize a net message, using the globally registered deserializers. |
virtual uint |
GetSerializedLength() const
|
virtual CStr |
GetString() const
Make a string representation of the message. |
inline ENetMessageType |
GetType() const
|
static void |
ScriptingInit()
Register a selection of message types as JS constants. |
virtual u8* |
Serialize( u8* buffer ) const
Serialize the message into the buffer. |
m_Type
private ENetMessageType m_Type;
CNetMessage
protected inline CNetMessage( ENetMessageType type );
~CNetMessage
public virtual ~CNetMessage();
CommandFromJSArgs
public static CNetCommand* CommandFromJSArgs( const CEntityList& entities, JSContext* cx, uintN argc, jsval* argv, bool isQueued );
Copy
public virtual CNetMessage* Copy() const;
- Copy the message
CreateEntityIntMessage
public static CNetMessage* CreateEntityIntMessage( const CEntityList& entities, const int type, HEntity& target, int action );
CreatePositionMessage
public static CNetMessage* CreatePositionMessage( const CEntityList& entities, const int type, CVector2D pos );
CreateProduceMessage
public static CNetMessage* CreateProduceMessage( const CEntityList& entities, const int type, int proType, const CStrW& name );
CStr
public inline operator CStr() const;
Deserialize
public const u8* Deserialize( const u8* pos, const u8* UNUSED( end ) );
DeserializeMessage
public static CNetMessage* DeserializeMessage( ENetMessageType type, u8* buffer, uint length );
- Deserialize a net message, using the globally registered deserializers.
- Parameters:
type - The NetMessageType of the message
buffer - A pointer to the buffer holding the message data
length - The length of the message data
GetSerializedLength
public virtual uint GetSerializedLength() const;
GetString
public virtual CStr GetString() const;
- Make a string representation of the message. The default implementation
returns the empty string
GetType
public inline ENetMessageType GetType() const;
ScriptingInit
public static void ScriptingInit();
- Register a selection of message types as JS constants.
The constant's names will be the same as those of the enums
Serialize
public virtual u8* Serialize( u8* buffer ) const;
- Serialize the message into the buffer. The buffer will have the size
returned from the last call to GetSerializedLength()