Message Manager
C4Messages.h

class StateSender

Encapsulates a function that sends initial game state in a multiplayer game.
Definition

class StateSender : public ListElement<StateSender>

Constructor

StateSender(SenderProc *proc, void *data);

Parameters
proc A pointer to the state-sending function.
data A pointer to application-defined data that is passed to the state-sending function.
Description
The StateSender class encapsulates a function that is called whenever a new client machine joins a multiplayer game. All state-sending functions are called immediately after the Message Manager sends the kPlayerInitialized event to the Application::HandlePlayerEvent function on the server machine. The function pointed to by the proc parameter should have the following prototype.

typedef void SenderProc(Player *to, void *);

The state-sending function should send any necessary messages to the player specified by the to parameter in order to synchronize some kind of initial game state.

The World Manager installs a state-sending function that sends initial controller state messages to a new client. A controller can send initial game state messages by overriding the Controller::SendInitialStateMessages function.
Base Classes
ListElement<StateSender> Used internally by the Message Manager.
See Also
MessageMgr::InstallStateSender

Controller::SendInitialStateMessages