Object that helps the server manage players. More...
|virtual||~PlayerManager (void) throw ()|
|virtual void||updatePlayer (player_rec_t &pr)=0|
|virtual bool||getPlayerByHostAndPlayerId (conn_id_t udpConnId, int playerId, player_rec_t &pr)=0|
|virtual void||getIterator (conn_id_t udpConnId, iterator_t &iterator)=0|
|requests a new iterator. if hostId is null, iterates over all hosts |
|virtual bool||getNextPlayer (iterator_t &iterator, player_rec_t &pr)=0|
|returns the player for this iteration, and increments iterator |
|static smart_ptr< PlayerManager >||create (smart_ptr< UserManager > &userMgr)|
Object that helps the server manage players.
Players are humans connecting from a remote host, ideally they will sign in as local users as well. There could be multiple players on the same user account. See also rules_players
Iteration is a best effort. If there are other insertions/deletions while you are iterating, then you may miss some players. But if you keep trying to iterate (within the message pump, etc.) you will eventually get through all players. Never count on getting to all players in a single loop, since other threads may be adding/removin players at the same time.
NOTE: (to implementers) all methods should be threadsafe!