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


C++ NET_Packet::w_begin方法代码示例

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


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

示例1:

void			CLevel::OnBuildVersionChallenge		()
{
	NET_Packet P;
	P.w_begin				(M_CL_AUTH);
	u64 auth = FS.auth_get();
	P.w_u64					(auth);
	Send					(P, net_flags(TRUE, TRUE, TRUE, TRUE));
};
开发者ID:svarog2741,项目名称:RayRoH-Project,代码行数:8,代码来源:Level_network.cpp

示例2: SendPacket

void BattlEyeServer::SendPacket( int player, void* packet, int len )
{
	NET_Packet P;
	P.w_begin( M_BATTLEYE );
	P.w_u32( len );
	P.w( packet, len );
	Level().Server->SendTo( (u32)player, P, net_flags() );
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:8,代码来源:xr_Server_BattlEye.cpp

示例3:

void SHit::Write_Packet			(NET_Packet	&Packet)
{
	Packet.w_begin	(M_EVENT);
	Packet.w_u32		(Time);
	Packet.w_u16		(u16(PACKET_TYPE&0xffff));
	Packet.w_u16		(u16(DestID&0xffff));

	Write_Packet_Cont (Packet);	
};
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:9,代码来源:Hit.cpp

示例4: sizeof

void CSE_Abstract::Spawn_Write				(NET_Packet	&tNetPacket, BOOL bLocal)
{
	// generic
	tNetPacket.w_begin			(M_SPAWN);
	tNetPacket.w_stringZ		(s_name			);
	tNetPacket.w_stringZ		(s_name_replace ?	s_name_replace : "");
	tNetPacket.w_u8				(s_gameid		);
	tNetPacket.w_u8				(s_RP			);
	tNetPacket.w_vec3			(o_Position		);
	tNetPacket.w_vec3			(o_Angle		);
	tNetPacket.w_u16			(RespawnTime	);
	tNetPacket.w_u16			(ID				);
	tNetPacket.w_u16			(ID_Parent		);
	tNetPacket.w_u16			(ID_Phantom		);

	s_flags.set					(M_SPAWN_VERSION,TRUE);
	if (bLocal)
		tNetPacket.w_u16		(u16(s_flags.flags|M_SPAWN_OBJECT_LOCAL) );
	else
		tNetPacket.w_u16		(u16(s_flags.flags&~(M_SPAWN_OBJECT_LOCAL|M_SPAWN_OBJECT_ASPLAYER)));
	
	tNetPacket.w_u16			(SPAWN_VERSION);
	
	tNetPacket.w_u16			(script_server_object_version());


	//client object custom data serialization SAVE
	u16 client_data_size		= (u16)client_data.size(); //не может быть больше 256 байт
	tNetPacket.w_u16			(client_data_size);
//	Msg							("SERVER:saving:save:%d bytes:%d:%s",client_data_size,ID,s_name_replace ? s_name_replace : "");
	if (client_data_size > 0) {
		tNetPacket.w			(&*client_data.begin(),client_data_size);
	}

	tNetPacket.w				(&m_tSpawnID,	sizeof(m_tSpawnID));
//	tNetPacket.w_float			(m_spawn_probability);
//	tNetPacket.w_u32			(m_spawn_flags.get());
//	tNetPacket.w_stringZ		(m_spawn_control);
//	tNetPacket.w_u32			(m_max_spawn_count);
//	tNetPacket.w_u64			(m_min_spawn_interval);
//	tNetPacket.w_u64			(m_max_spawn_interval);

#ifdef XRSE_FACTORY_EXPORTS
	CScriptValueContainer::assign();
#endif

	// write specific data
	u32	position				= tNetPacket.w_tell();
	tNetPacket.w_u16			(0);
	STATE_Write					(tNetPacket);
	u16 size					= u16(tNetPacket.w_tell() - position);
//#ifdef XRSE_FACTORY_EXPORTS
	R_ASSERT3					((m_tClassID == CLSID_SPECTATOR) || (size > sizeof(size)),"object isn't successfully saved, get your backup :(",name_replace());
//#endif
	tNetPacket.w_seek			(position,&size,sizeof(u16));
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:56,代码来源:xrServer_Object_Base.cpp

示例5: OnOk

void CChangeLevelWnd::OnOk()
{
	Game().StartStopMenu					(this, true);
	NET_Packet								p;
	p.w_begin								(M_CHANGE_LEVEL);
	p.w										(&m_game_vertex_id,sizeof(m_game_vertex_id));
	p.w										(&m_level_vertex_id,sizeof(m_level_vertex_id));
	p.w_vec3								(m_position);
	p.w_vec3								(m_angles);

	Level().Send							(p,net_flags(TRUE));
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:12,代码来源:UIGameSP.cpp

示例6:

void			CLevel::OnBuildVersionChallenge		()
{
	NET_Packet P;
	P.w_begin				(M_CL_AUTH);
#ifdef DEBUG
	u64 auth = MP_DEBUG_AUTH;
#else
	u64 auth = FS.auth_get();
#endif //#ifdef DEBUG
	P.w_u64					(auth);
	SecureSend				(P, net_flags(TRUE, TRUE, TRUE, TRUE));
};
开发者ID:Charsi82,项目名称:xray-1.5.10-2015-,代码行数:12,代码来源:Level_network.cpp

示例7:

void			CLevel::SendPingMessage				()
{
	u32 CurTime = timeServer_Async();
	if (CurTime < (m_dwCL_PingLastSendTime + m_dwCL_PingDeltaSend)) return;
	u32 m_dwCL_PingLastSendTime = CurTime;
	NET_Packet P;
	P.w_begin		(M_CL_PING_CHALLENGE);
	P.w_u32			(m_dwCL_PingLastSendTime);
	P.w_u32			(m_dwCL_PingLastSendTime);
	P.w_u32			(m_dwRealPing);
	Send	(P, net_flags(FALSE));
};
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:12,代码来源:Level_network.cpp

示例8:

void			xrGameSpyServer::OnCDKey_ReValidation			(int LocalID, int hint, char* challenge)
{
	ClientID ID; ID.set(u32(LocalID));
	xrGameSpyClientData* CL = (xrGameSpyClientData*)  ID_to_client(ID);
	if (!CL) return;
	strcpy_s(CL->m_pChallengeString, challenge);
	CL->m_iCDKeyReauthHint = hint;
	//--------- Send Respond ---------------------------------------------
	NET_Packet P;
	P.w_begin	(M_GAMESPY_CDKEY_VALIDATION_CHALLENGE);
	P.w_u8(1);
	P.w_stringZ(CL->m_pChallengeString);
	SendTo(CL->ID, P);
}
开发者ID:2asoft,项目名称:xray,代码行数:14,代码来源:xrGameSpy_GameSpyFuncs.cpp

示例9: SendConnectionData

void xrServer::SendConnectionData(IClient* _CL)
{
	g_perform_spawn_ids.clear_not_free();
	xrClientData*	CL				= (xrClientData*)_CL;
	NET_Packet		P;
	u32			mode				= net_flags(TRUE,TRUE);
	// Replicate current entities on to this client
	xrS_entities::iterator	I=entities.begin(),E=entities.end();
	for (; I!=E; ++I)						I->second->net_Processed	= FALSE;
	for (I=entities.begin(); I!=E; ++I)		Perform_connect_spawn		(I->second,CL,P);

	// Send "finished" signal
	P.w_begin						(M_SV_CONFIG_FINISHED);
	SendTo							(CL->ID,P,mode);
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:15,代码来源:xrServer_CL_connect.cpp

示例10:

bool xrServer::NeedToCheckClient_BuildVersion		(IClient* CL)	
{
//#ifdef DEBUG
	//return false; 
//#else

	if (g_SV_Disable_Auth_Check) return false;
	CL->flags.bVerified = FALSE;
	NET_Packet	P;
	P.w_begin	(M_AUTH_CHALLENGE);
	SendTo		(CL->ID, P);
	return true;

//#endif
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:15,代码来源:xrServer_CL_connect.cpp

示例11: create

void CALifeSimulatorBase::create(CSE_ALifeDynamicObject *&i, CSE_ALifeDynamicObject *j, const _SPAWN_ID &tSpawnID)
{
	CSE_Abstract				*tpSE_Abstract = F_entity_Create(*j->s_name);
	R_ASSERT3					(tpSE_Abstract,"Cannot find item with section",*j->s_name);
	i							= smart_cast<CSE_ALifeDynamicObject*>(tpSE_Abstract);
	R_ASSERT2					(i,"Non-ALife object in the 'game.spawn'");

	NET_Packet					tNetPacket;
	j->Spawn_Write				(tNetPacket,TRUE);
	i->Spawn_Read				(tNetPacket);
	tNetPacket.w_begin			(M_UPDATE);
	j->UPDATE_Write				(tNetPacket);
	u16							id;
	tNetPacket.r_begin			(id);
	i->UPDATE_Read				(tNetPacket);

	R_ASSERT3					(!(i->used_ai_locations()) || (i->m_tNodeID != u32(-1)),"Invalid vertex for object ",i->name_replace());

	i->m_tSpawnID				= tSpawnID;
	if (!graph().actor() && smart_cast<CSE_ALifeCreatureActor*>(i))
		i->ID					= 0;
	else
		i->ID					= server().PerformIDgen(0xffff);

	register_object				(i,true);
	i->m_bALifeControl			= true;

	CSE_ALifeMonsterAbstract	*monster	= smart_cast<CSE_ALifeMonsterAbstract*>(i);
	if (monster)
		graph().assign			(monster);

	CSE_ALifeGroupAbstract		*group = smart_cast<CSE_ALifeGroupAbstract*>(i);
	if (group) {
		group->m_tpMembers.resize(group->m_wCount);
		OBJECT_IT				I = group->m_tpMembers.begin();
		OBJECT_IT				E = group->m_tpMembers.end();
		for ( ; I != E; ++I) {
			CSE_Abstract		*object = create	(group,j);
			*I					= object->ID;
		}
	}
	else
		i->spawn_supplies		();

	i->on_spawn					();
}
开发者ID:2asoft,项目名称:xray,代码行数:46,代码来源:alife_simulator_base.cpp

示例12:

void xrServer::Perform_destroy	(CSE_Abstract* object, u32 mode)
{
	R_ASSERT				(object);
	R_ASSERT				(object->ID_Parent == 0xffff);

#ifdef DEBUG
#	ifdef SLOW_VERIFY_ENTITIES
		verify_entities			();
#	endif
#endif

	while (!object->children.empty()) {
		CSE_Abstract		*child = game->get_entity_from_eid(object->children.back());
		R_ASSERT2			(child, make_string("child registered but not found [%d]",object->children.back()));
//		Msg					("SLS-CLEAR : REJECT  [%s][%s] FROM [%s][%s]",child->name(),child->name_replace(),object->name(),object->name_replace());
		Perform_reject		(child,object,2*NET_Latency);
#ifdef DEBUG
#	ifdef SLOW_VERIFY_ENTITIES
		verify_entities			();
#	endif
#endif
		Perform_destroy		(child,mode);
	}

//	Msg						("SLS-CLEAR : DESTROY [%s][%s]",object->name(),object->name_replace());
	u16						object_id = object->ID;
	entity_Destroy			(object);

#ifdef DEBUG
#	ifdef SLOW_VERIFY_ENTITIES
		verify_entities		();
#	endif
#endif

	NET_Packet				P;
	P.w_begin				(M_EVENT);
	P.w_u32					(Device.dwTimeGlobal - 2*NET_Latency);
	P.w_u16					(GE_DESTROY);
	P.w_u16					(object_id);
	ClientID				clientID;
	clientID.setBroadcast	();
	SendBroadcast			(clientID,P,mode);
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:43,代码来源:xrServer_sls_clear.cpp

示例13: KickPlayer

void  BattlEyeServer::KickPlayer( int player, char* reason )
{
	xrClientData* tmp_client = static_cast<xrClientData*>(
		Level().Server->GetClientByID(static_cast<ClientID>(player))
	);

	if (!tmp_client)
	{
		Msg( "! No such player found : %i", player );
		return;
	}
	LPCSTR reason2;
	STRCONCAT( reason2, "@", tmp_client->ps->getName(), " ", CStringTable().translate("ui_st_kicked_by_battleye").c_str(), " ", reason );
	
	Msg( reason2 );
	if( g_be_message_out )// self
	{
		if ( Level().game )
		{
			Level().game->CommonMessageOut( reason2 + 1 );
		}
	}

	if (Level().Server->GetServerClient() == tmp_client)
	{
//				"  Disconnecting : %s !  Server's Client kicked by BattlEye Server.  Reason: %s",
		NET_Packet	P;
		P.w_begin	( M_GAMEMESSAGE ); 
		P.w_u32		( GAME_EVENT_SERVER_DIALOG_MESSAGE );
		P.w_stringZ	( reason2 );
		Level().Server->SendBroadcast( tmp_client->ID, P ); // to all, except self

		Level().OnSessionTerminate( reason2 ); //to self
		Engine.Event.Defer("KERNEL:disconnect");
		return;
	}

	Level().Server->AddCheater(shared_str(reason2), tmp_client->ID);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:39,代码来源:xr_Server_BattlEye.cpp

示例14: server

CSE_Abstract *CALifeSimulatorBase::create(CSE_ALifeGroupAbstract *tpALifeGroupAbstract, CSE_ALifeDynamicObject *j)
{
	NET_Packet					tNetPacket;
	LPCSTR						S = pSettings->r_string(tpALifeGroupAbstract->base()->s_name,"monster_section");
	CSE_Abstract				*l_tpAbstract = F_entity_Create(S);
	R_ASSERT2					(l_tpAbstract,"Can't create entity.");
	CSE_ALifeDynamicObject		*k = smart_cast<CSE_ALifeDynamicObject*>(l_tpAbstract);
	R_ASSERT2					(k,"Non-ALife object in the 'game.spawn'");

	j->Spawn_Write				(tNetPacket,TRUE);
	k->Spawn_Read				(tNetPacket);
	tNetPacket.w_begin			(M_UPDATE);
	j->UPDATE_Write				(tNetPacket);
	u16							id;
	tNetPacket.r_begin			(id);
	k->UPDATE_Read				(tNetPacket);
	k->s_name					= S;
	k->m_tSpawnID				= j->m_tSpawnID;
	k->ID						= server().PerformIDgen(0xffff);
	k->m_bDirectControl			= false;
	k->m_bALifeControl			= true;
	
	string256					s_name_replace;
	strcpy_s						(s_name_replace,*k->s_name);
	if (k->ID < 1000)
		strcat					(s_name_replace,"0");
	if (k->ID < 100)
		strcat					(s_name_replace,"0");
	if (k->ID < 10)
		strcat					(s_name_replace,"0");
	string16					S1;
	strcat						(s_name_replace,itoa(k->ID,S1,10));
	k->set_name_replace			(s_name_replace);

	register_object				(k,true);
	k->spawn_supplies			();
	k->on_spawn					();
	return						(k);
}
开发者ID:2asoft,项目名称:xray,代码行数:39,代码来源:alife_simulator_base.cpp

示例15:

void CLevelChanger::feel_touch_new	(CObject *tpObject)
{
	CActor*			l_tpActor = smart_cast<CActor*>(tpObject);
	VERIFY			(l_tpActor);


	if(m_bSilentMode)
	{
		NET_Packet								p;
		p.w_begin								(M_CHANGE_LEVEL);
		p.w										(&m_game_vertex_id,sizeof(m_game_vertex_id));
		p.w										(&m_level_vertex_id,sizeof(m_level_vertex_id));
		p.w_vec3								(m_position);
		p.w_vec3								(m_angles);
		Level().Send							(p,net_flags(TRUE));
	}else{
		Fvector p,r;
		bool b = get_reject_pos(p,r);
		CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());

		if(pGameSP)pGameSP->ChangeLevel(m_game_vertex_id,m_level_vertex_id,m_position,m_angles,p,r,b);
		m_entrance_time		= Device.fTimeGlobal;
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:24,代码来源:level_changer.cpp


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