コード例 #1
0
BYTE CVehicleManager::New(BYTE byteVehicleType,
					   Vector3 * vecPos, float fRotation,
					   int iColor1, int iColor2)
{
	BYTE vehicleID = GetFreeSlot();
	if(New(vehicleID, byteVehicleType, vecPos, fRotation, iColor1, iColor2))
		return vehicleID;

	return false;
}
コード例 #2
0
ファイル: Queue.cpp プロジェクト: Jeanhwea/WindowsViaCPP
void CQueue::AddElement(ELEMENT e) {

   // Do nothing if the queue is full
   int nFreeSlot = GetFreeSlot();
   if (nFreeSlot == -1)
      return;

   // Copy the content of the element
   m_pElements[nFreeSlot].m_element = e;

   // Mark the element with the new stamp
   m_pElements[nFreeSlot].m_nStamp = ++m_nCurrentStamp;
}
コード例 #3
0
ファイル: inventorywindow.cpp プロジェクト: huigou/planeshift
void pawsInventoryWindow::Dequip( const char* itemName )
{
    pawsListBox* bulkList = dynamic_cast <pawsListBox*> (FindWidget("BulkList"));
    if ( (itemName != NULL) && (bulkList) )
    {
        pawsSlot* fromSlot = NULL;
        // See if we can find the item in the equipment slots.
        for ( size_t z = 0; z < equipmentSlots.GetSize(); z++ )
        {
            if ( equipmentSlots[z] && !equipmentSlots[z]->IsEmpty() )
            {
                csString tip(equipmentSlots[z]->GetToolTip());
                if ( tip.CompareNoCase(itemName) )
                {
                    fromSlot = equipmentSlots[z];
                    break;
                }
            }
        }

        if ( fromSlot == NULL ) // if item was not found, look in slotnames
            fromSlot = dynamic_cast <pawsSlot*> (FindWidget(itemName));

        if ( fromSlot )
        {
            int container   = fromSlot->ContainerID();
            int slot        = fromSlot->ID();
            int stackCount  = fromSlot->StackCount();

            pawsSlot* freeSlot = GetFreeSlot();
            if ( freeSlot )
            {

                // Move from the equipped slot to an empty slot
                // this message isn't being processed until after all the 'dequip' messages are generated...
                psSlotMovementMsg msg( container, slot,
                                       freeSlot->ContainerID() ,
                                       freeSlot->ID(),
                                       stackCount );
                freeSlot->Reserve();
                msg.SendMessage();
                fromSlot->Clear();
            }
        }
    }
}
コード例 #4
0
ファイル: Queue.cpp プロジェクト: Jeanhwea/WindowsViaCPP
BOOL CQueue::IsFull() {
   
   return(GetFreeSlot() == -1);
}