Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Special message type for simulation commands. More...
#include <NetMessage.h>
Public Member Functions | |
CSimulationMessage (const ScriptInterface &scriptInterface) | |
CSimulationMessage (const ScriptInterface &scriptInterface, u32 client, i32 player, u32 turn, JS::HandleValue data) | |
CSimulationMessage (const CSimulationMessage &orig) | |
The compiler can't create a copy constructor because of the PersistentRooted member, so we have to write it manually. More... | |
virtual u8 * | Serialize (u8 *pBuffer) const |
Serialize the message into the specified buffer parameter. More... | |
virtual const u8 * | Deserialize (const u8 *pStart, const u8 *pEnd) |
Deserializes the message from the specified buffer. More... | |
virtual size_t | GetSerializedLength () const |
Retrieves the size in bytes of the serialized message. More... | |
virtual CStr | ToString () const |
Returns a string representation for the message. More... | |
Public Member Functions inherited from CNetMessage | |
CNetMessage () | |
CNetMessage (NetMessageType type) | |
virtual | ~CNetMessage () |
NetMessageType | GetType () const |
Retrieves the message type. More... | |
virtual u8 * | Serialize (u8 *pBuffer) const |
Serialize the message into the specified buffer parameter. More... | |
virtual const u8 * | Deserialize (const u8 *pStart, const u8 *pEnd) |
Deserializes the message from the specified buffer. More... | |
virtual size_t | GetSerializedLength () const |
Retrieves the size in bytes of the serialized message. More... | |
virtual CStr | ToString () const |
Returns a string representation for the message. More... | |
Public Member Functions inherited from ISerializable | |
virtual | ~ISerializable () |
virtual size_t | GetSerializedLength () const =0 |
Return the length of the serialized form of this object. More... | |
virtual u8 * | Serialize (u8 *buffer) const =0 |
Serialize the object into the passed buffer. More... | |
virtual const u8 * | Deserialize (const u8 *buffer, const u8 *end)=0 |
Deserialize the object (i.e. More... | |
Public Attributes | |
u32 | m_Client |
i32 | m_Player |
u32 | m_Turn |
JS::PersistentRooted< JS::Value > | m_Data |
Private Attributes | |
const ScriptInterface & | m_ScriptInterface |
Special message type for simulation commands.
These commands are exposed as arbitrary JS objects, associated with a specific player.
CSimulationMessage::CSimulationMessage | ( | const ScriptInterface & | scriptInterface | ) |
CSimulationMessage::CSimulationMessage | ( | const ScriptInterface & | scriptInterface, |
u32 | client, | ||
i32 | player, | ||
u32 | turn, | ||
JS::HandleValue | data | ||
) |
CSimulationMessage::CSimulationMessage | ( | const CSimulationMessage & | orig | ) |
The compiler can't create a copy constructor because of the PersistentRooted member, so we have to write it manually.
NOTE: It doesn't clone the m_Data member and the copy will reference the same JS::Value!
Deserializes the message from the specified buffer.
pStart | Message start within the serialized buffer |
pEnd | Message end within the serialized buffer |
Reimplemented from CNetMessage.
|
virtual |
Retrieves the size in bytes of the serialized message.
Before calling Serialize, the memory size for the buffer where to serialize the message object can be found by calling this method.
Reimplemented from CNetMessage.
Serialize the message into the specified buffer parameter.
The size required by the buffer parameter can be found by a call to GetSerializedLength method. The information contained within the message must be serialized before the message is sent. By default only the message type and its size are serialized in the buffer parameter.
pBuffer | Buffer where to serialize the message |
Reimplemented from CNetMessage.
|
virtual |
Returns a string representation for the message.
Reimplemented from CNetMessage.
u32 CSimulationMessage::m_Client |
JS::PersistentRooted<JS::Value> CSimulationMessage::m_Data |
i32 CSimulationMessage::m_Player |
|
private |
u32 CSimulationMessage::m_Turn |