C4 Engine Terathon Software C4 Engine API Documentation

• System Utilities

API Links
Developer Links

Application::ConstructMessage

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

virtual Message *ConstructMessage(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 ConstructMessage function to construct the appropriate message object. The implementation of the ConstructMessage function should examine the message type passed in the type parameter, construct the corresponding subclass of the Message class, and return a pointer to it. If the message type is not recognized, then ConstructMessage should return nullptr.

The Message Manager calls the message object's Message::Decompress function immediately after the object is constructed, so the ConstructMessage function should make no effort to initialize any components of the message object that it constructs.
See Also

Application::ReceiveMessage

Message::HandleMessage

Message