HoverRace  2.0
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
HoverRace::Client::ClientSession Class Reference

#include <ClientSession.h>

Classes

struct  ChatMessage
 

Public Types

enum  Phase {
  Phase::INIT, Phase::PREGAME, Phase::PLAYING, Phase::POSTGAME,
  Phase::DONE
}
 

Public Member Functions

 ClientSession (std::shared_ptr< Rules > rules)
 
virtual ~ClientSession ()
 
void AddMessage (const char *pMessage)
 
virtual void AddMessageKey (char pKey)
 
bool AdvancePhase ()
 Advance to the next phase. More...
 
bool AdvancePhase (Phase nextPhase)
 Advance the current phase. More...
 
void AttachPlayer (int i, std::shared_ptr< Player::Player > player)
 Attach a player to the session. More...
 
void CountdownToNextPhase (const Util::Duration &duration)
 Set a countdown timer to the next phase. More...
 
const MR_UInt8GetBackImage () const
 
std::shared_ptr< Util::ClockGetClock ()
 
std::shared_ptr< Util::ClockGetCountdown ()
 
const Model::LevelGetCurrentLevel () const
 
virtual void GetCurrentMessage (char *pDest) const
 
virtual void GetHitResult (int pPosition, const char *&pPlayerName, int &pId, BOOL &pConnected, int &pNbHitOther, int &pNbHitHimself) const
 
BOOL GetMessageStack (int pLevel, char *pDest, int pExpiration) const
 
std::shared_ptr< HoverScript::MetaSessionGetMeta () const
 
virtual int GetNbPlayers () const
 
Phase GetPhase () const
 
virtual Player::PlayerGetPlayer (int i) const
 
virtual int GetRank (const MainCharacter::MainCharacter *pPlayer) const
 
virtual void GetResult (int pPosition, const char *&pPlayerName, int &pId, BOOL &pConnected, int &pNbLap, MR_SimulationTime &pFinishTime, MR_SimulationTime &pBestLap) const
 
std::shared_ptr< RulesGetRules ()
 
MR_SimulationTime GetSimulationTime () const
 
std::shared_ptr< HoverScript::TrackPeerGetTrackPeer () const
 
virtual bool LoadNew (const char *pTitle, Script::Core &scripting, std::shared_ptr< Model::Track > track, VideoServices::VideoBuffer *pVideo)
 
virtual void Process ()
 
virtual int ResultAvaillable () const
 
void SetMeta (std::shared_ptr< HoverScript::MetaSession > meta)
 
virtual void SetSimulationTime (MR_SimulationTime pTime)
 
virtual std::shared_ptr< Player::PlayerSharePlayer (int i) const
 
void UpdateCharacterSimulationTimes ()
 

Private Member Functions

 ClientSession ()=delete
 
void ReadLevelAttrib (Parcel::RecordFile *pFile, VideoServices::VideoBuffer *pVideo)
 

Private Attributes

boost::mutex chatMutex
 
std::shared_ptr< Util::Clockclock
 
std::shared_ptr< Util::Clockcountdown
 
boost::signals2::scoped_connection countdownConn
 
MR_UInt8mBackImage
 
std::shared_ptr< HoverScript::MetaSessionmeta
 
ChatMessage mMessageStack [CHAT_MESSAGE_STACK]
 
Model::GameSession mSession
 
Phase phase
 
std::array< std::shared_ptr< Player::Player >, MAX_PLAYERSplayers
 
std::shared_ptr< Rulesrules
 
std::shared_ptr< HoverScript::TrackPeertrackPeer
 

Static Private Attributes

static const int CHAT_MESSAGE_STACK = 8
 
static const int MAX_PLAYERS = 4
 

Member Enumeration Documentation

Enumerator
INIT 
PREGAME 

Players are at the starting line.

PLAYING 

Players are released and the clock is running.

POSTGAME 

The first player has finished; waiting for others.

DONE 

All players have finished.

Constructor & Destructor Documentation

HoverRace::Client::ClientSession::ClientSession ( )
privatedelete
HoverRace::Client::ClientSession::ClientSession ( std::shared_ptr< Rules rules)
HoverRace::Client::ClientSession::~ClientSession ( )
virtual

Member Function Documentation

void HoverRace::Client::ClientSession::AddMessage ( const char *  pMessage)
void HoverRace::Client::ClientSession::AddMessageKey ( char  pKey)
virtual
bool HoverRace::Client::ClientSession::AdvancePhase ( )

Advance to the next phase.

Returns
true if the new phase was set successfully, false otherwise.
bool HoverRace::Client::ClientSession::AdvancePhase ( Phase  nextPhase)

Advance the current phase.

The new phase must be equal to or later than the current phase. If any phases are skipped, then then the events for the skipped phases will still be called.

Parameters
nextPhaseThe requested next phase.
Returns
true if the new phase was set successfully, false otherwise.
void HoverRace::Client::ClientSession::AttachPlayer ( int  i,
std::shared_ptr< Player::Player player 
)

Attach a player to the session.

Parameters
iZero-based index of the player slot.
playerThe player (may not be nullptr).
void HoverRace::Client::ClientSession::CountdownToNextPhase ( const Util::Duration duration)

Set a countdown timer to the next phase.

Parameters
durationThe duration (must be positive).
const MR_UInt8 * HoverRace::Client::ClientSession::GetBackImage ( ) const
std::shared_ptr<Util::Clock> HoverRace::Client::ClientSession::GetClock ( )
inline
std::shared_ptr<Util::Clock> HoverRace::Client::ClientSession::GetCountdown ( )
inline
const Model::Level * HoverRace::Client::ClientSession::GetCurrentLevel ( ) const
void HoverRace::Client::ClientSession::GetCurrentMessage ( char *  pDest) const
virtual
void HoverRace::Client::ClientSession::GetHitResult ( int  pPosition,
const char *&  pPlayerName,
int &  pId,
BOOL &  pConnected,
int &  pNbHitOther,
int &  pNbHitHimself 
) const
virtual
BOOL HoverRace::Client::ClientSession::GetMessageStack ( int  pLevel,
char *  pDest,
int  pExpiration 
) const
std::shared_ptr<HoverScript::MetaSession> HoverRace::Client::ClientSession::GetMeta ( ) const
inline
int HoverRace::Client::ClientSession::GetNbPlayers ( ) const
virtual
Phase HoverRace::Client::ClientSession::GetPhase ( ) const
inline
virtual Player::Player* HoverRace::Client::ClientSession::GetPlayer ( int  i) const
inlinevirtual
int HoverRace::Client::ClientSession::GetRank ( const MainCharacter::MainCharacter pPlayer) const
virtual
void HoverRace::Client::ClientSession::GetResult ( int  pPosition,
const char *&  pPlayerName,
int &  pId,
BOOL &  pConnected,
int &  pNbLap,
MR_SimulationTime pFinishTime,
MR_SimulationTime pBestLap 
) const
virtual
std::shared_ptr<Rules> HoverRace::Client::ClientSession::GetRules ( )
inline
MR_SimulationTime HoverRace::Client::ClientSession::GetSimulationTime ( ) const
std::shared_ptr<HoverScript::TrackPeer> HoverRace::Client::ClientSession::GetTrackPeer ( ) const
inline
bool HoverRace::Client::ClientSession::LoadNew ( const char *  pTitle,
Script::Core scripting,
std::shared_ptr< Model::Track track,
VideoServices::VideoBuffer pVideo 
)
virtual
void HoverRace::Client::ClientSession::Process ( )
virtual
void HoverRace::Client::ClientSession::ReadLevelAttrib ( Parcel::RecordFile pFile,
VideoServices::VideoBuffer pVideo 
)
private
int HoverRace::Client::ClientSession::ResultAvaillable ( ) const
virtual
void HoverRace::Client::ClientSession::SetMeta ( std::shared_ptr< HoverScript::MetaSession meta)
void HoverRace::Client::ClientSession::SetSimulationTime ( MR_SimulationTime  pTime)
virtual
virtual std::shared_ptr<Player::Player> HoverRace::Client::ClientSession::SharePlayer ( int  i) const
inlinevirtual
void HoverRace::Client::ClientSession::UpdateCharacterSimulationTimes ( )

Member Data Documentation

const int HoverRace::Client::ClientSession::CHAT_MESSAGE_STACK = 8
staticprivate
boost::mutex HoverRace::Client::ClientSession::chatMutex
mutableprivate
std::shared_ptr<Util::Clock> HoverRace::Client::ClientSession::clock
private
std::shared_ptr<Util::Clock> HoverRace::Client::ClientSession::countdown
private
boost::signals2::scoped_connection HoverRace::Client::ClientSession::countdownConn
private
const int HoverRace::Client::ClientSession::MAX_PLAYERS = 4
staticprivate
MR_UInt8* HoverRace::Client::ClientSession::mBackImage
private
std::shared_ptr<HoverScript::MetaSession> HoverRace::Client::ClientSession::meta
private
ChatMessage HoverRace::Client::ClientSession::mMessageStack[CHAT_MESSAGE_STACK]
private
Model::GameSession HoverRace::Client::ClientSession::mSession
private
Phase HoverRace::Client::ClientSession::phase
private
std::array<std::shared_ptr<Player::Player>, MAX_PLAYERS> HoverRace::Client::ClientSession::players
private
std::shared_ptr<Rules> HoverRace::Client::ClientSession::rules
private
std::shared_ptr<HoverScript::TrackPeer> HoverRace::Client::ClientSession::trackPeer
private

The documentation for this class was generated from the following files: