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


C++ R_ASSERT2函数代码示例

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


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

示例1: PhDataUpdate

	virtual void PhDataUpdate(dReal step)
	{
		int num=dBodyGetNumJoints(m_body);
		for(int i=0;i<num;i++)
		{
			dJointID joint=dBodyGetJoint(m_body,i);
			if(dJointGetType(joint)==dJointTypeContact)
			{
				dJointFeedback* feedback=dJointGetFeedback(joint);
				R_ASSERT2(feedback,"Feedback was not set!!!");
				dxJoint* b_joint=(dxJoint*) joint;
				dBodyID other_body=b_joint->node[1].body;
				bool b_body_second=(b_joint->node[1].body==m_body);
				dReal* self_force=feedback->f1;
				dReal* self_torque=feedback->t1;
				dReal* othrers_force=feedback->f2;
				dReal* othrers_torque=feedback->t2;
				if(b_body_second)
				{
					other_body=b_joint->node[0].body;
					self_force=feedback->f2;
					self_torque=feedback->t2;
					othrers_force=feedback->f1;
					othrers_torque=feedback->t1;
				}

				save_max(m_max_force_self,_sqrt(dDOT( self_force,self_force)));
				save_max(m_max_torque_self,_sqrt(dDOT( self_torque,self_torque)));
				save_max(m_max_force_self_y,_abs(self_force[1]));
				save_max(m_max_force_self_sd,_sqrt(self_force[0]*self_force[0]+self_force[2]*self_force[2]));
				if(other_body)
				{
					dVector3 shoulder;dVectorSub(shoulder,dJointGetPositionContact(joint),dBodyGetPosition(other_body));
					dReal shoulder_lenght=_sqrt(dDOT(shoulder,shoulder));

					save_max(m_max_force_others,_sqrt(dDOT( othrers_force,othrers_force)));
					if(!fis_zero(shoulder_lenght)) 
						save_max(m_max_torque_others,_sqrt(dDOT( othrers_torque,othrers_torque))/shoulder_lenght);
				}
			}
		}
	}
开发者ID:2asoft,项目名称:xray,代码行数:42,代码来源:PHMovementDynamicActivate.cpp

示例2: ai

void CSE_ALifeInventoryBox::add_online	(const bool &update_registries)
{
	CSE_ALifeDynamicObjectVisual		*object = (this);

	NET_Packet					tNetPacket;
	ClientID					clientID;
	clientID.set				(object->alife().server().GetServerClient() ? object->alife().server().GetServerClient()->ID.value() : 0);

	ALife::OBJECT_IT			I = object->children.begin();
	ALife::OBJECT_IT			E = object->children.end();
	for ( ; I != E; ++I) {
		CSE_ALifeDynamicObject	*l_tpALifeDynamicObject = ai().alife().objects().object(*I);
		CSE_ALifeInventoryItem	*l_tpALifeInventoryItem = smart_cast<CSE_ALifeInventoryItem*>(l_tpALifeDynamicObject);
		R_ASSERT2				(l_tpALifeInventoryItem,"Non inventory item object has parent?!");
		l_tpALifeInventoryItem->base()->s_flags.or(M_SPAWN_UPDATE);
		CSE_Abstract			*l_tpAbstract = smart_cast<CSE_Abstract*>(l_tpALifeInventoryItem);
		object->alife().server().entity_Destroy(l_tpAbstract);

#ifdef DEBUG
//		if (psAI_Flags.test(aiALife))
//			Msg					("[LSS] Spawning item [%s][%s][%d]",l_tpALifeInventoryItem->base()->name_replace(),*l_tpALifeInventoryItem->base()->s_name,l_tpALifeDynamicObject->ID);
		Msg						(
			"[LSS][%d] Going online [%d][%s][%d] with parent [%d][%s] on '%s'",
			Device.dwFrame,
			Device.dwTimeGlobal,
			l_tpALifeInventoryItem->base()->name_replace(),
			l_tpALifeInventoryItem->base()->ID,
			ID,
			name_replace(),
			"*SERVER*"
		);
#endif

		l_tpALifeDynamicObject->o_Position		= object->o_Position;
		l_tpALifeDynamicObject->m_tNodeID		= object->m_tNodeID;
		object->alife().server().Process_spawn	(tNetPacket,clientID,FALSE,l_tpALifeInventoryItem->base());
		l_tpALifeDynamicObject->s_flags.and		(u16(-1) ^ M_SPAWN_UPDATE);
		l_tpALifeDynamicObject->m_bOnline		= true;
	}

	CSE_ALifeDynamicObjectVisual::add_online(update_registries);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:42,代码来源:alife_dynamic_object.cpp

示例3: R_ASSERT2

void CSE_ActorMP::UPDATE_Read	(NET_Packet &packet)
{
    flags						= 0;
    m_u16NumItems				= 1;
    velocity.set				(0.f,0.f,0.f);

    if (get_health() <= 0)
    {
        actor_mp_state_holder	tmp_state_holder;
        tmp_state_holder.read	(packet);
        return;
    }
    m_state_holder.read			(packet);
    R_ASSERT2(valid_pos(m_state_holder.state().position,phBoundaries), "read bad position");

    m_AliveState.quaternion		= m_state_holder.state().physics_quaternion;
    m_AliveState.angular_vel	= m_state_holder.state().physics_angular_velocity;
    m_AliveState.linear_vel		= m_state_holder.state().physics_linear_velocity;
    m_AliveState.force			= m_state_holder.state().physics_force;
    m_AliveState.torque			= m_state_holder.state().physics_torque;
    m_AliveState.position		= m_state_holder.state().physics_position;

    o_Position					= m_state_holder.state().position;

    accel						= m_state_holder.state().logic_acceleration;

    o_model						= m_state_holder.state().model_yaw;
    o_torso.yaw					= m_state_holder.state().camera_yaw;
    o_torso.pitch				= m_state_holder.state().camera_pitch;
    o_torso.roll				= m_state_holder.state().camera_roll;

    timestamp					= m_state_holder.state().time;

    weapon						= m_state_holder.state().inventory_active_slot;
    mstate						= m_state_holder.state().body_state_flags;
    set_health					( m_state_holder.state().health );
    fRadiation					= m_state_holder.state().radiation;
    m_AliveState.enabled		= m_state_holder.state().physics_state_enabled;

    m_ready_to_update			= true;
    //Msg("* Client 0x%08x UPDATE_Read, health is: %2.04f", this->ID, m_state_holder.state().health);
}
开发者ID:vasilenkomike,项目名称:xray,代码行数:42,代码来源:actor_mp_server_import.cpp

示例4: R_ASSERT2

void CUICaption::addCustomMessage(const shared_str& msg_name, float x, float y, float font_size, 
								  CGameFont *pFont, CGameFont::EAligment al, u32 color, LPCSTR def_str)
{
//	R_ASSERT2( (m_indices.find(msg_name) == m_indices.end()),"message already defined !!!" );
	R_ASSERT2( u32(-1)==findIndexOf_(msg_name),"message already defined !!!" );

	SinglePhrase * sp = AddPhrase();
	sp->outX = x;
	sp->outY = y;
	sp->effect.SetFontSize(font_size);
	sp->effect.SetFont(pFont);
	sp->effect.SetTextColor(color);
	sp->effect.SetFontAlignment(al);

	sp->str = *CStringTable().translate(def_str);
	sp->key = msg_name;

//	m_indices[msg_name] = m_vPhrases.size()-1;

}
开发者ID:2asoft,项目名称:xray,代码行数:20,代码来源:UIMultiTextStatic.cpp

示例5:

void CSE_ALifeInventoryItem::UPDATE_Write	(NET_Packet &tNetPacket)
{
	if (!m_u8NumItems) {
		tNetPacket.w_u8				(0);
		return;
	}

	mask_num_items					num_items;
	num_items.mask					= 0;
	num_items.num_items				= m_u8NumItems;

	R_ASSERT2						(
		num_items.num_items < (u8(1) << 5),
		make_string("%d",num_items.num_items)
	);

	if (State.enabled)									num_items.mask |= inventory_item_state_enabled;
	if (fis_zero(State.angular_vel.square_magnitude()))	num_items.mask |= inventory_item_angular_null;
	if (fis_zero(State.linear_vel.square_magnitude()))	num_items.mask |= inventory_item_linear_null;

	tNetPacket.w_u8					(num_items.common);

	tNetPacket.w_vec3				(State.position);

	tNetPacket.w_float_q8			(State.quaternion.x,0.f,1.f);
	tNetPacket.w_float_q8			(State.quaternion.y,0.f,1.f);
	tNetPacket.w_float_q8			(State.quaternion.z,0.f,1.f);
	tNetPacket.w_float_q8			(State.quaternion.w,0.f,1.f);	

	if (!check(num_items.mask,inventory_item_angular_null)) {
		tNetPacket.w_float_q8		(State.angular_vel.x,0.f,10*PI_MUL_2);
		tNetPacket.w_float_q8		(State.angular_vel.y,0.f,10*PI_MUL_2);
		tNetPacket.w_float_q8		(State.angular_vel.z,0.f,10*PI_MUL_2);
	}

	if (!check(num_items.mask,inventory_item_linear_null)) {
		tNetPacket.w_float_q8		(State.linear_vel.x,-32.f,32.f);
		tNetPacket.w_float_q8		(State.linear_vel.y,-32.f,32.f);
		tNetPacket.w_float_q8		(State.linear_vel.z,-32.f,32.f);
	}
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:41,代码来源:xrServer_Objects_ALife_Items.cpp

示例6: check

void CSE_ALifeInventoryItem::UPDATE_Read	(NET_Packet &tNetPacket)
{
	tNetPacket.r_u8					(m_u8NumItems);
	if (!m_u8NumItems) {
		return;
	}

	mask_num_items					num_items;
	num_items.common				= m_u8NumItems;
	m_u8NumItems					= num_items.num_items;

	R_ASSERT2						(
		m_u8NumItems < (u8(1) << 5),
		make_string("%d",m_u8NumItems)
	);

	tNetPacket.r_vec3				(State.position);

	tNetPacket.r_float_q8			(State.quaternion.x,0.f,1.f);
	tNetPacket.r_float_q8			(State.quaternion.y,0.f,1.f);
	tNetPacket.r_float_q8			(State.quaternion.z,0.f,1.f);
	tNetPacket.r_float_q8			(State.quaternion.w,0.f,1.f);	

	State.enabled					= check(num_items.mask,inventory_item_state_enabled);

	if (!check(num_items.mask,inventory_item_angular_null)) {
		tNetPacket.r_float_q8		(State.angular_vel.x,0.f,10*PI_MUL_2);
		tNetPacket.r_float_q8		(State.angular_vel.y,0.f,10*PI_MUL_2);
		tNetPacket.r_float_q8		(State.angular_vel.z,0.f,10*PI_MUL_2);
	}
	else
		State.angular_vel.set		(0.f,0.f,0.f);

	if (!check(num_items.mask,inventory_item_linear_null)) {
		tNetPacket.r_float_q8		(State.linear_vel.x,-32.f,32.f);
		tNetPacket.r_float_q8		(State.linear_vel.y,-32.f,32.f);
		tNetPacket.r_float_q8		(State.linear_vel.z,-32.f,32.f);
	}
	else
		State.linear_vel.set		(0.f,0.f,0.f);
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:41,代码来源:xrServer_Objects_ALife_Items.cpp

示例7: ID_to_client

void xrServer::Process_update(NET_Packet& P, ClientID sender)
{
	xrClientData* CL		= ID_to_client(sender);
	R_ASSERT2				(CL,"Process_update client not found");

	if (g_Dump_Update_Read) Msg("---- UPDATE_Read --- ");

	R_ASSERT(CL->flags.bLocal);
	// while has information
	while (!P.r_eof())
	{
		// find entity
		u16				ID;
		u8				size;

		P.r_u16			(ID);
		P.r_u8			(size);
		u32	_pos		= P.r_tell();
		CSE_Abstract	*E	= ID_to_entity(ID);
		
		if (E) {
			//Msg				("sv_import: %d '%s'",E->ID,E->name_replace());
			E->net_Ready	= TRUE;
			E->UPDATE_Read	(P);

			u32 cp = P.r_tell();
			if (g_Dump_Update_Read) Msg("* %s : %d - %d", E->name(), size, cp - _pos);

			if ((cp - _pos) != size)	{
				string16	tmp;
				CLSID2TEXT	(E->m_tClassID,tmp);
				Msg("* size = %d, start read = %d, end read = %d", size, _pos, cp);
				Debug.fatal	(DEBUG_INFO,"Beer from the creator of '%s', version of object = %d", tmp, E->m_wVersion);				
			}
		}
		else
			P.r_advance	(size);
	}
	if (g_Dump_Update_Read) Msg("-------------------- ");

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

示例8: R_ASSERT2

void CUIGameCTA::ShowBuyMenu()
{
    if (Level().IsDemoPlay())
        return;
    R_ASSERT2(m_pCurBuyMenu, "buy menu not initialized");
    if (!m_pCurBuyMenu->IsShown())
    {
        m_pCurBuyMenu->IgnoreMoneyAndRank(m_game->InWarmUp());

        m_pCurBuyMenu->ResetItems();
        m_pCurBuyMenu->SetupPlayerItemsBegin();

        SetPlayerItemsToBuyMenu();
        SetPlayerParamsToBuyMenu();

        m_pCurBuyMenu->SetupPlayerItemsEnd();

        m_pCurBuyMenu->ShowDialog(true);
        m_game->OnBuyMenuOpen();
    }
}
开发者ID:Frankie-666,项目名称:xray-16,代码行数:21,代码来源:UIGameCTA.cpp

示例9: RunStartupAnim

void CPhysicObject::RunStartupAnim(CSE_Abstract *D)
{
	if(Visual()&&smart_cast<IKinematics*>(Visual()))
	{
		//		CSE_PHSkeleton	*po	= smart_cast<CSE_PHSkeleton*>(D);
		IKinematicsAnimated*	PKinematicsAnimated=NULL;
		R_ASSERT			(Visual()&&smart_cast<IKinematics*>(Visual()));
		PKinematicsAnimated	=smart_cast<IKinematicsAnimated*>(Visual());
		if(PKinematicsAnimated)
		{
			CSE_Visual					*visual = smart_cast<CSE_Visual*>(D);
			R_ASSERT					(visual);
			R_ASSERT2					(*visual->startup_animation,"no startup animation");
	
			VERIFY2( (!!PKinematicsAnimated->LL_MotionID( visual->startup_animation.c_str() ) .valid() ) , ( make_string(" animation %s not faund ",visual->startup_animation.c_str() ) + dbg_object_base_dump_string( this )).c_str() );
			m_anim_blend				= m_anim_script_callback.play_cycle( PKinematicsAnimated, visual->startup_animation );
		}
		smart_cast<IKinematics*>(Visual())->CalculateBones_Invalidate();
		smart_cast<IKinematics*>(Visual())->CalculateBones	(TRUE);
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:21,代码来源:PhysicObject.cpp

示例10: while

void message_filter::check_new_data	(NET_Packet & packet)
{
	u32			tmp_old_pos = packet.r_tell();
	
	msg_type_subtype_t	packet_mtype;
	packet_mtype.import	(packet);


	if (packet_mtype.msg_type == M_EVENT_PACK)
	{
		NET_Packet tmp_packet;
		while (!packet.r_eof())
		{
			tmp_packet.B.count = packet.r_u8();
			packet.r	(tmp_packet.B.data, tmp_packet.B.count);
			packet_mtype.import(tmp_packet);
			
			R_ASSERT2(packet_mtype.msg_type != M_EVENT_PACK, "M_EVENT_PACK in M_EVENT_PACK");
			dbg_print_msg	(tmp_packet, packet_mtype);

			filters_map_t::iterator tmp_iter = m_filters.find(packet_mtype);
			if (tmp_iter != m_filters.end())
			{
				tmp_iter->second(packet_mtype.msg_type,
					packet_mtype.msg_subtype,
					tmp_packet);
			}
		}
	} else {
		dbg_print_msg			(packet, packet_mtype);
		filters_map_t::iterator tmp_iter = m_filters.find(packet_mtype);
		if (tmp_iter != m_filters.end())
		{
			tmp_iter->second(packet_mtype.msg_type,
				packet_mtype.msg_subtype,
				packet);
		}
	}
	packet.r_seek	(tmp_old_pos);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:40,代码来源:Message_Filter.cpp

示例11: LoadLibrary

void CEngine::Initialize(void)
{
	// Other stuff
	string_path              fn;
    strconcat               (sizeof(fn),fn,UI->EditorName(),".log");
    FS.update_path			(fn,_local_root_,fn);

#ifdef _EDITOR
	// Bind PSGP
	ZeroMemory				(&PSGP,sizeof(PSGP));
	hPSGP		            = LoadLibrary("xrCPU_Pipe.dll");
	R_ASSERT2	            (hPSGP,"Can't find 'xrCPU_Pipe.dll'");

	xrBinder* bindCPU	    = (xrBinder*)GetProcAddress(hPSGP,"xrBind_PSGP");	R_ASSERT(bindCPU);
	bindCPU		            (&PSGP, CPU::ID.feature /*& CPU::ID.os_support*/);
    // for compliance with editor
    PSGP.skin1W				= xrSkin1W_x86;
    PSGP.skin2W				= xrSkin2W_x86;
#endif

	ReloadSettings			();
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:22,代码来源:Engine.cpp

示例12: switch

void CUIBagWnd::OnBackClick(){
	int iGroup;

	switch (GetMenuLevel())
	{
	case mlRoot:
		R_ASSERT2(false,"error: CUIBagWnd on level <mlRoot> can't handle OnBackClick");
		break;
	case mlBoxes:
		ShowSectionEx(-1);
		break;
	case mlWpnSubType:		
		iGroup = GetCurrentGroupIndex();
		if (iGroup >= GROUP_31 && iGroup <= GROUP_34 )
			ShowSectionEx(GROUP_BOXES);
		else
			ShowSectionEx(-1);
		break;
	default:
		NODEFAULT;
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:22,代码来源:UIBagWnd.cpp

示例13: FileDecompress

void* FileDecompress(const char* fn, const char* sign, u32* size)
{
    MARK M, F;
    mk_mark(M, sign);

    int H = open(fn, O_BINARY | O_RDONLY);
    R_ASSERT2(H > 0, fn);
    _read(H, &F, 8);
    if (strncmp(M, F, 8) != 0)
    {
        F[8] = 0;
        Msg("FATAL: signatures doesn't match, file(%s) / requested(%s)", F, sign);
    }
    R_ASSERT(strncmp(M, F, 8) == 0);

    void* ptr = 0;
    u32 SZ;
    SZ = _readLZ(H, ptr, filelength(H) - 8);
    _close(H);
    if (size) *size = SZ;
    return ptr;
}
开发者ID:BubbaXXX,项目名称:xray-16,代码行数:22,代码来源:FS.cpp

示例14: xr_delete

const CUILine* CUILine::CutWord(CGameFont* pFont, float length){
	xr_delete(m_tmpLine);
	m_tmpLine = xr_new<CUILine>();

	float len = 0;

	for (u32 i= 0; i<m_subLines[0].m_text.length(); i++)
	{
		float ll = pFont->SizeOf_(m_subLines[0].m_text[i]);
		UI()->ClientToScreenScaledWidth(ll);
		len += ll;

		if (len>length){
			m_tmpLine->AddSubLine(m_subLines[0].Cut2Pos((i?i:1)-1));
			return m_tmpLine;
		}
	}

	R_ASSERT2(false, "meaningless call of CUILine::CutWord() ):");

	return m_tmpLine;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:22,代码来源:UILine.cpp

示例15: PHGetLinearVell

void CWeaponPistol::OnShot		()
{
	PlaySound		(m_sSndShotCurrent.c_str(),get_LastFP());

	AddShotEffector	();
	
	PlayAnimShoot	();

	// Shell Drop
	Fvector vel; 
	PHGetLinearVell(vel);
	OnShellDrop					(get_LastSP(),  vel);

	// ќгонь из ствола
	
	StartFlameParticles	();
	R_ASSERT2(!m_pFlameParticles || !m_pFlameParticles->IsLooped(),
			  "can't set looped particles system for shoting with pistol");
	
	//дым из ствола
	StartSmokeParticles	(get_LastFP(), vel);
}
开发者ID:2asoft,项目名称:xray,代码行数:22,代码来源:WeaponPistol.cpp


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