コード例 #1
0
ファイル: server.cpp プロジェクト: a-sf-mirror/gusanos
bool Server::ZCom_cbConnectionRequest( ZCom_ConnID id, ZCom_BitStream &_request, ZCom_BitStream &reply )
{
	if(network.isBanned(id))
	{
		reply.addInt(Network::ConnectionReply::Banned, 8);
		return false;
	}
	else if(network.clientRetry)
	{
		reply.addInt(Network::ConnectionReply::Retry, 8);
		return false;
	}
	else if ( !m_preShutdown )
	{
		console.addLogMsg("* CONNECTION REQUESTED");
		//_reply.addInt(Network::ConnectionReply::Ok, 8);
		reply.addString( game.getMod().c_str() );
		reply.addString( game.level.getName().c_str() );

		return true;
	}
	else
	{
		reply.addInt(Network::ConnectionReply::Refused, 8);
		return false;
	}
}
コード例 #2
0
ファイル: client.cpp プロジェクト: a-sf-mirror/gusanos
void Client::requestPlayer(PlayerOptions const& playerOptions)
{
	ZCom_BitStream *req = new ZCom_BitStream;
	req->addInt(Network::PLAYER_REQUEST,8);
	req->addString( playerOptions.name.c_str() );
	req->addInt(playerOptions.colour, 24);
	req->addSignedInt(playerOptions.team, 8);
	req->addInt(playerOptions.uniqueID, 32);
	ZCom_sendData( network.getServerID(), req, eZCom_ReliableOrdered );
}
コード例 #3
0
bool HUServerCore::ZCom_cbConnectionRequest(ZCom_ConnID id, ZCom_BitStream& request, ZCom_BitStream& reply) {
	// Accept a connection if lobby isn't full
	reply.addInt(id, sizeof(ZCom_ConnID) * 8);
	return mLobby->onConnectAttempt(id);
}