Player Class Reference
[Game Data]

Class with player's data. More...

#include <player.h>

Collaboration diagram for Player:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Player ()
 ~Player ()
std::string & getName ()
 Returns the name of player.
void setName (const std::string &name)
TankgetTank ()
 Return players tank.
int getKills () const
void killsUP ()
int getID () const
 Return id of player.
void setID (int newID)
 Set players ID.

Private Attributes

int mID
 Players uniq ID. -1 means invalid ID.
std::string mName
 Player's name.
int mKills
 Number of killed enemies.
int mDeaths
 How much times the player was killed.
TankmTank
 The tank controlled by Player. May be NULL.
int mPing
 Player's network response time in miliseconds.

Detailed Description

Class with player's data.

Definition at line 14 of file player.h.


Constructor & Destructor Documentation

Player::Player  ) 
 

Definition at line 6 of file player.cpp.

References mID, and mKills.

Player::~Player  ) 
 

Definition at line 12 of file player.cpp.


Member Function Documentation

int Player::getID  )  const
 

Return id of player.

The id corresponds to id in Game

Returns:
id of player. -1 (negative) id means invalid value.

Definition at line 40 of file player.cpp.

References mID.

Referenced by CommanderClient::command_players().

int Player::getKills  )  const
 

Definition at line 30 of file player.cpp.

References mKills.

std::string & Player::getName  ) 
 

Returns the name of player.

Returns:
Player's name

Definition at line 18 of file player.cpp.

References mName.

Tank* Player::getTank  )  [inline]
 

Return players tank.

Every player may have tank. But the player may also be without it. So check return value for 0.

Returns:
Associated tank. May be 0

Definition at line 34 of file player.h.

References mTank.

void Player::killsUP  ) 
 

Definition at line 35 of file player.cpp.

References mKills.

void Player::setID int  newID  ) 
 

Set players ID.

This function should be called only from Game since the ID must correspond to ID in Game. So DON'T call this if you aren't unsure.

Parameters:
newID new players ID

Definition at line 45 of file player.cpp.

References mID.

void Player::setName const std::string &  name  ) 
 

Definition at line 24 of file player.cpp.

References mName.

Referenced by TaskSimulationServer::tick().


Member Data Documentation

int Player::mDeaths [private]
 

How much times the player was killed.

Definition at line 66 of file player.h.

int Player::mID [private]
 

Players uniq ID. -1 means invalid ID.

Definition at line 62 of file player.h.

Referenced by getID(), Player(), and setID().

int Player::mKills [private]
 

Number of killed enemies.

Definition at line 65 of file player.h.

Referenced by getKills(), killsUP(), and Player().

std::string Player::mName [private]
 

Player's name.

Definition at line 64 of file player.h.

Referenced by getName(), and setName().

int Player::mPing [private]
 

Player's network response time in miliseconds.

Definition at line 70 of file player.h.

Tank* Player::mTank [private]
 

The tank controlled by Player. May be NULL.

Definition at line 68 of file player.h.

Referenced by getTank().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:20:42 2006 for bjs by  doxygen 1.4.5