C4 Engine
C4 Engine API Documentation

MessageMgr::GetPlayer

Defined in:  C4Messages.h
Returns the player having a specific key.
Prototype

Player *GetPlayer(PlayerKey key) const;

Parameters
key The key for the player to return. If the constant kPlayerServer is specified, then the player representing the server machine is returned.
Description
The GetPlayer function attempts to locate the player whose key matches that given by the key parameter. If the player exists, then a pointer to it is returned. Otherwise, GetPlayer returns nullptr. The constant kPlayerServer may be specified to retrieve the player representing the server on any machine in a multiplayer game.

The entire map of players may be accessed by using the MessageMgr::GetFirstPlayer function.
See Also

MessageMgr::GetFirstPlayer

MessageMgr::GetLocalPlayer

Player