Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

GameStateAspect Class Reference

#include <gamestateaspect.h>

Inheritance diagram for GameStateAspect:

Inheritance graph
[legend]
Collaboration diagram for GameStateAspect:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GameStateAspect ()
virtual ~GameStateAspect ()
virtual void Update (float deltaTime)
 called during the update of the GameControlServer to allow the ControlAspect to perform any necessary checks.
bool IsFinished () const
 Used by the SexpMonitor to check if the terminating message should be sent.
void Finish ()
 finish the simulation
TPlayMode GetPlayMode () const
 returns the current play mode
void SetPlayMode (TPlayMode mode)
 sets the current play mode
void KickOff (TTeamIndex ti=TI_NONE)
 set the current play mode randomly to PM_KickOff_Left or PM_KickOff_Right.
TTime GetTime () const
 returns the current game time
TTime GetModeTime () const
 returns the time passed since the last playmode change
TTime GetLastModeChange () const
 returns the time of the last playmode change
void SetGameHalf (TGameHalf half)
 sets the current game half
TGameHalf GetGameHalf () const
 returns the current game half
void SetTeamName (TTeamIndex idx, const std::string &name)
 sets the name of a team
std::string GetTeamName (TTeamIndex idx) const
 returns the name of a team
bool RequestUniform (boost::shared_ptr< AgentState > agentState, std::string teamName, unsigned int unum)
 called from the InitEffector to request a uniformn number and teamname
int RequestUniformNumber (TTeamIndex ti) const
 returns the next uniform number not taken for the given team
salt::Vector3f RequestInitPosition (const TTeamIndex ti)
 called from the InitEffector to request an initial position for an agent
void ScoreTeam (TTeamIndex idx)
 increments the score of a team
int GetScore (TTeamIndex idx) const
 returns the score of a team

Protected Types

typedef std::set< int > TUnumSet

Protected Member Functions

virtual void OnLink ()
 setup the init positions for the agents
void UpdateTime (float deltaTime)
 advances the game time
bool InsertUnum (TTeamIndex idx, int unum)
 checks if the set of uniform numbers of given team already contains a uniform number unum and inserts it.
TTeamIndex GetTeamIndex (const std::string &teamName)
 returns the team index corresponding to the given teamName.

Protected Attributes

TPlayMode mPlayMode
 the current play mode
TTime mLastModeChange
 the last time the play mode changed
TTime mTime
 the current game time
TTime mLeadTime
 the current time before the match started
TTime mFupTime
 the time in game state Game Over
TGameHalf mGameHalf
 the current half of the game
TTeamIndex mLastKickOff
 the team that had the last KickOff
std::string mTeamName [2]
 the names of the two teams
TUnumSet mUnumSet [2]
 the set of uniform number for each team
int mMaxUnum [2]
 the maximal uniform number handed out for each team
int mScore [2]
 the scores of two teams
salt::Vector3f mLeftInit
 the position where the last left player was put initially
salt::Vector3f mRightInit
 the position where the last right player was put initially
float mAgentRadius
 the radius of an agent
bool mFinished
 flag if the simulation should be stopped

Detailed Description

Definition at line 30 of file gamestateaspect.h.


Member Typedef Documentation

typedef std::set<int> GameStateAspect::TUnumSet [protected]
 

Definition at line 33 of file gamestateaspect.h.


Constructor & Destructor Documentation

GameStateAspect::GameStateAspect  ) 
 

Definition at line 33 of file gamestateaspect.cpp.

References GH_FIRST, mFinished, mFupTime, mGameHalf, mLastKickOff, mLastModeChange, mLeadTime, mLeftInit, mMaxUnum, mPlayMode, mRightInit, mScore, mTime, PM_BeforeKickOff, and TI_NONE.

GameStateAspect::~GameStateAspect  )  [virtual]
 

Definition at line 52 of file gamestateaspect.cpp.


Member Function Documentation

void GameStateAspect::Finish  )  [inline]
 

finish the simulation

Definition at line 50 of file gamestateaspect.h.

References mFinished.

TGameHalf GameStateAspect::GetGameHalf  )  const
 

returns the current game half

Definition at line 323 of file gamestateaspect.cpp.

References mGameHalf.

TTime GameStateAspect::GetLastModeChange  )  const
 

returns the time of the last playmode change

Definition at line 176 of file gamestateaspect.cpp.

References mLastModeChange.

TTime GameStateAspect::GetModeTime  )  const
 

returns the time passed since the last playmode change

Definition at line 162 of file gamestateaspect.cpp.

References mFupTime, mLastModeChange, mLeadTime, mPlayMode, mTime, PM_BeforeKickOff, and PM_GameOver.

TPlayMode GameStateAspect::GetPlayMode  )  const
 

returns the current play mode

Definition at line 79 of file gamestateaspect.cpp.

References mPlayMode.

int GameStateAspect::GetScore TTeamIndex  idx  )  const
 

returns the score of a team

Definition at line 344 of file gamestateaspect.cpp.

References mScore, TI_LEFT, and TI_RIGHT.

TTeamIndex GameStateAspect::GetTeamIndex const std::string &  teamName  )  [protected]
 

returns the team index corresponding to the given teamName.

If the teamname does not exist and less than two teams are registered, the given team name is registered.

Definition at line 211 of file gamestateaspect.cpp.

References mTeamName, TI_LEFT, and TI_NONE.

std::string GameStateAspect::GetTeamName TTeamIndex  idx  )  const
 

returns the name of a team

Definition at line 197 of file gamestateaspect.cpp.

References mTeamName, TI_LEFT, and TI_RIGHT.

TTime GameStateAspect::GetTime  )  const
 

returns the current game time

Definition at line 156 of file gamestateaspect.cpp.

References mTime.

bool GameStateAspect::InsertUnum TTeamIndex  idx,
int  unum
[protected]
 

checks if the set of uniform numbers of given team already contains a uniform number unum and inserts it.

Definition at line 231 of file gamestateaspect.cpp.

References mMaxUnum, mUnumSet, TI_LEFT, and TI_RIGHT.

bool GameStateAspect::IsFinished  )  const [inline]
 

Used by the SexpMonitor to check if the terminating message should be sent.

Returns:
true if the match is over

Definition at line 47 of file gamestateaspect.h.

References mFinished.

void GameStateAspect::KickOff TTeamIndex  ti = TI_NONE  ) 
 

set the current play mode randomly to PM_KickOff_Left or PM_KickOff_Right.

Parameters:
ti Team which should do the kick off (if TI_NONE, then do a coin toss)

Definition at line 103 of file gamestateaspect.cpp.

References GH_FIRST, mGameHalf, mLastKickOff, PM_KickOff_Left, PM_KickOff_Right, SetPlayMode(), TI_LEFT, TI_NONE, and TI_RIGHT.

Here is the call graph for this function:

void GameStateAspect::OnLink  )  [protected, virtual]
 

setup the init positions for the agents

Reimplemented from SoccerControlAspect.

Definition at line 377 of file gamestateaspect.cpp.

References SoccerBase::GetSoccerVar(), mAgentRadius, mLeftInit, and mRightInit.

Here is the call graph for this function:

Vector3f GameStateAspect::RequestInitPosition const TTeamIndex  ti  ) 
 

called from the InitEffector to request an initial position for an agent

Definition at line 358 of file gamestateaspect.cpp.

References zeitgeist::Object::GetLog(), mAgentRadius, mLeftInit, mRightInit, TI_LEFT, and TI_NONE.

Here is the call graph for this function:

bool GameStateAspect::RequestUniform boost::shared_ptr< AgentState agentState,
std::string  teamName,
unsigned int  unum
 

called from the InitEffector to request a uniformn number and teamname

int GameStateAspect::RequestUniformNumber TTeamIndex  ti  )  const
 

returns the next uniform number not taken for the given team

Definition at line 405 of file gamestateaspect.cpp.

References mMaxUnum, TI_LEFT, and TI_RIGHT.

void GameStateAspect::ScoreTeam TTeamIndex  idx  ) 
 

increments the score of a team

Definition at line 329 of file gamestateaspect.cpp.

References mScore, TI_LEFT, and TI_RIGHT.

void GameStateAspect::SetGameHalf TGameHalf  half  ) 
 

sets the current game half

Definition at line 309 of file gamestateaspect.cpp.

References GH_FIRST, GH_SECOND, and mGameHalf.

void GameStateAspect::SetPlayMode TPlayMode  mode  ) 
 

sets the current play mode

Definition at line 85 of file gamestateaspect.cpp.

References zeitgeist::Object::GetLog(), mFupTime, mLastModeChange, mLeadTime, mPlayMode, mTime, and SoccerBase::PlayMode2Str().

Referenced by KickOff().

Here is the call graph for this function:

void GameStateAspect::SetTeamName TTeamIndex  idx,
const std::string &  name
 

sets the name of a team

Definition at line 182 of file gamestateaspect.cpp.

References mTeamName, TI_LEFT, and TI_RIGHT.

void GameStateAspect::Update float  deltaTime  )  [virtual]
 

called during the update of the GameControlServer to allow the ControlAspect to perform any necessary checks.

Implements oxygen::ControlAspect.

Definition at line 73 of file gamestateaspect.cpp.

References UpdateTime().

Here is the call graph for this function:

void GameStateAspect::UpdateTime float  deltaTime  )  [protected]
 

advances the game time

Definition at line 57 of file gamestateaspect.cpp.

References mFupTime, mLeadTime, mPlayMode, mTime, PM_BeforeKickOff, and PM_GameOver.

Referenced by Update().


Member Data Documentation

float GameStateAspect::mAgentRadius [protected]
 

the radius of an agent

Definition at line 163 of file gamestateaspect.h.

Referenced by OnLink(), and RequestInitPosition().

bool GameStateAspect::mFinished [protected]
 

flag if the simulation should be stopped

Definition at line 165 of file gamestateaspect.h.

Referenced by Finish(), GameStateAspect(), and IsFinished().

TTime GameStateAspect::mFupTime [protected]
 

the time in game state Game Over

Definition at line 133 of file gamestateaspect.h.

Referenced by GameStateAspect(), GetModeTime(), SetPlayMode(), and UpdateTime().

TGameHalf GameStateAspect::mGameHalf [protected]
 

the current half of the game

Definition at line 136 of file gamestateaspect.h.

Referenced by GameStateAspect(), GetGameHalf(), KickOff(), and SetGameHalf().

TTeamIndex GameStateAspect::mLastKickOff [protected]
 

the team that had the last KickOff

Definition at line 139 of file gamestateaspect.h.

Referenced by GameStateAspect(), and KickOff().

TTime GameStateAspect::mLastModeChange [protected]
 

the last time the play mode changed

Definition at line 124 of file gamestateaspect.h.

Referenced by GameStateAspect(), GetLastModeChange(), GetModeTime(), and SetPlayMode().

TTime GameStateAspect::mLeadTime [protected]
 

the current time before the match started

Definition at line 130 of file gamestateaspect.h.

Referenced by GameStateAspect(), GetModeTime(), SetPlayMode(), and UpdateTime().

salt::Vector3f GameStateAspect::mLeftInit [protected]
 

the position where the last left player was put initially

Definition at line 157 of file gamestateaspect.h.

Referenced by GameStateAspect(), OnLink(), and RequestInitPosition().

int GameStateAspect::mMaxUnum[2] [protected]
 

the maximal uniform number handed out for each team

Definition at line 151 of file gamestateaspect.h.

Referenced by GameStateAspect(), InsertUnum(), and RequestUniformNumber().

TPlayMode GameStateAspect::mPlayMode [protected]
 

the current play mode

Definition at line 121 of file gamestateaspect.h.

Referenced by GameStateAspect(), GetModeTime(), GetPlayMode(), SetPlayMode(), and UpdateTime().

salt::Vector3f GameStateAspect::mRightInit [protected]
 

the position where the last right player was put initially

Definition at line 160 of file gamestateaspect.h.

Referenced by GameStateAspect(), OnLink(), and RequestInitPosition().

int GameStateAspect::mScore[2] [protected]
 

the scores of two teams

Definition at line 154 of file gamestateaspect.h.

Referenced by GameStateAspect(), GetScore(), and ScoreTeam().

std::string GameStateAspect::mTeamName[2] [protected]
 

the names of the two teams

Definition at line 145 of file gamestateaspect.h.

Referenced by GetTeamIndex(), GetTeamName(), and SetTeamName().

TTime GameStateAspect::mTime [protected]
 

the current game time

Definition at line 127 of file gamestateaspect.h.

Referenced by GameStateAspect(), GetModeTime(), GetTime(), SetPlayMode(), and UpdateTime().

TUnumSet GameStateAspect::mUnumSet[2] [protected]
 

the set of uniform number for each team

Definition at line 148 of file gamestateaspect.h.

Referenced by InsertUnum().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:38:23 2006 for rcssserver3d by  doxygen 1.4.4