void SetItemAddonsState_ext(SBuyItemInfo* item, u8 addons) { CInventoryItem* item_ = (CInventoryItem*)item->m_cell_item->m_pData; CWeapon* w = smart_cast<CWeapon*>(item_); if(!w) return; w->SetAddonsState (addons); }
bool CUIMpTradeWnd::AttachAddon(SBuyItemInfo* itm, item_addon_type at) { VERIFY (!IsAddonAttached(itm,at)); CInventoryItem* item_ = (CInventoryItem*)itm->m_cell_item->m_pData; CWeapon* w = smart_cast<CWeapon*>(item_); R_ASSERT (w); u8 curr_addon_state = w->GetAddonsState(); curr_addon_state |= at; w->SetAddonsState (curr_addon_state); return true; }
SBuyItemInfo* CUIMpTradeWnd::DetachAddon(SBuyItemInfo* itm, item_addon_type at) { VERIFY (IsAddonAttached(itm,at)); CInventoryItem* item_ = (CInventoryItem*)itm->m_cell_item->m_pData; CWeapon* w = smart_cast<CWeapon*>(item_); R_ASSERT (w); u8 curr_addon_state = w->GetAddonsState(); curr_addon_state &= ~at; shared_str addon_name_sect = GetAddonNameSect(itm, at); w->SetAddonsState (curr_addon_state); SBuyItemInfo* detached_addon = CreateItem(addon_name_sect, SBuyItemInfo::e_own, false); return detached_addon; }