• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MSG_WriteLong函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MSG_WriteLong函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_WriteLong函数的具体用法?C++ MSG_WriteLong怎么用?C++ MSG_WriteLong使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Netchan_TransmitNextFragment

/*
=================
Netchan_TransmitNextFragment

Send one fragment of the current message
=================
*/
void Netchan_TransmitNextFragment( netchan_t *chan ) {
    msg_t		send;
    byte		send_buf[MAX_PACKETLEN];
    int			fragmentLength;

    // write the packet header
    MSG_InitOOB (&send, send_buf, sizeof(send_buf));				// <-- only do the oob here

    MSG_WriteLong( &send, chan->outgoingSequence | FRAGMENT_BIT );

    // send the qport if we are a client
    if ( chan->sock == NS_CLIENT ) {
        MSG_WriteShort( &send, qport->integer );
    }

    // copy the reliable message to the packet first
    fragmentLength = FRAGMENT_SIZE;
    if ( chan->unsentFragmentStart  + fragmentLength > chan->unsentLength ) {
        fragmentLength = chan->unsentLength - chan->unsentFragmentStart;
    }

    MSG_WriteShort( &send, chan->unsentFragmentStart );
    MSG_WriteShort( &send, fragmentLength );
    MSG_WriteData( &send, chan->unsentBuffer + chan->unsentFragmentStart, fragmentLength );

    // send the datagram
    NET_SendPacket( chan->sock, send.cursize, send.data, chan->remoteAddress );

    if ( showpackets->integer ) {
        Com_Printf ("%s send %4i : s=%i fragment=%i,%i\n"
                    , netsrcString[ chan->sock ]
                    , send.cursize
                    , chan->outgoingSequence
                    , chan->unsentFragmentStart, fragmentLength);
    }

    chan->unsentFragmentStart += fragmentLength;

    // this exit condition is a little tricky, because a packet
    // that is exactly the fragment length still needs to send
    // a second packet of zero length so that the other side
    // can tell there aren't more to follow
    if ( chan->unsentFragmentStart == chan->unsentLength && fragmentLength != FRAGMENT_SIZE ) {
        chan->outgoingSequence++;
        chan->unsentFragments = qfalse;
    }
}
开发者ID:Wbuanguna,项目名称:tremfusion,代码行数:54,代码来源:net_chan.c


示例2: SV_SendClientSnapshot

/*
=======================
SV_SendClientSnapshot

Also called by SV_FinalMessage

=======================
*/
void SV_SendClientSnapshot( client_t* client )
{
	byte        msg_buf[MAX_MSGLEN];
	msg_s       msg;
	
	// build the snapshot
	SV_BuildClientSnapshot( client );
	
	// bots need to have their snapshots build, but
	// the query them directly without needing to be sent
	//if ( client->gentity && client->gentity->r.svFlags & SVF_BOT ) {
	//  return;
	//}
	
	MSG_Init( &msg, msg_buf, sizeof( msg_buf ) );
	msg.allowoverflow = true;
	
	// compression byte is the first byte in all server->client messages
	msg.oob = true;
	MSG_WriteByte( &msg, 0 );
	msg.oob = false;
	
	// NOTE, MRE: all server->client messages now acknowledge
	// let the client know which reliable clientCommands we have received
	MSG_WriteLong( &msg, client->lastClientCommand );
	
	// (re)send any reliable server commands
	SV_UpdateServerCommandsToClient( client, &msg );
	
	// send over all the relevant entityState_s
	// and the playerState_s
	SV_WriteSnapshotToClient( client, &msg );
	
#ifdef USE_VOIP
	SV_WriteVoipToClient( client, &msg );
#endif
	
	// check for overflow
	if ( msg.overflowed )
	{
		Com_Printf( "WARNING: msg overflowed for %s\n", client->name );
		MSG_Clear( &msg );
	}
	
	SV_SendMessageToClient( &msg, client );
}
开发者ID:OnlyTheGhosts,项目名称:OWEngine,代码行数:54,代码来源:sv_snapshot.cpp


示例3: SV_SendServerinfo

/*
================
SV_SendServerinfo

Sends the first message from the server to a connected client.
This will be sent on the initial connection and upon each server load.
================
*/
void SV_SendServerinfo (client_t *client)
{
	char			**s;
	char			message[2048];

	MSG_WriteByte (&client->message, svc_print);
	sprintf (message, "%c\nVERSION %4.2f SERVER (%i CRC)", 2, VERSION, pr_crc);
	MSG_WriteString (&client->message,message);

	MSG_WriteByte (&client->message, svc_serverinfo);
	MSG_WriteLong (&client->message, PROTOCOL_VERSION);
	MSG_WriteByte (&client->message, svs.maxclients);

	if (!coop.value && deathmatch.value)
		MSG_WriteByte (&client->message, GAME_DEATHMATCH);
	else
		MSG_WriteByte (&client->message, GAME_COOP);

	sprintf (message, pr_strings+sv.edicts->u.v.message);

	MSG_WriteString (&client->message,message);

	for (s = sv.model_precache+1 ; *s ; s++)
		MSG_WriteString (&client->message, *s);
	MSG_WriteByte (&client->message, 0);

	for (s = sv.sound_precache+1 ; *s ; s++)
		MSG_WriteString (&client->message, *s);
	MSG_WriteByte (&client->message, 0);

// send music
	MSG_WriteByte (&client->message, svc_cdtrack);
	MSG_WriteByte (&client->message, (int) sv.edicts->u.v.sounds);
	MSG_WriteByte (&client->message, (int) sv.edicts->u.v.sounds);

// set view	
	MSG_WriteByte (&client->message, svc_setview);
	MSG_WriteShort (&client->message, NUM_FOR_EDICT(client->edict));

	MSG_WriteByte (&client->message, svc_signonnum);
	MSG_WriteByte (&client->message, 1);

	client->sendsignon = true;
	client->spawned = false;		// need prespawn, spawn, etc
}
开发者ID:Axovera,项目名称:glesquake,代码行数:53,代码来源:sv_main.cpp


示例4: Netchan_Transmit

/*
===============
Netchan_Transmit

Sends a message to a connection, fragmenting if necessary
A 0 length will still generate a packet.
================
*/
void Netchan_Transmit( netchan_t *chan, size_t length, const byte *data ) {
	msg_t		send;
	byte		send_buf[MAX_PACKETLEN];

	if ( length > MAX_MSGLEN ) {
		Com_Error( ERR_DROP, "Netchan_Transmit: length = %i", length );
	}
	chan->unsentFragmentStart = 0;

	// fragment large reliable messages
	if ( length >= FRAGMENT_SIZE ) {
		chan->unsentFragments = qtrue;
		chan->unsentLength = length;
		Com_Memcpy( chan->unsentBuffer, data, length );

		// only send the first fragment now
		Netchan_TransmitNextFragment( chan );

		return;
	}

	// write the packet header
	MSG_InitOOB (&send, send_buf, sizeof(send_buf));

	MSG_WriteLong( &send, chan->outgoingSequence );
	chan->outgoingSequence++;

	// send the qport if we are a client
	if ( chan->sock == NS_CLIENT ) {
		MSG_WriteShort( &send, qport->integer );
	}

	MSG_WriteData( &send, data, length );

	// send the datagram
	NET_SendPacket( chan->sock, send.cursize, send.data, chan->remoteAddress );

	if ( showpackets->integer ) {
		Com_Printf( "%s send %4i : s=%i ack=%i\n"
			, netsrcString[ chan->sock ]
			, send.cursize
			, chan->outgoingSequence - 1
			, chan->incomingSequence );
	}
}
开发者ID:kingtiger01,项目名称:openmohaa-1,代码行数:53,代码来源:net_chan.c


示例5: SV_UpdateServerCommandsToClient

/*
==================
SV_UpdateServerCommandsToClient

(re)send all server commands the client hasn't acknowledged yet
==================
*/
void SV_UpdateServerCommandsToClient( client_t *client, msg_t *msg ) {
	int		i;
	int		reliableAcknowledge;

	if ( client->demo.isBot && client->demo.demorecording ) {
		reliableAcknowledge = client->demo.botReliableAcknowledge;
	} else {
		reliableAcknowledge = client->reliableAcknowledge;
	}

	// write any unacknowledged serverCommands
	for ( i = reliableAcknowledge + 1 ; i <= client->reliableSequence ; i++ ) {
		MSG_WriteByte( msg, svc_serverCommand );
		MSG_WriteLong( msg, i );
		MSG_WriteString( msg, client->reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
	}
	client->reliableSent = client->reliableSequence;
}
开发者ID:LeadGuitar,项目名称:OpenJK,代码行数:25,代码来源:sv_snapshot.cpp


示例6: Transmite_TerraGCPacket_Remain_Minute_NoticeMessage

void CTerraBillingCtrl_Decoder::
Transmite_TerraGCPacket_Remain_Minute_NoticeMessage(
	playerCharacter_t* pToPlayerRecord,
	const int RemainMinute) const
{
	MSG_BeginWriting(&netMessage);
	
	MSG_Clear(&netMessage);
	{
		MSG_WriteByte(&netMessage, GSC_EXTEND);
		MSG_WriteByte(&netMessage, GSC_EXTEND_TERRA);
		MSG_WriteByte(&netMessage, tagTerraGCPacket::Remain_Minute_NoticeMessage);
		MSG_WriteLong(&netMessage, RemainMinute);		

		NET_SendMessage(&pToPlayerRecord->sock, &netMessage);
	}
	MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:18,代码来源:CTerraBillingCtrl_Decoder.cpp


示例7: MSG_BeginWriting

void CHelperManager_Encoder::SendMessage_Mypoint_toTaker(
	playerCharacter_t* pPlayer, char* pTakerName,char* pHelperName, int MyPoint)
{
	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, EXTEND_SECOND);
		MSG_WriteShort( &netMessage, HELPER_SYSTEM );
		MSG_WriteShort(&netMessage, SC_SENDMYPOINT_toAllPlayer);
		MSG_WriteString(&netMessage,pTakerName);
		MSG_WriteString(&netMessage,pHelperName);
		MSG_WriteLong(&netMessage,MyPoint);
		NET_SendMessage(&pPlayer->sock, &netMessage);
	}
	
	MSG_EndWriting(&netMessage);
	
}
开发者ID:gthgame,项目名称:gth,代码行数:18,代码来源:CHelperManager_Encoder.cpp


示例8: strncpy

void CPostFunc::GTH_SendMessage_PostSystem_Send()
{

	
	char    name[NAMESTRING+1];
	char	title[CPostManager::POST_TITLESIZE+1];
	char	message[CPostManager::POST_STRSIZE+1];



	strncpy(name,g_ifMng->m_mailBoxWin->m_name,NAMESTRING);
	name[NAMESTRING]=NULL;
	CTools::Replace_singleQUOTATIONmark_by_doubleQUOTATIONmark(name);


	strncpy(title,g_ifMng->m_mailBoxWin->m_title,CPostManager::POST_TITLESIZE);
	title[CPostManager::POST_TITLESIZE]=NULL;
	CTools::Replace_singleQUOTATIONmark_by_doubleQUOTATIONmark(title);

	strncpy(message,g_ifMng->m_mailBoxWin->m_message,CPostManager::POST_STRSIZE);
	message[CPostManager::POST_STRSIZE]=NULL;
	CTools::Replace_singleQUOTATIONmark_by_doubleQUOTATIONmark(message);







	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, CC_EXTEND);
		MSG_WriteByte(&netMessage, CC_POSTSYSTEM);
		MSG_WriteByte(&netMessage, POSTSYSTEM_SEND);
		
		MSG_WriteString(&netMessage, name);
		MSG_WriteString(&netMessage, title);
		MSG_WriteString(&netMessage, message);
		MSG_WriteLong(&netMessage, g_ifMng->m_mailBoxWin->m_nak);
		NET_SendMessage(&gsSocket, &netMessage); 
	}
	MSG_EndWriting( &netMessage );	
}
开发者ID:gthgame,项目名称:gth,代码行数:44,代码来源:PostFunc.cpp


示例9: Netchan_OutOfBand

/*
	Netchan_OutOfBand

	Sends an out-of-band datagram
*/
void
Netchan_OutOfBand (netadr_t adr, int length, byte * data)
{
	byte        send_buf[MAX_MSGLEN + PACKET_HEADER];
	sizebuf_t   send;

	// write the packet header
	send.data = send_buf;
	send.maxsize = sizeof (send_buf);
	send.cursize = 0;

	MSG_WriteLong (&send, -1);			// -1 sequence means out of band
	SZ_Write (&send, data, length);

	// send the datagram
	// zoid, no input in demo playback mode
	if (!net_blocksend)
		Netchan_SendPacket (send.cursize, send.data, adr);
}
开发者ID:EIREXE,项目名称:Quakeforge-gcw0,代码行数:24,代码来源:net_chan.c


示例10: MSG_BeginWriting

inline void CGMCtrl::TransmitePacket_NProtect_msgs_notify_change(const BOOL in_bEnable) const
{
	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, EXTEND_SECOND);		
		MSG_WriteShort(&netMessage, GMsystem);
		MSG_WriteShort(&netMessage, tagExtendSecondPacket_GMsystem::GMsystem_NProtect);
		MSG_WriteShort(&netMessage, tagExtendSecondPacket_GMsystem::tagNProtect::msgs_notify_change);
		MSG_WriteLong(&netMessage,in_bEnable);

		for(int i=1; i < MAX_MEMBER_SERVER; i++){ 
			if ( !g_memberServer[i].active )	continue;
			NET_SendUnreliableMessage(&g_memberServer[i].sock, &netMessage);
		}
	}
	MSG_EndWriting(&netMessage);

}
开发者ID:gthgame,项目名称:gth,代码行数:19,代码来源:CGMCtrl.cpp


示例11: MSG_BeginWriting

void CGs_To_Cc::Send(playerCharacter_t* pPlayer,int SystemType,int mainType, int subType,int val, char *TargetPlayerName)
{
	MSG_BeginWriting( &netMessage );
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, EXTEND_SECOND);
		
		MSG_WriteShort(&netMessage, SystemType);
		MSG_WriteShort(&netMessage, mainType);		
		MSG_WriteShort(&netMessage, subType);	

		MSG_WriteLong(&netMessage, val);	

		MSG_WriteString(&netMessage, TargetPlayerName);	

		NET_SendMessage(&pPlayer->sock, &netMessage);
	}
	MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:19,代码来源:Gs_To_Cc.cpp


示例12: Netchan_OutOfBand

void Netchan_OutOfBand(netsrc_t sock, netadr_t adr, int length, byte *data)
{
	sizebuf_t send;
	byte send_buf[NET_MAX_PAYLOAD];

	send.buffername = "Netchan_OutOfBand";
	send.data = send_buf;
	send.maxsize = sizeof(send_buf);
	send.cursize = 0;
	send.flags = SIZEBUF_ALLOW_OVERFLOW;

	MSG_WriteLong(&send, -1);
	SZ_Write(&send, data, length);

	if (!g_pcls.demoplayback)
	{
		NET_SendPacket(sock, send.cursize, send.data, adr);
	}
}
开发者ID:Chuvi-w,项目名称:rehlds,代码行数:19,代码来源:net_chan.cpp


示例13: SV_SendClientGameState

/*
================
SV_SendClientGameState

Sends the first message from the server to a connected client.
This will be sent on the initial connection and upon each new map load.

It will be resent if the client acknowledges a later message but has
the wrong gamestate.
================
*/
void SV_SendClientGameState( client_t *client ) {
	int			start;
	msg_t		msg;
	byte		msgBuffer[MAX_MSGLEN];

	Com_DPrintf ("SV_SendGameState() for %s\n", client->name);
	client->state = CS_PRIMED;

	// when we receive the first packet from the client, we will
	// notice that it is from a different serverid and that the
	// gamestate message was not just sent, forcing a retransmit
	client->gamestateMessageNum = client->netchan.outgoingSequence;

	// clear the reliable message list for this client
	client->reliableSequence = 0;
	client->reliableAcknowledge = 0;

	MSG_Init( &msg, msgBuffer, sizeof( msgBuffer ) );

	// send the gamestate
	MSG_WriteByte( &msg, svc_gamestate );
	MSG_WriteLong( &msg, client->reliableSequence );

	// write the configstrings
	for ( start = 0 ; start < MAX_CONFIGSTRINGS ; start++ ) {
		if (sv.configstrings[start][0]) {
			MSG_WriteByte( &msg, svc_configstring );
			MSG_WriteShort( &msg, start );
			MSG_WriteString( &msg, sv.configstrings[start] );
		}
	}

	MSG_WriteByte( &msg, 0 );

	// check for overflow
	if ( msg.overflowed ) {
		Com_Printf ("WARNING: GameState overflowed for %s\n", client->name);
	}

	// deliver this to the client
	SV_SendMessageToClient( &msg, client );
}
开发者ID:AlexCSilva,项目名称:jediacademy,代码行数:53,代码来源:sv_client.cpp


示例14: TV_Downstream_AddReliableCommandsToMessage

/*
* TV_Downstream_AddReliableCommandsToMessage
* 
* (re)send all server commands the client hasn't acknowledged yet
*/
void TV_Downstream_AddReliableCommandsToMessage( client_t *client, msg_t *msg )
{
	unsigned int i;

	// write any unacknowledged serverCommands
	for( i = client->reliableAcknowledge + 1; i <= client->reliableSequence; i++ )
	{
		if( !strlen( client->reliableCommands[i & ( MAX_RELIABLE_COMMANDS-1 )] ) )
			continue;

		MSG_WriteByte( msg, svc_servercmd );
		if( !client->reliable )
			MSG_WriteLong( msg, i );
		MSG_WriteString( msg, client->reliableCommands[i & ( MAX_RELIABLE_COMMANDS-1 )] );
	}

	client->reliableSent = client->reliableSequence;
	if( client->reliable )
		client->reliableAcknowledge = client->reliableSent;
}
开发者ID:Kaperstone,项目名称:warsow,代码行数:25,代码来源:tv_downstream.c


示例15: SV_Customization

// Sends resource to all other players, optionally skipping originating player.
void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPlayer)
{
	int i;
	int nPlayerNumber;
	client_t *pHost;

	// Get originating player id
	for (i = 0, pHost = g_psvs.clients; i < g_psvs.maxclients; i++, pHost++)
	{
		if (pHost == pPlayer)
			break;
	}
	if (i == g_psvs.maxclients)
	{
		Sys_Error("Couldn't find player index for customization.");
	}

	nPlayerNumber = i;

	// Send resource to all other active players
	for (i = 0, pHost = g_psvs.clients; i < g_psvs.maxclients; i++, pHost++)
	{
		if (!pHost->active && !pHost->spawned || pHost->fakeclient)
			continue;

		if (pHost == pPlayer && bSkipPlayer)
			continue;

		MSG_WriteByte(&pHost->netchan.message, svc_customization);
		MSG_WriteByte(&pHost->netchan.message, nPlayerNumber);
		MSG_WriteByte(&pHost->netchan.message, pResource->type);
		MSG_WriteString(&pHost->netchan.message, pResource->szFileName);
		MSG_WriteShort(&pHost->netchan.message, pResource->nIndex);
		MSG_WriteLong(&pHost->netchan.message, pResource->nDownloadSize);
		MSG_WriteByte(&pHost->netchan.message, pResource->ucFlags);
		if (pResource->ucFlags & RES_CUSTOM)
		{
			SZ_Write(&pHost->netchan.message, pResource->rgucMD5_hash, 16);
		}
	}
}
开发者ID:Adidasman1,项目名称:rehlds,代码行数:42,代码来源:sv_upld.cpp


示例16: SV_WriteVoipToClient

/*
==================
SV_WriteVoipToClient

Check to see if there is any VoIP queued for a client, and send if there is.
==================
*/
void SV_WriteVoipToClient( client_t *cl, msg_t *msg )
{
	voipServerPacket_t *packet = &cl->voipPacket[0];
	int totalbytes = 0;
	int i;

	if (*cl->downloadName) {
		cl->queuedVoipPackets = 0;
		return;  // no VoIP allowed if download is going, to save bandwidth.
	}

	// Write as many VoIP packets as we reasonably can...
	for (i = 0; i < cl->queuedVoipPackets; i++, packet++) {
		totalbytes += packet->len;
		if (totalbytes > MAX_DOWNLOAD_BLKSIZE)
			break;

		// You have to start with a svc_EOF, so legacy clients drop the
		//  rest of this packet. Otherwise, those without VoIP support will
		//  see the svc_voip command, then panic and disconnect.
		// Generally we don't send VoIP packets to legacy clients, but this
		//  serves as both a safety measure and a means to keep demo files
		//  compatible.
		MSG_WriteByte( msg, svc_EOF );
		MSG_WriteByte( msg, svc_extension );
		MSG_WriteByte( msg, svc_voip );
		MSG_WriteShort( msg, packet->sender );
		MSG_WriteByte( msg, (byte) packet->generation );
		MSG_WriteLong( msg, packet->sequence );
		MSG_WriteByte( msg, packet->frames );
		MSG_WriteShort( msg, packet->len );
		MSG_WriteData( msg, packet->data, packet->len );
	}

	// !!! FIXME: I hate this queue system.
	cl->queuedVoipPackets -= i;
	if (cl->queuedVoipPackets > 0) {
		memmove( &cl->voipPacket[0], &cl->voipPacket[i],
		         sizeof (voipServerPacket_t) * i);
	}
}
开发者ID:burzumishi,项目名称:dragonballworld,代码行数:48,代码来源:sv_client.c


示例17: SV_UpdateServerCommandsToClientRecover

void SV_UpdateServerCommandsToClientRecover( client_t *client, msg_t *msg )
{
	int i;
	int cmdlen;
	
	for(i = client->reliableAcknowledge + 1; i <= client->reliableSequence; i++)
	{
		
		cmdlen = strlen(client->reliableCommands[i & ( MAX_RELIABLE_COMMANDS - 1 )].command);
		
		if ( cmdlen + msg->cursize + 6 >= msg->maxsize )
			break;
		
		MSG_WriteByte(msg, svc_serverCommand);
		MSG_WriteLong(msg, i);
		MSG_WriteString(msg, client->reliableCommands[i & ( MAX_RELIABLE_COMMANDS - 1 )].command);
	
	}
	if ( i - 1 > client->reliableSent )
	client->reliableSent = i - 1;
}
开发者ID:DeltaMX,项目名称:CoD4X17a_testing,代码行数:21,代码来源:sv_snapshot.c


示例18: CL_Stop_f

/*
====================
CL_Stop_f

stop recording a demo
====================
*/
void CL_Stop_f (void)
{
	if (!cls.demorecording)
	{
		Con_Printf ("Not recording a demo.\n");
		return;
	}

// write a disconnect message to the demo file
	SZ_Clear (&net_message);
	MSG_WriteLong (&net_message, -1);	// -1 sequence means out of band
	MSG_WriteByte (&net_message, svc_disconnect);
	MSG_WriteString (&net_message, "EndOfDemo");
	CL_WriteDemoMessage (&net_message);

// finish up
	fclose (cls.demofile);
	cls.demofile = NULL;
	cls.demorecording = false;
	Con_Printf ("Completed demo\n");
}
开发者ID:DaneTheory,项目名称:quake,代码行数:28,代码来源:cl_demo.c


示例19: Netchan_OutOfBand

/*
===============
Netchan_OutOfBand

Sends an out-of-band datagram
================
*/
void Netchan_OutOfBand(int s, struct sockaddr_in *adr, int length, byte *data)
{
	sizebuf_t send1;
	byte send_buf[MAX_MSGLEN + PACKET_HEADER];

	SZ_InitEx(&send1, send_buf, sizeof(send_buf), true);

	// write the packet header
	MSG_WriteLong(&send1, -1);	// -1 sequence means out of band
	// write data
	SZ_Write(&send1, data, length);

	if (send1.overflowed)
	{
		Sys_Printf("Netchan_OutOfBand: overflowed\n");
		return; // ah, should not happens
	}

	// send the datagram
	NET_SendPacket(s, send1.cursize, send1.data, adr);
}
开发者ID:deurk,项目名称:qwfwd,代码行数:28,代码来源:net.c


示例20: P_FireWeapon

//
// P_FireWeapon.
//
void P_FireWeapon (player_t *player)
{
	statenum_t	newstate;

	if (!P_CheckAmmo (player))
		return;

	// [tm512] Send the client the weapon they just fired so
	// that they can fix any weapon desyncs that they get - apr 14 2012
	if (serverside && !clientside)
	{
		MSG_WriteMarker (&player->client.reliablebuf, svc_fireweapon);
		MSG_WriteByte (&player->client.reliablebuf, player->readyweapon);
		MSG_WriteLong (&player->client.reliablebuf, player->tic);
	}

	P_SetMobjState (player->mo, S_PLAY_ATK1);
	newstate = weaponinfo[player->readyweapon].atkstate;
	P_SetPsprite (player, ps_weapon, newstate);
	P_NoiseAlert (player->mo, player->mo);
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:24,代码来源:p_pspr.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MSG_WriteShort函数代码示例发布时间:2022-05-30
下一篇:
C++ MSG_WriteDeltaEntity函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap