示例#1
0
void CGrenade::PutNextToSlot()
{
	if (OnClient()) return;

	VERIFY									(!getDestroy());
	//выкинуть гранату из инвентар¤
	NET_Packet						P;
	if (m_pInventory)
	{
		m_pInventory->Ruck					(this);

		this->u_EventGen				(P, GEG_PLAYER_ITEM2RUCK, this->H_Parent()->ID());
		P.w_u16							(this->ID());
		this->u_EventSend				(P);
	}
	else
		Msg ("! PutNextToSlot : m_pInventory = NULL [%d][%d]", ID(), Device.dwFrame);	

	if (smart_cast<CInventoryOwner*>(H_Parent()) && m_pInventory)
	{
		CGrenade *pNext						= smart_cast<CGrenade*>(	m_pInventory->Same(this,true)		);
		if(!pNext) pNext					= smart_cast<CGrenade*>(	m_pInventory->SameSlot(GRENADE_SLOT, this, true)	);

		VERIFY								(pNext != this);

		if(pNext && m_pInventory->Slot(pNext->BaseSlot(),pNext) )
		{
			pNext->u_EventGen				(P, GEG_PLAYER_ITEM2SLOT, pNext->H_Parent()->ID());
			P.w_u16							(pNext->ID());
			P.w_u16							(pNext->BaseSlot());
			pNext->u_EventSend				(P);
			m_pInventory->SetActiveSlot		(pNext->BaseSlot());
		}else
		{
			CActor* pActor = smart_cast<CActor*>( m_pInventory->GetOwner());
			
			if(pActor)
				pActor->OnPrevWeaponSlot();
		}

		m_thrown				= false;
	}
}
示例#2
0
void CGrenade::PutNextToSlot()
{
	if (OnClient()) return;
	VERIFY									(!getDestroy());

	//выкинуть гранату из инвентар¤
	if (m_pCurrentInventory)
	{
		NET_Packet						P;
		m_pCurrentInventory->Ruck		(this);
#if defined(GRENADE_FROM_BELT)
		this->u_EventGen				(P, GEG_PLAYER_ITEM2BELT, this->H_Parent()->ID());
#else
		this->u_EventGen				(P, GEG_PLAYER_ITEM2RUCK, this->H_Parent()->ID());
#endif
		P.w_u16							(this->ID());
		this->u_EventSend				(P);
#if defined(GRENADE_FROM_BELT)
		CGrenade *pNext					= smart_cast<CGrenade*>(	m_pCurrentInventory->Same(this,false)		);
		if(!pNext) 
			pNext						= smart_cast<CGrenade*>(	m_pCurrentInventory->SameSlot(GRENADE_SLOT, this, false)	);
#else
		CGrenade *pNext					= smart_cast<CGrenade*>(	m_pCurrentInventory->Same(this,true)		);
		if(!pNext) 
			pNext						= smart_cast<CGrenade*>(	m_pCurrentInventory->SameSlot(GRENADE_SLOT, this, true)	);
#endif

		VERIFY							(pNext != this);

		if(pNext && m_pCurrentInventory->Slot(pNext) )
		{
			pNext->u_EventGen			(P, GEG_PLAYER_ITEM2SLOT, pNext->H_Parent()->ID());
			P.w_u16						(pNext->ID());
			pNext->u_EventSend			(P);
			m_pCurrentInventory->SetActiveSlot(pNext->GetSlot());
		}
/////	m_thrown				= false;
	}
}
示例#3
0
void CGrenade::PutNextToSlot()
{
	if (OnClient()) return;
//	Msg ("* PutNextToSlot : %d", ID());	
	VERIFY									(!getDestroy());
	//выкинуть гранату из инвентар¤
	NET_Packet						P;
	if (m_pInventory)
	{
		m_pInventory->Ruck					(this);
//.		m_pInventory->SetActiveSlot			(NO_ACTIVE_SLOT);

		this->u_EventGen				(P, GEG_PLAYER_ITEM2RUCK, this->H_Parent()->ID());
		P.w_u16							(this->ID());
		this->u_EventSend				(P);
	}
	else
		Msg ("! PutNextToSlot : m_pInventory = 0");	

	if (smart_cast<CInventoryOwner*>(H_Parent()) && m_pInventory)
	{
		CGrenade *pNext						= smart_cast<CGrenade*>(	m_pInventory->Same(this,true)		);
		if(!pNext) pNext					= smart_cast<CGrenade*>(	m_pInventory->SameSlot(this,true)	);

		VERIFY								(pNext != this);

		if(pNext && m_pInventory->Slot(pNext) ){

			pNext->u_EventGen				(P, GEG_PLAYER_ITEM2SLOT, pNext->H_Parent()->ID());
			P.w_u16							(pNext->ID());
			pNext->u_EventSend				(P);
//			if(IsGameTypeSingle())			
				m_pInventory->SetActiveSlot			(pNext->GetSlot());
		}

		m_thrown				= false;
	}
}