本文整理汇总了C++中IsInBag函数的典型用法代码示例。如果您正苦于以下问题:C++ IsInBag函数的具体用法?C++ IsInBag怎么用?C++ IsInBag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsInBag函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUInt64Value
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid)
{
if(!Item::LoadFromDB(guid, owner_guid))
return false;
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (uint32 i = 0; i < GetProto()->ContainerSlots; i++)
{
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
if (m_bagslot[i])
{
delete m_bagslot[i];
m_bagslot[i] = NULL;
}
}
if(!IsInBag()) // equiped bag
{
QueryResult *result = sDatabase.PQuery("SELECT `slot`,`item`,`item_template` FROM `character_inventory` WHERE `guid` = '%u' AND `bag` = '%u'", GUID_LOPART(GetOwnerGUID()), GetGUIDLow());
if (result)
{
do
{
Field *fields = result->Fetch();
uint8 slot = fields[0].GetUInt8();
uint32 item_guid = fields[1].GetUInt32();
uint32 item_id = fields[2].GetUInt32();
ItemPrototype const *proto = objmgr.GetItemPrototype(item_id);
if(!proto)
{
sLog.outError( "Bag::LoadFromDB: Player %d have unknown item (id: #%u) in bag #%u, skipped.", GUID_LOPART(GetOwnerGUID()), item_id, GetSlot());
continue;
}
Item *item = NewItemOrBag(proto);
item->SetSlot(NULL_SLOT);
if(!item->LoadFromDB(item_guid, owner_guid))
{
delete item;
continue;
}
StoreItem( slot, item, true );
item->SetState(ITEM_UNCHANGED);
} while (result->NextRow());
delete result;
}
}
return true;
}
示例2: GetItemBySectoin
CUICellItem* CUIBagWnd::GetItemBySectoin(const shared_str& sectionName, bool bCreateOnFail){
u32 sz = m_allItems.size();
for (u32 i = 0; i < sz; i++)
{
CInventoryItem* iitem = (CInventoryItem*)m_allItems[i]->m_pData;
if( iitem->object().cNameSect() == sectionName )
{
if (IsInBag(m_allItems[i]))
return m_allItems[i];
}
}
return NULL;
}
示例3: CanBuy
bool CUIBagWnd::CanBuy(CUICellItem* itm)
{
VERIFY (itm);
if (!IsInBag(itm))
return false;
CInventoryItem* iitm = (CInventoryItem*)itm->m_pData;
if (m_bIgnoreMoney)
{
if (m_bIgnoreRank)
return true;
else if (g_mp_restrictions.IsAvailable(iitm->object().cNameSect()))
return true;
}
else if (m_bIgnoreRank)
{
if (m_info[itm->m_index].price < m_money)
return true;
}
return m_info[itm->m_index].active && (!m_info[itm->m_index].bought);
}
示例4: UpdateBuyPossibility
void CUIBagWnd::UpdateBuyPossibility()
{
u32 sz = m_allItems.size();
for (u32 i = 0; i<sz; i++)
{
if (IsInBag(m_allItems[i]))
{
if (m_info[m_allItems[i]->m_index].bought)
{
m_allItems[i]->SetColor(0x00ffffff);
}
else if (UpdateRank(m_allItems[i])) // update price if there no restriction for rank
{
if (UpdatePrice(m_allItems[i], i))
{
if (m_info[i].external)
SET_EXTERNAL_COLOR(m_allItems[i]);
}
}
}
}
}
示例5: IsEquipped
bool Item::IsEquipped() const
{
return !IsInBag() && m_slot < EQUIPMENT_SLOT_END;
}
示例6: switch
bool CUIBagWnd::OnKeyboard(int dik, EUIMessages keyboard_action)
{
int iGroup;
if (DIK_ESCAPE == dik)
{
m_btnBack.OnClick();
return true;
}
switch (GetMenuLevel())
{
case mlRoot:
R_ASSERT2(false,"error: CUIBagWnd on level <mlRoot> can't handle keyboard");
break;
case mlBoxes:
if (DIK_ESCAPE == dik)
{
ShowSectionEx(-1); return true;
}
switch (dik)
{
case DIK_1:
OnBtnShotgunsClicked(); return true;
case DIK_2:
OnBtnMachinegunsClicked(); return true;
case DIK_3:
OnBtnSniperClicked(); return true;
case DIK_4:
OnBtnHeavyClicked(); return true;
}
break;
case mlWpnSubType:
iGroup = GetCurrentGroupIndex();
if (DIK_ESCAPE == dik)
{
if (iGroup >= GROUP_31 && iGroup <= GROUP_34 )
ShowSectionEx(GROUP_BOXES);
else
ShowSectionEx(-1);
return true;
}
if (dik <= DIK_0 && dik >= DIK_1)
{
CUICellItem* itm = GetItemByKey(dik,GetCurrentGroupIndex());
if (itm && IsInBag(itm))
itm->GetMessageTarget()->SendMessage(itm, DRAG_DROP_ITEM_DB_CLICK, NULL);
}
break;
default:
NODEFAULT;
}
return false;
}