コード例 #1
0
void StagingLogic::SendReadyRequest(bool isReady)
{
	WriteBuffer aMsg;
	aMsg.AppendByte(LobbyGameMsg_ReadyRequest);
	aMsg.AppendBool(isReady);
	SendGameMessageToCaptain(aMsg.ToByteBuffer());
}
コード例 #2
0
void LobbyGame::WriteSummary(WriteBuffer &theMsg)
{
	if(mGameType==LobbyGameType_Internet)
		theMsg.AppendBytes(mIPAddr.GetSixByte(),6);
	else
		theMsg.AppendShort(LobbyMisc::GetLanProductId());
	
	theMsg.AppendBool(mInProgress);
	if(mGameType!=LobbyGameType_Internet)
		theMsg.AppendWString(mName);

	theMsg.AppendByte(mSkillLevel);
	if(mGameType!=LobbyGameType_Internet)
	{
		unsigned char aProtectionFlags = 0;
		if(!mPassword.empty()) aProtectionFlags |= 0x01;
		if(mInviteOnly) aProtectionFlags |= 0x02;
		if(mAskToJoin) aProtectionFlags |= 0x04;
		theMsg.AppendByte(aProtectionFlags);
	}

	theMsg.AppendShort(mNumPlayers);
	theMsg.AppendShort(mMaxPlayers);

	WriteSummaryHook(theMsg);
}
コード例 #3
0
void StagingLogic::KickClient(LobbyClient *theClient, bool isBan)
{
	if(theClient==NULL || mGame.get()==NULL || !IAmCaptain())
		return;

	WriteBuffer aMsg;
	aMsg.AppendByte(LobbyGameMsg_ClientKicked);
	aMsg.AppendShort(theClient->GetClientId());
	aMsg.AppendBool(isBan);
	BroadcastGameMessage(aMsg.ToByteBuffer());

	LobbyStagingPrv::NetKickClient(theClient,isBan);
}
コード例 #4
0
ByteBufferPtr MultiPingOp::GetRequest(MultiPingStruct *theStruct)
{
	theStruct->mPingId = rand();
	theStruct->mStartPingTick = GetTickCount();

	WriteBuffer aBuf;
	aBuf.AppendByte(3);
	aBuf.AppendByte(1);
	aBuf.AppendByte(5);
	aBuf.AppendLong(theStruct->mPingId);
	aBuf.AppendBool(false);
	return aBuf.ToByteBuffer();
}
コード例 #5
0
void StagingLogic::HandleReadyRequest(ReadBuffer &theMsg, LobbyClient *theSender)
{
	if(!IAmCaptain() || !theSender->IsPlayer())
		return;

	bool isReady = theMsg.ReadBool();
	if(theSender->IsPlayerReady()==isReady) // no change needed
		return;

	WriteBuffer aMsg;
	aMsg.AppendByte(LobbyGameMsg_PlayerReady);
	aMsg.AppendShort(theSender->GetClientId());
	aMsg.AppendBool(isReady);
	BroadcastGameMessage(aMsg.ToByteBuffer());
}