当前位置: 首页>>代码示例>>C++>>正文


C++ BitStream::Write方法代码示例

本文整理汇总了C++中BitStream::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::Write方法的具体用法?C++ BitStream::Write怎么用?C++ BitStream::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitStream的用法示例。


在下文中一共展示了BitStream::Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NotifyTeamSwitchPending

void TeamBalancer::NotifyTeamSwitchPending(RakNetGUID target, TeamId requestedTeam)
{
	BitStream bsOut;
	bsOut.Write((MessageID)ID_TEAM_BALANCER_REQUESTED_TEAM_CHANGE_PENDING);
	bsOut.Write(requestedTeam);
	rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,target,false);
}
开发者ID:Arkamarante,项目名称:collision-domain,代码行数:7,代码来源:TeamBalancer.cpp

示例2: NotifyTeamsLocked

void TeamBalancer::NotifyTeamsLocked(RakNetGUID target, TeamId requestedTeam)
{
	BitStream bsOut;
	bsOut.Write((MessageID)ID_TEAM_BALANCER_TEAMS_LOCKED);
	bsOut.Write(requestedTeam);
	rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,target,false);
}
开发者ID:Arkamarante,项目名称:collision-domain,代码行数:7,代码来源:TeamBalancer.cpp

示例3: NotifyNoTeam

void TeamBalancer::NotifyNoTeam(NetworkID memberId, RakNetGUID target)
{
	BitStream bsOut;
	bsOut.Write((MessageID)ID_TEAM_BALANCER_TEAM_ASSIGNED);
	bsOut.Write((unsigned char)UNASSIGNED_TEAM_ID);
	bsOut.Write(memberId);
	rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,target,false);
}
开发者ID:TrevorCash,项目名称:Urho3D,代码行数:8,代码来源:TeamBalancer.cpp

示例4: SendDeath

// misc functions
void  RakClient::SendDeath( uint16_t killerId, uint8_t reason )
{
    BitStream bsDeath;

    bsDeath.Write( reason );
    bsDeath.Write( killerId );
    g_RakClient->RPC( RPC_Death, &bsDeath );
}
开发者ID:ananay,项目名称:mod-s0beit-sa,代码行数:9,代码来源:RakClient.cpp

示例5: RequestForwarding

bool UDPProxyClient::RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, RakNet::TimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream)
{
	// Return false if not connected 
	ConnectionState cs = rakPeerInterface->GetConnectionState(proxyCoordinator);
	if (cs!=IS_CONNECTED)
		return false;

	// Pretty much a bug not to set the result handler, as otherwise you won't know if the operation succeeed or not
	RakAssert(resultHandler!=0);
	if (resultHandler==0)
		return false;

	BitStream outgoingBs;
	outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
	outgoingBs.Write((MessageID)ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR);
	outgoingBs.Write(sourceAddress);
	outgoingBs.Write(true);
	outgoingBs.Write(targetAddressAsSeenFromCoordinator);
	outgoingBs.Write(timeoutOnNoDataMS);
	if (serverSelectionBitstream && serverSelectionBitstream->GetNumberOfBitsUsed()>0)
	{
		outgoingBs.Write(true);
		outgoingBs.Write(serverSelectionBitstream);
	}
	else
	{
		outgoingBs.Write(false);
	}
	rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, proxyCoordinator, false);

	return true;
}
开发者ID:120pulsations,项目名称:RakNet,代码行数:32,代码来源:UDPProxyClient.cpp

示例6: NotifyTeamAssigment

void TeamBalancer::NotifyTeamAssigment(unsigned int teamMemberIndex)
{
    RakAssert(teamMemberIndex < teamMembers.Size());
    if (teamMemberIndex>=teamMembers.Size())
        return;

    BitStream bsOut;
    bsOut.Write((MessageID)ID_TEAM_BALANCER_TEAM_ASSIGNED);
    bsOut.Write(teamMembers[teamMemberIndex].currentTeam);
    rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,teamMembers[teamMemberIndex].memberGuid,false);
}
开发者ID:Azon099,项目名称:Five-Multiplayer,代码行数:11,代码来源:TeamBalancer.cpp

示例7: SendGroupMessage

void RelayPlugin::SendGroupMessage(const RakNetGUID &relayPluginServerGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel)
{
	BitStream bsOut;
	bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
	bsOut.WriteCasted<MessageID>(RPE_GROUP_MESSAGE_FROM_CLIENT);
	bsOut.WriteCasted<unsigned char>(priority);
	bsOut.WriteCasted<unsigned char>(reliability);
	bsOut.Write(orderingChannel);
	bsOut.Write(bitStream);
	SendUnified(&bsOut, priority, reliability, orderingChannel, relayPluginServerGuid, false);
}
开发者ID:Aasagi,项目名称:DICEProgrammingChallenge,代码行数:11,代码来源:RelayPlugin.cpp

示例8: SendSCMEvent

void  RakClient::SendSCMEvent( int vehicleID, int eventId, int param1, int param2 )
{
    BitStream bsScmEvent;

    bsScmEvent.Write ( vehicleID );
    bsScmEvent.Write ( param1 );
    bsScmEvent.Write ( param2 );
    bsScmEvent.Write ( eventId );

    RPC( RPC_ScmEvent, &bsScmEvent );
}
开发者ID:ananay,项目名称:mod-s0beit-sa,代码行数:11,代码来源:RakClient.cpp

示例9: DelistServer

void MasterClient::DelistServer(void)
{
	BitStream bitStream;
	listServer=false;
	if (serverListed)
	{
		bitStream.Write((unsigned char)ID_MASTER_SERVER_DELIST_SERVER);
		bitStream.Write(localServer.connectionIdentifier.port);
        rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, UNASSIGNED_PLAYER_ID, true);
		serverListed=false;
	}
}
开发者ID:Caboose1543,项目名称:LUNIServerProject,代码行数:12,代码来源:MasterClient.cpp

示例10: SendToParticipant

// Send a message to a server running RelayPlugin, to forward a message to the system identified by \a key
void RelayPlugin::SendToParticipant(const RakNetGUID &relayPluginServerGuid, const RakString &key, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel)
{
	BitStream bsOut;
	bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
	bsOut.WriteCasted<MessageID>(RPE_MESSAGE_TO_SERVER_FROM_CLIENT);
	bsOut.WriteCasted<unsigned char>(priority);
	bsOut.WriteCasted<unsigned char>(reliability);
	bsOut.Write(orderingChannel);
	bsOut.WriteCompressed(key);
	bsOut.Write(bitStream);
	SendUnified(&bsOut, priority, reliability, orderingChannel, relayPluginServerGuid, false);
}
开发者ID:Aasagi,项目名称:DICEProgrammingChallenge,代码行数:13,代码来源:RelayPlugin.cpp

示例11: CancelRequestSpecificTeam

void TeamBalancer::CancelRequestSpecificTeam(void)
{
    // Clear out that we have requested a team.
    requestedTeam=UNASSIGNED_TEAM_ID;

    // Send packet to the host to remove our request flag.
    BitStream bsOut;
    bsOut.Write((MessageID)ID_TEAM_BALANCER_INTERNAL);
    bsOut.Write((MessageID)ID_CANCEL_TEAM_REQUEST);
    rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,hostGuid,false);

    expectingToReceiveTeamNumber=false;
}
开发者ID:Azon099,项目名称:Five-Multiplayer,代码行数:13,代码来源:TeamBalancer.cpp

示例12: Show

void CText::Show(bool show)
{
	m_bShow = show;

	CPlayerManager * pPlayerManager = pNetowkManager->GetPlayerManager();
	for(EntityId i = 0; i < MAX_PLAYERS; i++) {
		if(pPlayerManager->GetSlotState(i)) {
			BitStream bsSend;
			bsSend.Write(m_iID);
			bsSend.Write(m_bShow);
			pNetowkManager->GetRPC4()->Call("Script_toggleTextForPlayer", &bsSend, HIGH_PRIORITY, RELIABLE, 0, pNetowkManager->GetRakPeer()->GetSystemAddressFromIndex(i), 0);
		}
	}
}
开发者ID:Tonyx97,项目名称:vice-players,代码行数:14,代码来源:CText.cpp

示例13: RequestAnyTeam

void TeamBalancer::RequestAnyTeam(void)
{
    // If we currently have a team, just return (does nothing)
    if (GetMyTeam()!=UNASSIGNED_TEAM_ID)
        return;

    // Else send to the current host that we need a team.
    BitStream bsOut;
    bsOut.Write((MessageID)ID_TEAM_BALANCER_INTERNAL);
    bsOut.Write((MessageID)ID_REQUEST_ANY_TEAM);
    rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,hostGuid,false);

    expectingToReceiveTeamNumber=true;
}
开发者ID:Azon099,项目名称:Five-Multiplayer,代码行数:14,代码来源:TeamBalancer.cpp

示例14: RequestSpecificTeam

bool TeamBalancer::RequestSpecificTeam(TeamId desiredTeam)
{
    // Send desiredTeam to the current host.
    // Also flag that we have requested a team, and record desiredTeam in case the host changes and it needs to be resent.
    BitStream bsOut;
    bsOut.Write((MessageID)ID_TEAM_BALANCER_INTERNAL);
    bsOut.Write((MessageID)ID_REQUEST_SPECIFIC_TEAM);
    bsOut.Write(desiredTeam);
    rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,hostGuid,false);

    if (desiredTeam!=UNASSIGNED_TEAM_ID)
        expectingToReceiveTeamNumber=true;

    return true;
}
开发者ID:Azon099,项目名称:Five-Multiplayer,代码行数:15,代码来源:TeamBalancer.cpp

示例15: SetText

void CText::SetText(const char * szText)
{
	m_szText = szText;

	CPlayerManager * pPlayerManager = pNetowkManager->GetPlayerManager();
	for(EntityId i = 0; i < MAX_PLAYERS; i++) {
		if(pPlayerManager->GetSlotState(i)) {
			BitStream bsSend;
			bsSend.Write(m_iID);
			bsSend.Write(strlen(szText));
			bsSend.Write(szText, strlen(szText));
			pNetowkManager->GetRPC4()->Call("Script_SetText", &bsSend, HIGH_PRIORITY, RELIABLE, 0, pNetowkManager->GetRakPeer()->GetSystemAddressFromIndex(i), 0);
		}
	}
}
开发者ID:Tonyx97,项目名称:vice-players,代码行数:15,代码来源:CText.cpp


注:本文中的BitStream::Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。