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

C++ NET_SendMessage函数代码示例

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

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



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

示例1: MSG_BeginWriting

void CDanBattleSys::SendBattleStart()
{
	TEAM_ITOR	iLoop;
	int			userIdx;

	MSG_BeginWriting( &netMessage );
	MSG_Clear( &netMessage );		
	MSG_WriteByte( &netMessage, GSC_EXTEND );
	MSG_WriteByte( &netMessage, GSC_DAN_BATTLE );
	MSG_WriteByte( &netMessage, DANB_BATTLE_START );
	for (iLoop=m_BattleTeam[0].begin();iLoop!=m_BattleTeam[0].end();iLoop++)
	{
		userIdx=(*iLoop);

		NET_SendMessage( &g_pc[userIdx].sock, &netMessage );
		ShowLogInfo("SendName = %s",g_pc[userIdx].name);
	}

	for (iLoop=m_BattleTeam[1].begin();iLoop!=m_BattleTeam[1].end();iLoop++)
	{
		userIdx=(*iLoop);

		NET_SendMessage( &g_pc[userIdx].sock, &netMessage );
		ShowLogInfo("SendName = %s",g_pc[userIdx].name);
	}

	MSG_EndWriting( &netMessage );		
}
开发者ID:gthgame,项目名称:gth,代码行数:28,代码来源:Dan.cpp


示例2: SV_DropClient

/*
=====================
SV_DropClient

Called when the player is getting totally kicked off the host
if (crash = true), don't bother sending signofs
=====================
*/
void SV_DropClient (bool crash)
{
	int		saveSelf;
	int		i;
	client_t *client;

	if (!host_client->active)
		return;

	if (!crash)
	{
		// send any final messages (don't check for errors)
		if (NET_CanSendMessage (host_client->netconnection))
		{
			MSG_WriteByte (&host_client->message, svc_disconnect);
			NET_SendMessage (host_client->netconnection, &host_client->message);
		}

		if (host_client->edict && host_client->spawned)
		{
		// call the prog function for removing a client
		// this will set the body to a dead frame, among other things
			saveSelf = pr_global_struct->self;
			pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
			PR_ExecuteProgram (pr_global_struct->ClientDisconnect);
			pr_global_struct->self = saveSelf;
		}

		Sys_Printf ("Client %s removed\n",host_client->name);
	}

	/*if (host_client->netconnection->proquake_connection == MOD_QSMACK)
		qsmackActive = false;*/

// break the net connection
	NET_Close (host_client->netconnection);
	host_client->netconnection = NULL;

// free the client (the body stays around)
	host_client->active = false;
	host_client->name[0] = 0;
	host_client->old_frags = -999999;
	net_activeconnections--;

// send notification to all clients
	for (i=0, client = svs.clients ; i<svs.maxclients ; i++, client++)
	{
		if (!client->active)
			continue;
		MSG_WriteByte (&client->message, svc_updatename);
		MSG_WriteByte (&client->message, host_client - svs.clients);
		MSG_WriteString (&client->message, "");
		MSG_WriteByte (&client->message, svc_updatefrags);
		MSG_WriteByte (&client->message, host_client - svs.clients);
		MSG_WriteShort (&client->message, 0);
		MSG_WriteByte (&client->message, svc_updatecolors);
		MSG_WriteByte (&client->message, host_client - svs.clients);
		MSG_WriteByte (&client->message, 0);
	}
}
开发者ID:Rinnegatamante,项目名称:vitaQuake,代码行数:68,代码来源:host.c


示例3: GTH_SendMessage_DestroyItem

void GTH_SendMessage_DestroyItem( playerCharacter_t *pc, int reply, int error, int itemIdx )
{
	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, GSC_REPLY_DESTROY_ITEM );
		
		MSG_WriteByte(&netMessage, reply );
		
		if( reply > 0 )
		{
			
			MSG_WriteShort(&netMessage, (int)pc->curChargeRA );

			
			MSG_WriteShort(&netMessage, (int)pc->curChargeSA );

			MSG_WriteShort(&netMessage, itemIdx );
			MSG_WriteShort(&netMessage, pc->curItemWeight );
			
			
			MSG_WriteShort(&netMessage, error);
		}
		else
		{
			MSG_WriteByte(&netMessage, error );
		}
		
		NET_SendMessage(&pc->sock, &netMessage);
	}
	MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:32,代码来源:net_item.cpp


示例4: Host_ShutdownServer

/*
==================
Host_ShutdownServer

This only happens at the end of a game, not between levels
==================
*/
void
Host_ShutdownServer(qboolean crash)
{
    int i;
    int count;
    sizebuf_t buf;
    byte message[4];
    double start;

    if (!sv.active)
	return;

    sv.active = false;

// stop all client sounds immediately
    if (cls.state >= ca_connected)
	CL_Disconnect();

// flush any pending messages - like the score!!!
    start = Sys_DoubleTime();
    do {
	count = 0;
	for (i = 0, host_client = svs.clients; i < svs.maxclients;
	     i++, host_client++) {
	    if (host_client->active && host_client->message.cursize) {
		if (NET_CanSendMessage(host_client->netconnection)) {
		    NET_SendMessage(host_client->netconnection,
				    &host_client->message);
		    SZ_Clear(&host_client->message);
		} else {
		    NET_GetMessage(host_client->netconnection);
		    count++;
		}
	    }
	}
	if ((Sys_DoubleTime() - start) > 3.0)
	    break;
    } while (count);

// make sure all the clients know we're disconnecting
    buf.data = message;
    buf.maxsize = 4;
    buf.cursize = 0;
    MSG_WriteByte(&buf, svc_disconnect);
    count = NET_SendToAll(&buf, 5);
    if (count)
	Con_Printf("%s: NET_SendToAll failed for %u clients\n", __func__,
		   count);

    for (i = 0, host_client = svs.clients; i < svs.maxclients;
	 i++, host_client++)
	if (host_client->active)
	    SV_DropClient(crash);

//
// clear structures
//
    memset(&sv, 0, sizeof(sv));
    memset(svs.clients, 0, svs.maxclientslimit * sizeof(client_t));
}
开发者ID:libretro,项目名称:tyrquake,代码行数:67,代码来源:host.c


示例5: GTH_SendMessage_ReplyGetInventoryItem

void GTH_SendMessage_ReplyGetInventoryItem(playerCharacter_t *pc, int reply, int error, int inventoryPos, int equipPos )
{
	int itemIdx;
	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, GSC_REPLY_GETINVENTORYITEM);
		
		if( reply > 0 )
		{
			MSG_WriteByte(&netMessage, reply);
			MSG_WriteByte(&netMessage, inventoryPos);
			MSG_WriteByte(&netMessage, equipPos);
			
			if( reply == 5 )
			{
				MSG_WriteByte(&netMessage, pc->mouseInventory);
				itemIdx = pc->inventory[inventoryPos];
				MSG_WriteItem( &netMessage, &pc->item[itemIdx] );
				MSG_WriteItem( &netMessage, &pc->item[pc->mouseInventory] );
			}
		}
		else
		{
			MSG_WriteByte(&netMessage, reply);
			MSG_WriteByte(&netMessage, error);
		}
		
		NET_SendMessage(&pc->sock, &netMessage);
	}
	MSG_EndWriting(&netMessage);

	GTH_PC_Calculate( pc, PCINFO_BASIC );
}
开发者ID:gthgame,项目名称:gth,代码行数:34,代码来源:net_item.cpp


示例6: MSG_BeginWriting

int CPostFunc::GTH_SendMessage_PostSystem_ReceiveItems()
{	
	CPostManager::PostPackage_t* pPostPackage = NULL;
	pPostPackage = g_cgv.myCharacterInfo->m_PostMng.GetOpenPost();	
	int	OpenIdx = g_cgv.myCharacterInfo->m_PostMng.m_OpenPostIdx;

	
	
	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, CC_EXTEND );
		MSG_WriteByte(&netMessage, CC_MAILBOX );
		MSG_WriteByte(&netMessage, MAILBOX_RECEIVE_ITEMS );		
		MSG_WriteLong(&netMessage, OpenIdx );				
		
		NET_SendMessage(&gsSocket, &netMessage); 
	}
	MSG_EndWriting( &netMessage );
	
	return 1;

	

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


示例7: GTH_SendMessage_AddItemObject

void GTH_SendMessage_AddItemObject(itemObject_t *itemObject)
{
	int i;
	int idx;

	
	GTH_GetPCListInValidRange(itemObject->worldIdx, itemObject->position);
	if (g_zonePCListNumber < 1)	return;

	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, GSC_ADDITEMOBJECT);
		MSG_WriteShort(&netMessage, itemObject->idx);
		MSG_WritePosition(&netMessage, itemObject->position);
		MSG_WriteByte(&netMessage, itemObject->objectType);
		
		if( itemObject->objectType == OBJECT_TYPE_ITEM )
		{
			MSG_WriteShort(&netMessage, itemObject->item.itemTableIdx);
		} else if( itemObject->objectType == OBJECT_TYPE_PORTAL )
		{
			MSG_WriteShort(&netMessage, itemObject->portal.portalType);
		}
		
		for (i=0; i < g_zonePCListNumber; i++)
		{
			idx = g_zonePCList[i].idx;
			if ( !g_pc[idx].ready ) continue;
			NET_SendMessage(&g_pc[idx].sock, &netMessage);
		} 
	}
	MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:34,代码来源:net_item.cpp


示例8: MSG_ReadShort

void CHelperManager::ProcessMessage_Reply_Helpers_Update ()
{
	if ( g_config.gameServerNo != MSG_ReadByte () ) return;

		int idx = MSG_ReadShort ();
		
		playerCharacter_t* pTaker=gcpTools->GetPlayerRecordPointer(idx);
		if(NULL==pTaker) return;
		
		HelperEntry HelperEntries;
		HelperEntries.level = MSG_ReadByte ();
		HelperEntries.job = MSG_ReadByte ();
		HelperEntries.worldIdx = MSG_ReadByte ();
		strncpy ( HelperEntries.name, MSG_ReadString(),NAMESTRING);
		HelperEntries.name[NAMESTRING]=NULL;
		MSG_BeginWriting( &netMessage );
		MSG_Clear( &netMessage );
		{
			MSG_WriteByte(&netMessage, EXTEND_SECOND);
			MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
			MSG_WriteShort ( &netMessage, SC_LISTINFO_toAllPlayer);
			
			MSG_WriteByte ( &netMessage, HelperEntries.level );
			MSG_WriteByte ( &netMessage, HelperEntries.job );
			MSG_WriteByte ( &netMessage, HelperEntries.worldIdx );
			MSG_WriteString ( &netMessage, HelperEntries.name );
			
			NET_SendMessage ( &pTaker->sock, &netMessage );
			
		}
		MSG_EndWriting(&netMessage);
	
}
开发者ID:gthgame,项目名称:gth,代码行数:33,代码来源:HelperManager.cpp


示例9: GetHelperPtr

void CHelperManager::MemberListInfo_Send_toAllPlayer(entityPCList_t* pl, int fstate )
{
	
	struct tagHelper *helperlist = GetHelperPtr(pl->idx);
	if(NULL == helperlist) return;

	entityPCList_t target = { 0, };
	for (int idx = 0; idx < helperlist->List.count; idx++ )
	{	
		
		if ( g_entityListMng.FindPCList ( helperlist->List.Member[idx].name, &target ) < 0) continue;
		if( TRUE ==  helperlist->List.Member[idx].bIsMatchHELPERandTACKER) continue;
		
		if ( target.serverIdx == 0 )
		{
			MSG_BeginWriting ( &netMessage );
			MSG_Clear( &netMessage );

			MSG_WriteByte(&netMessage, EXTEND_SECOND);
			MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
			MSG_WriteShort ( &netMessage, SC_LISTINFO_toAllPlayer );
			MSG_WriteByte ( &netMessage, pl->level );
			MSG_WriteByte ( &netMessage, pl->job );
			MSG_WriteByte ( &netMessage, fstate == HelpersLogout ? -1 : pl->worldIdx );				
			MSG_WriteString ( &netMessage, pl->name );				    
			MSG_WriteShort ( &netMessage, helperlist->List.mode);

			playerCharacter_t* pPlayer=gcpTools->GetPlayerRecordPointer(target.idxOnServer);
			if(NULL == pPlayer) {
				MSG_EndWriting(&netMessage);
				return;
			}
		
			NET_SendMessage ( &pPlayer->sock, &netMessage );
			MSG_EndWriting(&netMessage);
			ShowLogInfo("SC_LISTINFO_toAllPlayer: PlayName= %s, level= %d, job= %d, fstate=%d,mode=%d,",
				pl->name,pl->level, pl->job,fstate,helperlist->List.mode );
			
		}else{	

			MSG_BeginWriting ( &netMessage );
			MSG_Clear( &netMessage );
		
			MSG_WriteByte(&netMessage, EXTEND_SECOND);
			MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
			MSG_WriteShort ( &netMessage, SS_REPLY_UPDATE_MemberList_toServer);				
			MSG_WriteByte ( &netMessage, target.serverIdx );
			MSG_WriteShort ( &netMessage, target.idxOnServer );
			
			MSG_WriteByte ( &netMessage, pl->level );
			MSG_WriteByte ( &netMessage, pl->job );
			MSG_WriteByte ( &netMessage, fstate == HelpersLogout ? -1 : pl->worldIdx );				
			MSG_WriteString ( &netMessage, pl->name );					
			MSG_WriteShort ( &netMessage, helperlist->List.mode);
			
			NET_SendUnreliableMessage ( &g_memberServer[target.serverIdx].sock, &netMessage );
			MSG_EndWriting(&netMessage);
		}		
	}
}
开发者ID:gthgame,项目名称:gth,代码行数:60,代码来源:HelperManager.cpp


示例10: CL_SendCmd

void CL_SendCmd(void) {
	usercmd_t cmd;

	if (cls.state != ca_connected)
		return;

	if (cls.signon == SIGNONS) {
		// get basic movement from keyboard
		CL_BaseMove(&cmd);
		// allow mice or other external controllers to add to the move
		IN_Move(&cmd);
		// send the unreliable message
		CL_SendMove(&cmd);

	}

	if (cls.demoplayback) {
		SZ_Clear(&cls.message);
		return;
	}

	// send the reliable message
	if (!cls.message.cursize)
		return; // no message at all

	if (!NET_CanSendMessage(cls.netcon)) {
		Con_DPrintf("CL_WriteToServer: can't send\n");
		return;
	}

	if (NET_SendMessage(cls.netcon, &cls.message) == -1)
		Host_Error("CL_WriteToServer: lost server connection");

	SZ_Clear(&cls.message);
}
开发者ID:DrLabman,项目名称:QMB,代码行数:35,代码来源:cl_main.cpp


示例11: GTH_SendMessage_AddInvItem

void GTH_SendMessage_AddInvItem( playerCharacter_t *pc, int reply, int error, item_t *item )
{
	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, GSC_ADDITEMINV);
		
		MSG_WriteByte(&netMessage, reply);
		if( reply )
		{
			MSG_WriteItem(&netMessage, item);
			
			
			
			MSG_WriteByte(&netMessage, error);
		}
		else
		{
			MSG_WriteByte(&netMessage, error);
		}
		
		NET_SendMessage(&pc->sock, &netMessage);
	}
	MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:25,代码来源:net_item.cpp


示例12: MSG_BeginWriting

void CWeatherSystem::GTH_SendMessageEventSeting(int event)
{
	if ( event < 0)	
		event = 0;			

	MSG_BeginWriting( &netMessage );
	
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, EXTEND_SECOND);		
		MSG_WriteShort(&netMessage, WEATHER_SYSTEM );				
		MSG_WriteShort(&netMessage, CC_WEATHER_SYSTEM );
		MSG_WriteByte(&netMessage, CC_WEATHER_SYSTEM_BROAD_CASTING_EVENT_SETING);				
		MSG_WriteByte(&netMessage, event);					
		NET_SendMessage(&gsSocket, &netMessage);
	}
	MSG_EndWriting(&netMessage);

	if ( event == 0)	
	{
		g_ifMng->AddChatMessage( g_LPACK.GetMassage(LPACK_TYPE_NORMAL2, 251), GTHCOLOR_SYSMESSAGE, g_LPACK.GetMessage(LPACK_TYPE_NORMAL,322));			
	}
	else
	{
		g_ifMng->AddChatMessage( g_LPACK.GetMassage(LPACK_TYPE_NORMAL2, 252), GTHCOLOR_SYSMESSAGE, g_LPACK.GetMessage(LPACK_TYPE_NORMAL,322));			
	}

	
	g_musicMng->PlaySample( g_soundMng->GetNormalSoundID( GTH_SOUND_ID_WARNING_2 ), GTH_SOUND_PLAY_ONCE );

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


示例13: CL_KeepaliveMessage

/*
==================
CL_KeepaliveMessage

When the client is taking a long time to load stuff, send keepalive messages
so the server doesn't disconnect.
==================
*/
void CL_KeepaliveMessage (void)
{
	float	time;
	static float lastmsg;
	int		ret;
	sizebuf_t	old;
	byte*	olddata;

	if (sv.active)
		return;		// no need if server is local
	if (cls.demoplayback)
		return;

// read messages from server, should just be nops
	old = net_message;
	olddata = Sys_BigStackAlloc(8192 * sizeof(byte), "CL_KeepaliveMessage");
	memcpy (olddata, net_message.data, net_message.cursize);

	do
	{
		ret = CL_GetMessage ();
		switch (ret)
		{
		default:
			Host_Error ("CL_KeepaliveMessage: CL_GetMessage failed");
		case 0:
			break;	// nothing waiting
		case 1:
			Host_Error ("CL_KeepaliveMessage: received a message");
			break;
		case 2:
			if (MSG_ReadByte() != svc_nop)
				Host_Error ("CL_KeepaliveMessage: datagram wasn't a nop");
			break;
		}
	} while (ret);

	net_message = old;
	memcpy (net_message.data, olddata, net_message.cursize);

// check time
	time = Sys_FloatTime ();
	if (time - lastmsg < 5)
	{
		Sys_BigStackFree(8192 * sizeof(byte), "CL_KeepaliveMessage");
		return;
	}
	lastmsg = time;

// write out a nop
	Con_Printf ("--> client to server keepalive\n");

	MSG_WriteByte (&cls.message, clc_nop);
	NET_SendMessage (cls.netcon, &cls.message);
	SZ_Clear (&cls.message);

	Sys_BigStackFree(8192 * sizeof(byte), "CL_KeepaliveMessage");
}
开发者ID:Rinnegatamante,项目名称:vitaQuake,代码行数:66,代码来源:cl_parse.c


示例14: strncpy

void CHelperManager::ProcessMessage_Reply_Helpers_List ()
{
	if ( g_config.gameServerNo != MSG_ReadByte () ) return;

	char czTempName[NAMESTRING+1];

	strncpy(czTempName,MSG_ReadString(),NAMESTRING);

	int idx = MSG_ReadShort ();
	int count = MSG_ReadByte ();
	int enumMode = static_cast<tagHelper::tagMemberList::enumMode>(MSG_ReadShort());
	
	playerCharacter_t* pTaker=gcpTools->GetPlayerRecordPointer(idx);
	
	if(NULL == pTaker) return;
	if(NULL != strcmp(pTaker->name,czTempName)) return;
	
	if(count < USERCOUNT || count > tagHelper::MAX_MEMBER) return;

	HelperEntry HelperEntries[tagHelper::MAX_MEMBER];


	for (int listmember = 0; listmember < count; listmember++ )
	{
		HelperEntries[listmember].level = MSG_ReadByte ();
		HelperEntries[listmember].job = MSG_ReadByte ();
		HelperEntries[listmember].worldIdx = MSG_ReadByte ();
		strncpy (HelperEntries[listmember].name, MSG_ReadString (),NAMESTRING);
		HelperEntries[listmember].name[NAMESTRING]=NULL;
		HelperEntries[listmember].bsync= MSG_ReadByte ();
	}

	MSG_BeginWriting ( &netMessage );
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, EXTEND_SECOND);
		MSG_WriteShort( &netMessage, HELPER_SYSTEM );
		MSG_WriteShort( &netMessage, SC_LIST_Res_toServer );
		MSG_WriteByte( &netMessage, count);
		
		MSG_WriteShort ( &netMessage, enumMode);
		for ( int listmember = 0; listmember < count; listmember++)
		{
			MSG_WriteByte ( &netMessage, HelperEntries[listmember].level );
			MSG_WriteByte ( &netMessage, HelperEntries[listmember].job );
			MSG_WriteByte ( &netMessage, HelperEntries[listmember].worldIdx );
			MSG_WriteString ( &netMessage, HelperEntries[listmember].name );
			MSG_WriteByte(&netMessage, HelperEntries[listmember].bsync);
		}
	
		NET_SendMessage ( &pTaker->sock, &netMessage );
		
	}
	MSG_EndWriting(&netMessage);

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


示例15: GTH_FindPCByName

void CHelperManager_Encoder::SendMessage_ReplySummons(int reply, char* toName, char* fromName)
{
	

	int idx = GTH_FindPCByName(toName);
	if ( 0 <= idx) 
	{
		playerCharacter_t* pTaker=gcpTools->GetPlayerRecordPointer(idx);
		if(NULL == pTaker) return;
		
		MSG_BeginWriting(&netMessage);
		MSG_Clear( &netMessage );
		{
			MSG_WriteByte(&netMessage, EXTEND_SECOND);
			MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
			MSG_WriteShort(&netMessage, SC_SPAWN_Res_toTaker);
			MSG_WriteByte(&netMessage, reply);	
			MSG_WriteString(&netMessage, fromName);	
			NET_SendMessage(&pTaker->sock, &netMessage);
		}
		MSG_EndWriting(&netMessage);
	}
	else	
	{
		MSG_BeginWriting(&netMessage);
		MSG_Clear( &netMessage );
		{
			MSG_WriteByte(&netMessage, EXTEND_SECOND);
			MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
			MSG_WriteShort(&netMessage, SS_SPAWN_Res_fromServer);
			MSG_WriteByte(&netMessage, reply);	
			MSG_WriteString(&netMessage, toName);	
			MSG_WriteString(&netMessage, fromName);	
			
			if ( TRUE == g_config.isManager )
			{
				
				for (int serveridx=1; serveridx < MAX_MEMBER_SERVER; serveridx++)	
				{
					if ( !g_memberServer[serveridx].active ) continue;
					
					NET_SendUnreliableMessage(&g_memberServer[serveridx].sock, &netMessage);
				}
			}
			else
			{
				
				MSG_WriteByte(&netMessage, g_config.gameServerNo);
				
				NET_SendUnreliableMessage(&localSocket, &netMessage);
			}
		}
		MSG_EndWriting(&netMessage);
	}
}
开发者ID:gthgame,项目名称:gth,代码行数:55,代码来源:CHelperManager_Encoder.cpp


示例16: MSG_BeginWriting

void CHelperManager_Encoder::SendMessage_Helper_StackOpen(playerCharacter_t* pHelper)
{
		MSG_BeginWriting(&netMessage);
		MSG_Clear( &netMessage );
		{
			MSG_WriteByte(&netMessage, EXTEND_SECOND);
			MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
			MSG_WriteShort(&netMessage, SC_STACK_OPEN_Req_toPlayer);
			NET_SendMessage(&pHelper->sock, &netMessage);
		}
		MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:12,代码来源:CHelperManager_Encoder.cpp


示例17: GTH_SendMessageRequestItemSyncItem

void GTH_SendMessageRequestItemSyncItem()
{
	MSG_BeginWriting(&netMessage);
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage,	EXTEND_SECOND);
		MSG_WriteShort(&netMessage, ITEM_EXTEND_SYSTEM);
		MSG_WriteShort(&netMessage,	REQUEST_ITEM_SYNC_TIME);
		NET_SendMessage(&gsSocket, &netMessage);
	}
	MSG_EndWriting(&netMessage);	
}
开发者ID:gthgame,项目名称:gth,代码行数:12,代码来源:ItemExtendSystemFunc.cpp


示例18: MSG_ReadByte

void CHelperManager::ProcessMessage_ServerReplySummons(void)
{
	int idx=-1;
	char toName[NAMESTRING+1], fromName[NAMESTRING+1];
	
	int reply = MSG_ReadByte();
	
	strncpy(toName, MSG_ReadString(),NAMESTRING);
	toName[NAMESTRING]=NULL;
	strncpy(fromName, MSG_ReadString(),NAMESTRING);
	fromName[NAMESTRING]=NULL;

	idx = GTH_FindPCByName(toName);
	if (0 <= idx) 
	{
		playerCharacter_t * pTaker=gcpTools->GetPlayerRecordPointer(idx);
		if(NULL==pTaker) return;
		MSG_BeginWriting(&netMessage);
		MSG_Clear( &netMessage );
		{
			MSG_WriteByte(&netMessage, GSC_REPLYSUMMONS);
			MSG_WriteByte(&netMessage, reply);	
			MSG_WriteString(&netMessage, fromName);	
			NET_SendMessage(&pTaker->sock, &netMessage);
		}
		MSG_EndWriting(&netMessage);
	}
	else	
	{
		if (TRUE == g_config.isManager )
		{	
			int fromMemberIdx = MSG_ReadByte(); 
			
			MSG_BeginWriting(&netMessage);
			MSG_Clear( &netMessage );
			{
				MSG_WriteByte(&netMessage, GSC_REPLYSUMMONS);
				MSG_WriteByte(&netMessage, reply);	
				MSG_WriteString(&netMessage, toName);	
				MSG_WriteString(&netMessage, fromName);	
				
				for (int severidx=1; severidx < MAX_MEMBER_SERVER; severidx++)	
				{
					if ( !g_memberServer[severidx].active ) continue;
					if ( severidx == fromMemberIdx ) continue;	
					
					NET_SendUnreliableMessage(&g_memberServer[severidx].sock, &netMessage);
				}
			}
			MSG_EndWriting(&netMessage);
		}
	}
}
开发者ID:gthgame,项目名称:gth,代码行数:53,代码来源:HelperManager.cpp


示例19: CL_KeepaliveMessage

/*
==================
CL_KeepaliveMessage

When the client is taking a long time to load stuff, send keepalive messages
so the server doesn't disconnect.
==================
*/
static void CL_KeepaliveMessage (void)
{
	float	time;
	static float lastmsg;
	int		ret;
	sizebuf_t	old;
	byte		olddata[NET_MAXMESSAGE];

	if (sv.active)
		return;		// no need if server is local
	if (cls.demoplayback)
		return;

// read messages from server, should just be nops
	old = net_message;
	memcpy (olddata, net_message.data, net_message.cursize);

	do
	{
		ret = CL_GetMessage ();
		switch (ret)
		{
		default:
			Host_Error ("%s: CL_GetMessage failed", __thisfunc__);
		case 0:
			break;	// nothing waiting
		case 1:
			Host_Error ("%s: received a message", __thisfunc__);
			break;
		case 2:
			if (MSG_ReadByte() != svc_nop)
				Host_Error ("%s: datagram wasn't a nop", __thisfunc__);
			break;
		}
	} while (ret);

	net_message = old;
	memcpy (net_message.data, olddata, net_message.cursize);

// check time
	time = Sys_DoubleTime ();
	if (time - lastmsg < 5)
		return;
	lastmsg = time;

// write out a nop
	Con_Printf ("--> client to server keepalive\n");

	MSG_WriteByte (&cls.message, clc_nop);
	NET_SendMessage (cls.netcon, &cls.message);
	SZ_Clear (&cls.message);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:60,代码来源:cl_parse.c


示例20: MSG_BeginWriting

void CGs_To_Cc::Send(playerCharacter_t* pPlayer,int SystemType,int mainType, int subType)
{
	MSG_BeginWriting( &netMessage );
	MSG_Clear( &netMessage );
	{
		MSG_WriteByte(&netMessage, EXTEND_SECOND);
		MSG_WriteShort(&netMessage, SystemType);
		MSG_WriteShort(&netMessage, mainType);		
		MSG_WriteShort(&netMessage, subType);		
		NET_SendMessage(&pPlayer->sock, &netMessage);
	}
	MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:13,代码来源:Gs_To_Cc.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NET_SendPacket函数代码示例发布时间:2022-05-30
下一篇:
C++ NET_OutOfBandPrint函数代码示例发布时间: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