C4 Engine
C4 Engine API Documentation

Application::CreateMessage

Defined in:  C4Application.h
Called to create an application-defined message.
Prototype

virtual Message *CreateMessage(MessageType type, Decompressor& data) const;

Parameters
type The type of message to construct.
data A Decompressor object holding the raw message data.
Description
When the Message Manager receives a message with an application-defined type, it calls the CreateMessage function to create the appropriate message object. The implementation of the CreateMessage function should examine the message type passed in the type parameter, create an instance of the corresponding subclass of the Message class, and return a pointer to it. If the message type is not recognized, then CreateMessage should return nullptr.

The Message Manager calls the message object's Message::DecompressMessage function immediately after the object is created, so the CreateMessage function should make no effort to initialize any components of the message object that it creates.
See Also

Application::ReceiveMessage

Message::HandleMessage

Message