コード例 #1
0
ファイル: UIZoneMap.cpp プロジェクト: AntonioModer/xray-16
void CUIZoneMap::Update()
{
	CActor* pActor = smart_cast<CActor*>( Level().CurrentViewEntity() );
	if ( !pActor ) return;

	if ( !( Device.dwFrame % 20 ) && IsGameTypeSingle() )
	{
		string16	text_str;
		xr_strcpy( text_str, sizeof(text_str), "" );

		CPda* pda = pActor->GetPDA();
		if ( pda )
		{
			u32 cn = pda->ActiveContactsNum();
			if ( cn > 0 )
			{
				xr_sprintf( text_str, sizeof(text_str), "%d", cn );
			}
		}
		m_Counter_text.SetText( text_str );
	}

	UpdateRadar( Device.vCameraPosition );
	float h, p;
	Device.vCameraDirection.getHP( h, p );
	SetHeading( -h );

	m_clock_wnd->TextItemControl()->SetText( InventoryUtilities::GetGameTimeAsString( InventoryUtilities::etpTimeToMinutes ).c_str() );
}
コード例 #2
0
bool CAI_Stalker::tradable_item					(CInventoryItem *inventory_item, const u16 &current_owner_id)
{
	if (!inventory_item->useful_for_NPC())
		return			(false);

	if (CLSID_DEVICE_PDA == inventory_item->object().CLS_ID) {
		CPda			*pda = smart_cast<CPda*>(inventory_item);
		VERIFY			(pda);
		if (pda->GetOriginalOwnerID() == current_owner_id)
			return		(false);
	}

	return				(
		trade_parameters().enabled(
			CTradeParameters::action_sell(0),
			inventory_item->object().cNameSect()
		)
	);
}
コード例 #3
0
void CInventoryOwner::sell_useless_items		()
{
	CGameObject					*object = smart_cast<CGameObject*>(this);

	TIItemContainer::iterator	I = inventory().m_all.begin();
	TIItemContainer::iterator	E = inventory().m_all.end();
	for ( ; I != E; ++I) {
		if ((*I)->object().CLS_ID == CLSID_IITEM_BOLT)
			continue;

		if ((*I)->object().CLS_ID == CLSID_DEVICE_PDA) {
			CPda				*pda = smart_cast<CPda*>(*I);
			VERIFY				(pda);
			if (pda->GetOriginalOwnerID() == object->ID())
				continue;
		}

		(*I)->object().DestroyObject();
	}
}
コード例 #4
0
ファイル: InventoryOwner.cpp プロジェクト: vasilenkomike/xray
void CInventoryOwner::sell_useless_items		()
{
    CGameObject					*object = smart_cast<CGameObject*>(this);

    TIItemContainer::iterator	I = inventory().m_all.begin();
    TIItemContainer::iterator	E = inventory().m_all.end();
    for ( ; I != E; ++I) {
        if ( smart_cast<CBolt*>( *I ) )
        {
            continue;
        }

        CPda* pda = smart_cast<CPda*>( *I );
        if ( pda )
        {
            if (pda->GetOriginalOwnerID() == object->ID())
            {
                continue;
            }
        }
        (*I)->SetDropManual(FALSE);
        (*I)->object().DestroyObject();
    }
}