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


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

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


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

示例1: 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				(0);
	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			(m_gameType.m_GameType.get());
	
	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_u16			(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:AntonioModer,项目名称:xray-16,代码行数:59,代码来源:xrServer_Object_Base.cpp

示例2:

void CSE_ALifeItemPDA::STATE_Write		(NET_Packet	&tNetPacket)
{
	inherited::STATE_Write		(tNetPacket);
	tNetPacket.w				(&m_original_owner,sizeof(m_original_owner));
#ifdef XRGAME_EXPORTS
	tNetPacket.w_stringZ		(m_specific_character);
	tNetPacket.w_stringZ		(m_info_portion);
#else
	shared_str		tmp_1	= NULL;
	shared_str						tmp_2	= NULL;

	tNetPacket.w_stringZ		(tmp_1);
	tNetPacket.w_stringZ		(tmp_2);
#endif

}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:16,代码来源:xrServer_Objects_ALife_Items.cpp

示例3: GetTickCount

BOOL			CLevel::Connect2Server				(LPCSTR options)
{
	NET_Packet					P;
	m_bConnectResultReceived	= false	;
	m_bConnectResult			= true	;
	if (!Connect(options))		return	FALSE;
	//---------------------------------------------------------------------------
	if(psNET_direct_connect) m_bConnectResultReceived = true;
	u32 EndTime = GetTickCount() + ConnectionTimeOut;
	while	(!m_bConnectResultReceived)		{ 
		ClientReceive	();
		Sleep			(5); 
		if(Server)
			Server->Update()	;
		//-----------------------------------------
		u32 CurTime = GetTickCount();
		if (CurTime > EndTime)
		{
			NET_Packet	P;
			P.B.count = 0;
			P.r_pos = 0;

			P.w_u8(0);
			P.w_u8(0);
			P.w_stringZ("Data verification failed. Cheater? [1]");

			OnConnectResult(&P);			
		}
		if (net_isFails_Connect())
		{
			OnConnectRejected	();	
			Disconnect		()	;
			return	FALSE;
		}
		//-----------------------------------------
	}
	Msg							("%c client : connection %s - <%s>", m_bConnectResult ?'*':'!', m_bConnectResult ? "accepted" : "rejected", m_sConnectResult.c_str());
	if		(!m_bConnectResult) 
	{
		OnConnectRejected	();	
		Disconnect		()	;
		return FALSE		;
	};

	
	if(psNET_direct_connect)
		net_Syncronised = TRUE;
	else
		net_Syncronize	();

	while (!net_IsSyncronised()) {
	};

	//---------------------------------------------------------------------------
	P.w_begin	(M_CLIENT_REQUEST_CONNECTION_DATA);
	Send		(P, net_flags(TRUE, TRUE, TRUE, TRUE));
	//---------------------------------------------------------------------------
	return TRUE;
};
开发者ID:svarog2741,项目名称:RayRoH-Project,代码行数:59,代码来源:Level_network.cpp

示例4:

void	xrServer::SendConnectResult(IClient* CL, u8 res, u8 res1, char* ResultStr)
{
	NET_Packet	P;
	P.w_begin	(M_CLIENT_CONNECT_RESULT);
	P.w_u8		(res);
	P.w_u8		(res1);
	P.w_stringZ	(ResultStr);

	if (SV_Client && SV_Client == CL)
		P.w_u8(1);
	else
		P.w_u8(0);
	P.w_stringZ(Level().m_caServerOptions);
	
	SendTo		(CL->ID, P);
	
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:17,代码来源:xrServer_CL_connect.cpp

示例5: net_Spawn

BOOL CPhantom::net_Spawn(CSE_Abstract* DC)
{
	CSE_ALifeCreaturePhantom*	OBJ	= smart_cast<CSE_ALifeCreaturePhantom*>(DC); VERIFY(OBJ);
	
	// select visual at first
	LPCSTR vis_name = OBJ->get_visual();
	if (!(vis_name&&vis_name[0])){
		LPCSTR visuals	= pSettings->r_string(cNameSect(),"visuals");
		u32 cnt			= _GetItemCount(visuals);
		string256 tmp;
		OBJ->set_visual	(_GetItem(visuals,Random.randI(cnt),tmp));
		// inform server
		NET_Packet		P;
		u_EventGen		(P, GE_CHANGE_VISUAL, OBJ->ID);
		P.w_stringZ		(tmp);
		u_EventSend		(P);
	}

	SwitchToState		(stBirth);			// initial state (changed on load method in inherited::)

	// inherited
	if (!inherited::net_Spawn(DC)) return FALSE;
	
	m_enemy			= Level().CurrentEntity();
	VERIFY			(m_enemy);

	// default init 
	m_fly_particles		= 0;
	SetfHealth			(0.001f);

	// orientate to enemy
	XFORM().k.sub	(m_enemy->Position(),Position()).normalize();
	XFORM().j.set	(0,1,0);
	XFORM().i.crossproduct	(XFORM().j,XFORM().k);
	XFORM().k.getHP	(vHP.x,vHP.y);

	// set animation
	IKinematicsAnimated *K			= smart_cast<IKinematicsAnimated*>(Visual());
	m_state_data[stBirth].motion	= K->ID_Cycle("birth_0");	
	m_state_data[stFly].motion		= K->ID_Cycle("fly_0");
	m_state_data[stContact].motion	= K->ID_Cycle("contact_0"); 
	m_state_data[stShoot].motion	= K->ID_Cycle("shoot_0");	

	VERIFY(K->LL_GetMotionDef(m_state_data[stBirth].motion)->flags&esmStopAtEnd);
	VERIFY(K->LL_GetMotionDef(m_state_data[stContact].motion)->flags&esmStopAtEnd);
	VERIFY(K->LL_GetMotionDef(m_state_data[stShoot].motion)->flags&esmStopAtEnd);

	// set state
	SwitchToState_internal(m_TgtState);

	setVisible		(m_CurState>stIdle?TRUE:FALSE);
	setEnabled		(TRUE);

	return			TRUE;
}
开发者ID:2asoft,项目名称:xray,代码行数:55,代码来源:phantom.cpp

示例6: InitCarBody

void CUICarBodyWnd::InitCarBody(CInventoryOwner* pOur, CInventoryOwner* pOthers)
{

    m_pOurObject									= pOur;
	m_pOthersObject									= pOthers;
	m_pInventoryBox									= NULL;
	
	u16 our_id										= smart_cast<CGameObject*>(m_pOurObject)->ID();
	u16 other_id									= smart_cast<CGameObject*>(m_pOthersObject)->ID();

	m_pUICharacterInfoLeft->InitCharacter			(our_id);
	m_pUIOthersIcon->Show							(true);
	
	CBaseMonster *monster = NULL;
	if(m_pOthersObject) {
		monster										= smart_cast<CBaseMonster *>(m_pOthersObject);
		if (monster || m_pOthersObject->use_simplified_visual() ) 
		{
			m_pUICharacterInfoRight->ClearInfo		();
			if(monster)
			{
				shared_str monster_tex_name = pSettings->r_string(monster->cNameSect(),"icon");
				m_pUICharacterInfoRight->UIIcon().InitTexture(monster_tex_name.c_str());
				m_pUICharacterInfoRight->UIIcon().SetStretchTexture(true);
			}
		}else 
		{
			m_pUICharacterInfoRight->InitCharacter	(other_id);
		}
	}

	m_pUIPropertiesBox->Hide						();
	EnableAll										();
	UpdateLists										();

	if(!monster){
		CInfoPortionWrapper	*known_info_registry	= xr_new<CInfoPortionWrapper>();
		known_info_registry->registry().init		(other_id);
		KNOWN_INFO_VECTOR& known_info				= known_info_registry->registry().objects();

		KNOWN_INFO_VECTOR_IT it = known_info.begin();
		for(int i=0;it!=known_info.end();++it,++i){
			(*it).info_id;	
			NET_Packet		P;
			CGameObject::u_EventGen		(P,GE_INFO_TRANSFER, our_id);
			P.w_u16						(0);//not used
			P.w_stringZ					((*it).info_id);			//сообщение
			P.w_u8						(1);						//добавление сообщения
			CGameObject::u_EventSend	(P);
		}
		known_info.clear	();
		xr_delete			(known_info_registry);
	}
}  
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:54,代码来源:UICarBodyWnd.cpp

示例7: STATE_Write

void CSE_SmartCover::STATE_Write(NET_Packet	&tNetPacket)
{
	inherited1::STATE_Write		(tNetPacket);
	cform_write					(tNetPacket);
	tNetPacket.w_stringZ		(m_description);
	tNetPacket.w_float			(m_hold_position_time);
	tNetPacket.w_float			(m_enter_min_enemy_distance);
	tNetPacket.w_float			(m_exit_min_enemy_distance);
	tNetPacket.w_u8				((u8)m_is_combat_cover);
	tNetPacket.w_u8				((u8)m_can_fire);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:11,代码来源:xrServer_Objects_Alife_Smartcovers.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:

void xrServer::OnCL_Disconnected	(IClient* CL)
{
	//csPlayers.Enter			();
	
	// Game config (all, info includes deleted player now, excludes at the next cl-update)
	NET_Packet P;
	P.B.count = 0;
	P.w_clientID(CL->ID);
	xrClientData* xrCData = (xrClientData*)(CL);
	VERIFY(xrCData);
	
	if (!xrCData->ps)
		return;

	P.w_stringZ(xrCData->ps->getName());
	P.w_u16(xrCData->ps->GameID);
	P.r_pos = 0;
	
	ClientID clientID;
	clientID.set(0);
	
	game->AddDelayedEvent(P,GAME_EVENT_PLAYER_DISCONNECTED, 0, clientID);
	
	//
	xrS_entities::iterator	I=entities.begin(),E=entities.end();
	if (GetClientsCount()>1 && !CL->flags.bLocal)
	{
		// Migrate entities
		for (; I!=E; ++I)
		{
			CSE_Abstract*	entity		= I->second;
			if (entity->owner == CL)	PerformMigration	(entity,(xrClientData*)CL,SelectBestClientToMigrateTo(entity,TRUE));
		}
	} else {
		// Destroy entities
		while (!entities.empty())		{
			CSE_Abstract*	entity		= entities.begin()->second;
			entity_Destroy	(entity);
		}
	}	
	//csPlayers.Leave			();

	Server_Client_Check(CL);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:44,代码来源:xrServer_CL_disconnect.cpp

示例10: Position

void CAI_Stalker::net_Export		(NET_Packet& P)
{
	R_ASSERT						(Local());

	// export last known packet
	R_ASSERT						(!NET.empty());
	net_update& N					= NET.back();
//	P.w_float						(inventory().TotalWeight());
//	P.w_u32							(m_dwMoney);

	P.w_float						(GetfHealth());

	P.w_u32							(N.dwTimeStamp);
	P.w_u8							(0);
	P.w_vec3						(N.p_pos);
	P.w_float /*w_angle8*/						(N.o_model);
	P.w_float /*w_angle8*/						(N.o_torso.yaw);
	P.w_float /*w_angle8*/						(N.o_torso.pitch);
	P.w_float /*w_angle8*/						(N.o_torso.roll);
	P.w_u8							(u8(g_Team()));
	P.w_u8							(u8(g_Squad()));
	P.w_u8							(u8(g_Group()));
	

	float					f1 = 0;
	GameGraph::_GRAPH_ID		l_game_vertex_id = ai_location().game_vertex_id();
	P.w						(&l_game_vertex_id,			sizeof(l_game_vertex_id));
	P.w						(&l_game_vertex_id,			sizeof(l_game_vertex_id));
//	P.w						(&f1,						sizeof(f1));
//	P.w						(&f1,						sizeof(f1));
	if (ai().game_graph().valid_vertex_id(l_game_vertex_id)) {
		f1					= Position().distance_to	(ai().game_graph().vertex(l_game_vertex_id)->level_point());
		P.w					(&f1,						sizeof(f1));
		f1					= Position().distance_to	(ai().game_graph().vertex(l_game_vertex_id)->level_point());
		P.w					(&f1,						sizeof(f1));
	}
	else {
		P.w					(&f1,						sizeof(f1));
		P.w					(&f1,						sizeof(f1));
	}

	P.w_stringZ						(m_sStartDialog);
}
开发者ID:2asoft,项目名称:xray,代码行数:43,代码来源:ai_stalker.cpp

示例11: OnH_A_Chield

void CInfoDocument::OnH_A_Chield() 
{
	inherited::OnH_A_Chield		();
	
	//передать информацию содержащуюся в документе
	//объекту, который поднял документ
	CInventoryOwner* pInvOwner = smart_cast<CInventoryOwner*>(H_Parent());
	if(!pInvOwner) return;
	
	//создать и отправить пакет о получении новой информации
	if(m_Info.size())
	{
		NET_Packet		P;
		u_EventGen		(P,GE_INFO_TRANSFER, H_Parent()->ID());
		P.w_u16			(ID());						//отправитель
		P.w_stringZ		(m_Info);				//сообщение
		P.w_u8			(1);						//добавление сообщения
		u_EventSend		(P);
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:20,代码来源:InfoDocument.cpp

示例12: TransferInfo

void CInventoryOwner::TransferInfo(shared_str info_id, bool add_info) const
{
	VERIFY( info_id.size() );
	const CObject* pThisObject = smart_cast<const CObject*>(this); VERIFY(pThisObject);

	//отправляем от нашему PDA пакет информации с номером
	NET_Packet		P;
	CGameObject::u_EventGen(P, GE_INFO_TRANSFER, pThisObject->ID());
	P.w_u16			(pThisObject->ID());					//отправитель
	P.w_stringZ		(info_id);							//сообщение
	P.w_u8			(add_info?1:0);							//добавить/удалить информацию
	CGameObject::u_EventSend(P);

	CInfoPortion info_portion;
	info_portion.Load(info_id);
	{
		if(add_info)
			OnReceiveInfo	(info_id);
		else
			OnDisableInfo	(info_id);
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:22,代码来源:inventory_owner_info.cpp

示例13: GenerateGameMessage

void	game_sv_TeamDeathmatch::OnPlayerConnectFinished	(ClientID id_who)
{
    inherited::OnPlayerConnectFinished(id_who);

    xrClientData* xrCData		=	m_server->ID_to_client(id_who);
    // Send Message About Client join Team
    if (xrCData)
    {
        NET_Packet			P;
        //		P.w_begin			(M_GAMEMESSAGE);
        GenerateGameMessage (P);
        P.w_u32				(GAME_EVENT_PLAYER_JOIN_TEAM);
        P.w_stringZ			( xrCData->name.c_str() );
        P.w_u16				(xrCData->ps->team);
        u_EventSend(P);
    };

    if (xrCData)
    {
        if (xrCData->ps) xrCData->ps->m_iTeamKills = 0;
    }
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:22,代码来源:game_sv_teamdeathmatch.cpp

示例14: 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

示例15:

void	game_PlayerState::net_Export(NET_Packet& P, BOOL Full)
{
	P.w_u8			(Full ? 1 : 0);
	if (Full)
		P.w_stringZ		(	name	);

	P.w_u8			(	team			);
	P.w_s16			(	m_iRivalKills	);
	P.w_s16			(	m_iSelfKills	);
	P.w_s16			(	m_iTeamKills	);
	P.w_s16			(	m_iDeaths		);
	P.w_s32			(	money_for_round	);
	P.w_float_q8	(	experience_D, -1.0f, 2.0f);
	P.w_u8			(	rank		);
	P.w_u8			(	af_count	);
	P.w_u16			(	flags__	);
	P.w_u16			(	ping	);

	P.w_u16			(	GameID	);
	P.w_s8			(	skin	);
	P.w_u8			(	m_bCurrentVoteAgreed	);

	P.w_u32			(Device.dwTimeGlobal - DeathTime);
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:24,代码来源:game_base.cpp


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