Defined in:Called to handle a player-related event.
virtual void HandlePlayerEvent(PlayerEvent event, Player *player, const void *param);
||The player event type. See below for a list of possible types.|
||The player for which the event occurred.|
||A pointer to parameter information for the event.|
HandlePlayerEventfunction can be overridden by an application-defined subclass of the
Applicationclass. This function is called when an event pertaining to a particular player occurs in a multiplayer game. The
eventparameter contains one of the following constants.
||A new player connected to the game.|
||A player disconnected from the game.|
||A player timed out and was disconnected from the game.|
||A new player has been initialized and is ready to receive game state.|
||A player has sent a chat message.|
||A player has changed his name.|
kPlayerChatReceived, then the
paramparameter is a pointer to the chat text string. This string will always have a maximum length of
kPlayerInitialized, then the server has finished initializing a new player in a multiplayer game, and it is about to start sending game state to that player. The event handler should respond to this event by sending one or more application-defined messages back to the player specified by the
playerparameter in order to make sure it is ready to receive game state. For example, it is usually necessary to send information about what world is currently being played back to the new client at this point. After the
kPlayerInitializedis handled, the Message Manager allows all
StateSenderobjects to send their game state, and this is followed by the message journal.