LobbyPlayer* LobbyStaging::GetMyPlayer()
{
	LobbyClient *aClient = GetMyClient();
	if(aClient!=NULL)
		return aClient->GetPlayer();
	else
		return NULL;
}
void StagingLogic::HandlePingChanged(ReadBuffer &theMsg, LobbyClient *theSender)
{
	if(!theSender->IsCaptain(true))
		return;

	unsigned short aClientId = theMsg.ReadShort();
	unsigned short aPing = theMsg.ReadShort();

	LobbyClient *aClient = mGame->GetClient(aClientId);
	if(aClient==NULL)
		return;

	LobbyPlayer *aPlayer = aClient->GetPlayer();
	if(aPlayer==NULL)
		return;

	aPlayer->SetPing(aPing);
	LobbyEvent::BroadcastEvent(new PlayerChangedEvent(aClient,LobbyChangeType_Modify));
}
void StagingLogic::HandlePlayerReady(ReadBuffer &theMsg, LobbyClient *theSender)
{
	if(!theSender->IsCaptain(true))
		return;


	unsigned short aClientId = theMsg.ReadShort();
	bool isReady = theMsg.ReadBool();
	
	LobbyClient *aClient = mGame->GetClient(aClientId);
	if(aClient==NULL)
		return;

	LobbyPlayer *aPlayer = aClient->GetPlayer();
	if(aPlayer==NULL)
		return;

	aPlayer->SetReady(isReady);

	CheckPlayReadySound();
	
	LobbyEvent::BroadcastEvent(new PlayerChangedEvent(aClient,LobbyChangeType_Modify));
}