示例#1
0
void DeleteWorldItemsBelongingToQueenIfThere( void )
{
    UINT32	uiLoop;
    UINT32	uiLoop2;
    INT32 sGridNo;
    UINT8		ubLevel;
    INT8		bSlot;

    if ( gMercProfiles[ QUEEN ].sSectorX == gWorldSectorX &&
            gMercProfiles[ QUEEN ].sSectorY == gWorldSectorY &&
            gMercProfiles[ QUEEN ].bSectorZ == gbWorldSectorZ )
    {

        for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
        {
            // loop through all items, look for ownership
            if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == OWNERSHIP )
            {
                // if owner is the Queen
                if ( gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile == QUEEN )
                {
                    // then all items in this location should be deleted
                    sGridNo = gWorldItems[ uiLoop ].sGridNo;
                    ubLevel = gWorldItems[ uiLoop ].ubLevel;
                    for ( uiLoop2 = 0; uiLoop2 < guiNumWorldItems; uiLoop2++ )
                    {
                        // loop through all items, look for those in same tile
                        if ( gWorldItems[ uiLoop2 ].fExists && gWorldItems[ uiLoop2 ].sGridNo == sGridNo && gWorldItems[ uiLoop2 ].ubLevel == ubLevel )
                        {
                            // upgrade equipment
                            switch ( gWorldItems[ uiLoop2 ].object.usItem )
                            {
                            case AUTO_ROCKET_RIFLE:
                                bSlot = FindObjectInSoldierProfile( QUEEN, ROCKET_RIFLE );
                                if ( bSlot != NO_SLOT )
                                {
                                    // give her auto rifle
                                    gMercProfiles[ QUEEN ].inv[ bSlot ] = AUTO_ROCKET_RIFLE;
                                }
                                break;
                            case SPECTRA_HELMET_18:
                                gMercProfiles[ QUEEN ].inv[ HELMETPOS ] = SPECTRA_HELMET_18;
                                break;
                            case SPECTRA_VEST_18:
                                gMercProfiles[ QUEEN ].inv[ VESTPOS ] = SPECTRA_VEST_18;
                                break;
                            case SPECTRA_LEGGINGS_18:
                                gMercProfiles[ QUEEN ].inv[ LEGPOS ] = SPECTRA_LEGGINGS_18;
                                break;
                            default:
                                break;
                            }
                            RemoveItemFromPool( sGridNo, uiLoop2, ubLevel );
                        }
                    }
                }
            }
        }
    }
}
示例#2
0
void DeleteWorldItemsBelongingToTerroristsWhoAreNotThere( void )
{
    UINT32	uiLoop;
    UINT32	uiLoop2;
    INT32 sGridNo;
    UINT8		ubLevel;

    // only do this after Carmen has talked to player and terrorists have been placed
    //if ( CheckFact( FACT_CARMEN_EXPLAINED_DEAL, 0 ) == TRUE )
    {

        for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
        {
            // loop through all items, look for ownership
            if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == OWNERSHIP )
            {
                // if owner is a terrorist
                if ( IsProfileATerrorist( (UINT8) gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile ) )
                {
                    // and they were not set in the current sector
                    if ( gMercProfiles[ gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile ].sSectorX != gWorldSectorX ||
                            gMercProfiles[ gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile ].sSectorY != gWorldSectorY )
                    {
                        // then all items in this location should be deleted
                        sGridNo = gWorldItems[ uiLoop ].sGridNo;
                        ubLevel = gWorldItems[ uiLoop ].ubLevel;
                        for ( uiLoop2 = 0; uiLoop2 < guiNumWorldItems; uiLoop2++ )
                        {
                            // loop through all items, look for ownership
                            if ( gWorldItems[ uiLoop2 ].fExists && gWorldItems[ uiLoop2 ].sGridNo == sGridNo && gWorldItems[ uiLoop2 ].ubLevel == ubLevel )
                            {
                                RemoveItemFromPool( sGridNo, uiLoop2, ubLevel );
                            }
                        }
                    }
                }
            }
        }
    }
    // else the terrorists haven't been placed yet!
}
示例#3
0
void TrashWorldItems()
{
    UINT32 i;
    if( !gWorldItems.empty() )//dnl ch75 271013
    {
        for( i = 0; i < guiNumWorldItems; i++ )
        {
            if( gWorldItems[ i ].fExists )
            {
                RemoveItemFromPool( gWorldItems[ i ].sGridNo, i, gWorldItems[ i ].ubLevel );
            }
        }
#ifdef INVFIX_Moa//dnl ch75 311013
        gWorldItems.clear();
#endif
    }
    if ( gWorldBombs )
    {
        MemFree( gWorldBombs );
        gWorldBombs = NULL;
        guiNumWorldBombs = 0;
    }
}
示例#4
0
void DeleteSelectedItem()
{
	SpecifyItemToEdit( NULL, -1 );
	//First, check to see if there even is a currently selected item.
	if( iCurrentTaskbar == TASK_MERCS )
	{
		DeleteSelectedMercsItem();
		return;
	}
	if( gpItemPool )
	{ //Okay, we have a selected item...
		INT32 sGridNo;
		//save the mapindex
		if( gpItemPool->pNext )
		{
			SpecifyItemToEdit( &gWorldItems[ gpItemPool->pNext->iItemIndex ].object, gpItemPool->sGridNo );
		}
		sGridNo = gpItemPool->sGridNo;
		//remove the item
		if( gWorldItems[ gpItemPool->iItemIndex ].object.usItem == ACTION_ITEM )
		{
			if( gWorldItems[ gpItemPool->iItemIndex ].object[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT )
				Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
			else if( gWorldItems[ gpItemPool->iItemIndex ].object[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT )
				Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
		}
		if( gpEditingItemPool == gpItemPool )
			gpEditingItemPool = NULL;
		RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 );
		gpItemPool = NULL;
		//determine if there are still any items at this location
		if( !GetItemPoolFromGround( sGridNo, &gpItemPool ) )
		{ //no items left, so remove the node from the list.
			IPListNode *pIPPrev, *pIPCurr;
			pIPCurr = pIPHead;
			pIPPrev = NULL;
			while( pIPCurr )
			{
				if( pIPCurr->sGridNo == sGridNo )
				{
					if( pIPPrev ) //middle of list
						pIPPrev->next = pIPCurr->next;
					else //head of list
						pIPHead = pIPHead->next;
					//move the curr item pool to the next one.
					if( pIPCurr->next )
						gpCurrItemPoolNode = pIPCurr->next;
					else
						gpCurrItemPoolNode = pIPHead;
					if( gpCurrItemPoolNode )
					{
						GetItemPoolFromGround( gpCurrItemPoolNode->sGridNo, &gpItemPool );
						Assert( gpItemPool );
					}
					//remove node
					HideItemCursor( sGridNo );
					MemFree( pIPCurr );
					pIPCurr = NULL;
					return;
				}
				pIPPrev = pIPCurr;
				pIPCurr = pIPCurr->next;
			}
		}
	}
}