本文整理汇总了C++中CShipClass::GetMaxNonWeapons方法的典型用法代码示例。如果您正苦于以下问题:C++ CShipClass::GetMaxNonWeapons方法的具体用法?C++ CShipClass::GetMaxNonWeapons怎么用?C++ CShipClass::GetMaxNonWeapons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShipClass
的用法示例。
在下文中一共展示了CShipClass::GetMaxNonWeapons方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetRegionsFromMiscDevices
//.........这里部分代码省略.........
case itemcatReactor:
pLayout = &g_MiscDevicesLayout[REACTOR_SLOT_INDEX];
bHasReactor = true;
break;
}
// Create the region (but only if we have a layout position
// for it).
if (pLayout)
{
SEntry *pEntry = m_Regions.Insert();
pEntry->iType = typeInstalledItem;
pEntry->pItemCtx = new CItemCtx(pShip, pDevice);
pEntry->iSlotPosIndex = iIndex;
pEntry->rcRect.left = pLayout->xLeft;
pEntry->rcRect.top = pLayout->yTop;
pEntry->rcRect.right = pEntry->rcRect.left + ITEM_ENTRY_WIDTH;
pEntry->rcRect.bottom = pEntry->rcRect.top + ITEM_ENTRY_HEIGHT;
}
}
// Add empty slots, if necessary
if (!bHasReactor)
{
const SLayoutDesc *pLayout = &g_MiscDevicesLayout[REACTOR_SLOT_INDEX];
SEntry *pEntry = m_Regions.Insert();
pEntry->iType = typeEmptySlot;
pEntry->iSlotType = devReactor;
pEntry->rcRect.left = pLayout->xLeft;
pEntry->rcRect.top = pLayout->yTop;
pEntry->rcRect.right = pEntry->rcRect.left + ITEM_ENTRY_WIDTH;
pEntry->rcRect.bottom = pEntry->rcRect.top + ITEM_ENTRY_HEIGHT;
}
if (!bHasDrive)
{
const SLayoutDesc *pLayout = &g_MiscDevicesLayout[DRIVE_SLOT_INDEX];
SEntry *pEntry = m_Regions.Insert();
pEntry->iType = typeEmptySlot;
pEntry->iSlotType = devDrive;
pEntry->rcRect.left = pLayout->xLeft;
pEntry->rcRect.top = pLayout->yTop;
pEntry->rcRect.right = pEntry->rcRect.left + ITEM_ENTRY_WIDTH;
pEntry->rcRect.bottom = pEntry->rcRect.top + ITEM_ENTRY_HEIGHT;
}
if (!bHasCargo)
{
const SLayoutDesc *pLayout = &g_MiscDevicesLayout[CARGO_SLOT_INDEX];
SEntry *pEntry = m_Regions.Insert();
pEntry->iType = typeEmptySlot;
pEntry->iSlotType = devCargo;
pEntry->rcRect.left = pLayout->xLeft;
pEntry->rcRect.top = pLayout->yTop;
pEntry->rcRect.right = pEntry->rcRect.left + ITEM_ENTRY_WIDTH;
pEntry->rcRect.bottom = pEntry->rcRect.top + ITEM_ENTRY_HEIGHT;
}
// Figure out how many empty weapon slots we should create. We add one
// empty slot for each weapon slot, but we subtract one if we don't have
// a launcher and we always have at least 1 empty slot, in case the player
// finds a slot-less weapon.
#ifdef SINGLE_FREE_SLOT
int iEmptySlots = 1;
#else
int iNonWeaponSlotsInUse;
int iTotalSlotsInUse = pShip->CalcDeviceSlotsInUse(NULL, &iNonWeaponSlotsInUse);
int iEmptySlots = Max(1, Min((pClass->GetMaxDevices() - iTotalSlotsInUse), (pClass->GetMaxNonWeapons() - iNonWeaponSlotsInUse)) - (bHasReactor ? 0 : 1) - (bHasDrive ? 0 : 1) - (bHasCargo ? 0 : 1));
#endif
for (i = 0; i < iEmptySlots; i++)
{
if (FindLayoutForPos(CVector(), SlotStatus, &iIndex))
{
const SLayoutDesc *pLayout = &g_MiscDevicesLayout[iIndex];
SEntry *pEntry = m_Regions.Insert();
pEntry->iType = typeEmptySlot;
pEntry->iSlotType = devNone;
pEntry->iSlotPosIndex = iIndex;
pEntry->rcRect.left = pLayout->xLeft;
pEntry->rcRect.top = pLayout->yTop;
pEntry->rcRect.right = pEntry->rcRect.left + ITEM_ENTRY_WIDTH;
pEntry->rcRect.bottom = pEntry->rcRect.top + ITEM_ENTRY_HEIGHT;
SlotStatus[iIndex] = false;
}
}
}