本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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 );
}
示例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;
}
示例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);
}
示例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);
}
示例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 );
}
示例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;
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
}