Player Class Reference
[Engine Module]

#include <player.h>

Inheritance diagram for Player:

PlayerRemoteClient MessageReceiver< ActionEvent > MessageReceiver< InputEvent > RemoteClient Root Object TreeNode< Root > Referenced Counted Serialized List< Root > ListNode< Root >

List of all members.

Public Member Functions

 Player (const char *id)
virtual ~Player ()
const string & GetName () const
void SetName (const string &name)
const string & GetRaceId () const
void SetRaceId (const string &race_id)
const vector3GetColor () const
void SetColor (const vector3 &color)
void SetActive (bool active)
bool IsActive () const
bool IsHyper () const
bool LoadResources ()
void UnloadResources ()
void CreatePlayerMap (const MapSize &map_size)
void DeletePlayerMap ()
bool UpdatePlayerMap (const Unit *unit, bool added)
PlayerMapGetPlayerMap () const
UnitNewUnit (const string &prototype_id)
UnitNewUnit (Prototype *prototype)
bool RegisterUnit (Unit *unit)
bool DeregisterUnit (Unit *unit)
UnitGetUnit (ushort_t remote_id) const
void Update ()

Protected Member Functions

virtual void OnMessage (ActionEvent *pevent)
virtual void OnMessage (InputEvent *pevent)
virtual bool Serialize (Serializer &serializer)
virtual bool Deserialize (Serializer &serializer, bool first)

Protected Attributes

string name
 Full player name.
string race_id
 Race selected during game establishing.
vector3 color
 Color selected during game establishing.
Ref< Racerace
 Player's race.
Ref< Rootunits
 Root node of all units owned by player.
UnitsMap units_map
 Hash map for translation remote identifiers of units.
bool active
 Where player is active (= is myself).
PlayerMapmap
 Local map of player that contains information like warfog etc.

Private Types

typedef hash_map
< ushort_t, Unit * > 
UnitsMap

Friends

class Level


Member Typedef Documentation

typedef hash_map<ushort_t, Unit *> Player::UnitsMap [private]


Constructor & Destructor Documentation

Player::Player ( const char *  id  ) 

Sets color to default red.

Player::~Player (  )  [virtual]

Unloads resources and destroys player map.


Member Function Documentation

const string & Player::GetName (  )  const [inline]

void Player::SetName ( const string &  name  )  [inline]

const string & Player::GetRaceId (  )  const [inline]

void Player::SetRaceId ( const string &  race_id  )  [inline]

const vector3 & Player::GetColor (  )  const [inline]

void Player::SetColor ( const vector3 color  )  [inline]

void Player::SetActive ( bool  active  )  [inline]

bool Player::IsActive (  )  const [inline]

bool Player::IsHyper (  )  const [inline]

Todo:
Detect hyper player.

bool Player::LoadResources (  ) 

Todo:
Load missing race from server.

void Player::UnloadResources (  ) 

void Player::CreatePlayerMap ( const MapSize map_size  ) 

void Player::DeletePlayerMap (  ) 

bool Player::UpdatePlayerMap ( const Unit unit,
bool  added 
)

PlayerMap * Player::GetPlayerMap (  )  const [inline]

Unit * Player::NewUnit ( const string &  prototype_id  ) 

Unit * Player::NewUnit ( Prototype prototype  ) 

bool Player::RegisterUnit ( Unit unit  ) 

bool Player::DeregisterUnit ( Unit unit  ) 

Unit * Player::GetUnit ( ushort_t  remote_id  )  const [inline]

void Player::Update (  ) 

void Player::OnMessage ( ActionEvent pevent  )  [protected, virtual]

Reimplemented from MessageReceiver< ActionEvent >.

void Player::OnMessage ( InputEvent pevent  )  [protected, virtual]

Reimplemented from MessageReceiver< InputEvent >.

bool Player::Serialize ( Serializer serializer  )  [protected, virtual]

Todo:
Implement.

Reimplemented from Root.

bool Player::Deserialize ( Serializer serializer,
bool  first 
) [protected, virtual]

Recursively deserialize all children.

Reimplemented from Root.


Friends And Related Function Documentation

friend class Level [friend]


Member Data Documentation

string Player::name [protected]

Full player name.

string Player::race_id [protected]

Race selected during game establishing.

vector3 Player::color [protected]

Color selected during game establishing.

Ref<Race> Player::race [protected]

Player's race.

Ref<Root> Player::units [protected]

Root node of all units owned by player.

UnitsMap Player::units_map [protected]

Hash map for translation remote identifiers of units.

bool Player::active [protected]

Where player is active (= is myself).

PlayerMap* Player::map [protected]

Local map of player that contains information like warfog etc.


The documentation for this class was generated from the following files:
Generated on Sat Oct 20 14:47:33 2007 for Dark Oberon by  doxygen 1.5.3