C4 Engine
C4 Engine API Documentation

class ControllerMessage

Defined in:  C4Messages.h
Base class for all controller message types.
Definition

class ControllerMessage : public Message, public ListElement<ControllerMessage>

Member Functions
ControllerMessage::GetControllerMessageType Returns the dynamic type identifier of a controller message.
ControllerMessage::GetControllerIndex Returns the World Manager controller index corresponding to a controller message.
ControllerMessage::OverridesMessage Returns a boolean value indicating whether a message overrides a previous message in the journal.
Constructor

ControllerMessage(ControllerMessageType type, int32 index, uint32 flags = 0);

Parameters
type The type of controller message.
index The World Manager controller index for this message. For a particular controller, this index can be retrieved using the Controller::GetControllerIndex function.
flags The message flags.
Description
Controller messages are sent directly to Controller objects in order to synchronize the state or motion of the scene graph nodes that they control. A ControllerMessage object may contain no information beyond its type and controller index, or it may be subclassed so that extra data may be added to it. The application module on the server machine typically constructs a controller message when it needs to inform client machines about a change in state for a particular controller and then calls either the MessageMgr::SendMessageAll function or the MessageMgr::SendMessageJournal function to distribute the message. The controller index given by the index parameter identifies the particular controller object that will receive the message on each machine. On the receiving machines, the Controller::ReceiveMessage function is called to process the controller message.

The ControllerMessageType is an unsigned integer in the range 0–255. Values in the range 128–255 are reserved for the engine to use in the Controller base class, and the remaining values are available for use by Controller subclasses. The controller message types are independent for different controller subclasses, so up to 128 types of controller messages can be defined for each controller subclass.
Base Classes
Message All message types are subclasses of Message.
ListElement<ControllerMessage> Used internally by the Message Manager.
See Also

Controller::GetControllerIndex

Controller::CreateMessage

Controller::ReceiveMessage