![]() |
• Message Manager | ||||
|
API Links
Developer Links
|
MessageMgr::SetPlayerConstructorDefined in:
Sets the construction function for Player objects.
C4Messages.hPrototype
Parameters
Description
When the Message Manager needs to construct a new Player object, it first checks to see if a player constructor function has been installed. If so, then it calls the player construction function, allowing the application to construct an object of a type that is a subclass of the Player class. Initially, there is no player constructor function, so the Message Manager just constructs the Player base class.The SetPlayerConstructor function should be called by an application's startup code when it wants to use a subclass of the Player class to represent players in a game. The proc parameter should point to a function with the following signature.
Player base class. The second parameter is set to the value specified by the data parameter of the SetPlayerConstructor function. Ordinarily, this callback should simply construct a new object having type that is a subclass of Player and return it.The current player constructor can be uninstalled by calling the SetPlayerConstructor function with a value of nullptr for the proc parameter.
See Also
|