示例#1
0
void AutoCalculateItemNoOverwriteStatus()
{
    SOLDIERINITNODE *curr;
    OBJECTTYPE *pItem;

    //Recalculate the "no overwrite" status flag on all items.	There are two different cases:
    //1)	If detailed placement has item, the item "no overwrite" flag is set
    //2)	If detailed placement doesn't have item, but item is set to drop (forced empty slot), the "no overwrite" flag is set.
    curr = gSoldierInitHead;
    while( curr )
    {
        if( curr->pDetailedPlacement )
        {
            for( UINT32 i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ )
            {
                pItem = &curr->pDetailedPlacement->Inv[ i ];
                if( pItem->exists() == true )
                {   //case 1 (see above)
                    (*pItem).fFlags |= OBJECT_NO_OVERWRITE;
                }
                else if( !((*pItem).fFlags & OBJECT_UNDROPPABLE) )
                {   //case 2 (see above)
                    (*pItem).fFlags |= OBJECT_NO_OVERWRITE;
                }
            }
        }
        curr = curr->next;
    }
}
示例#2
0
INT32 FindWorldItemForBuriedBombInGridNo( INT32 sGridNo, INT8 bLevel )
{
    UINT32                                  uiBombIndex;
    OBJECTTYPE* pObj = NULL;

    for (uiBombIndex = 0; uiBombIndex < guiNumWorldBombs; uiBombIndex++)
    {
        if (gWorldBombs[ uiBombIndex ].fExists &&
                gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].sGridNo == sGridNo &&
                gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].ubLevel == bLevel )
        {
            pObj=&gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].object;
            if( pObj && pObj->exists() )
                //if ( ( (*pObj)[0]->data.misc.bDetonatorType != BOMB_TIMED ) && ( (*pObj)[0]->data.misc.bDetonatorType != BOMB_REMOTE ) )
                if( !HasAttachmentOfClass( pObj, AC_REMOTEDET | AC_DETONATOR ) )
                    return( gWorldBombs[ uiBombIndex ].iItemIndex );
        }
    }
    return( -1 );
}