@@ -376,7 +376,7 @@ void CUIActorMenu::DetachAddon(LPCSTR addon_name, PIItem itm)
376376
377377void CUIActorMenu::InitCellForSlot (u16 slot_idx)
378378{
379- VERIFY (KNIFE_SLOT <= slot_idx && slot_idx <= LAST_SLOT);
379+ // VERIFY(KNIFE_SLOT <= slot_idx && slot_idx <= LAST_SLOT);
380380 PIItem item = m_pActorInvOwner->inventory ().ItemFromSlot (slot_idx);
381381 if (!item)
382382 {
@@ -414,6 +414,15 @@ void CUIActorMenu::InitInventoryContents(CUIDragDropListEx* pBagList)
414414 InitCellForSlot (GRENADE_SLOT);
415415 InitCellForSlot (HELMET_SLOT);
416416
417+ // Alundaio
418+ if (!m_pActorInvOwner->inventory ().SlotIsPersistent (KNIFE_SLOT))
419+ InitCellForSlot (KNIFE_SLOT);
420+ if (!m_pActorInvOwner->inventory ().SlotIsPersistent (BINOCULAR_SLOT))
421+ InitCellForSlot (BINOCULAR_SLOT);
422+ if (!m_pActorInvOwner->inventory ().SlotIsPersistent (ARTEFACT_SLOT))
423+ InitCellForSlot (ARTEFACT_SLOT);
424+ // -Alundaio
425+
417426 curr_list = m_pInventoryBeltList;
418427 TIItemContainer::iterator itb = m_pActorInvOwner->inventory ().m_belt .begin ();
419428 TIItemContainer::iterator ite = m_pActorInvOwner->inventory ().m_belt .end ();
@@ -494,11 +503,12 @@ bool CUIActorMenu::ToSlot(CUICellItem* itm, bool force_place, u16 slot_id)
494503 {
495504 CUIDragDropListEx* new_owner = GetSlotList (slot_id);
496505
497- if (slot_id == GRENADE_SLOT || !new_owner)
506+ // Alundaio
507+ /* if (slot_id == GRENADE_SLOT || !new_owner)
498508 {
499509 return true; // fake, sorry (((
500510 }
501- else if (slot_id == OUTFIT_SLOT)
511+ else*/ if (slot_id == OUTFIT_SLOT)
502512 {
503513 CCustomOutfit* pOutfit = smart_cast<CCustomOutfit*>(iitem);
504514 if (pOutfit && !pOutfit->bIsHelmetAvaliable )
@@ -546,15 +556,24 @@ bool CUIActorMenu::ToSlot(CUICellItem* itm, bool force_place, u16 slot_id)
546556
547557 PIItem _iitem = m_pActorInvOwner->inventory ().ItemFromSlot (slot_id);
548558 CUIDragDropListEx* slot_list = GetSlotList (slot_id);
549- VERIFY (slot_list->ItemsCount () == 1 );
559+ if (!slot_list)
560+ return false ;
550561
551- CUICellItem* slot_cell = slot_list->GetItemIdx (0 );
552- VERIFY (slot_cell && ((PIItem)slot_cell->m_pData ) == _iitem);
562+ CUIDragDropListEx* invlist = GetListByType (iActorBag);
563+ if (invlist != slot_list)
564+ {
565+ if (!slot_list->ItemsCount () == 1 )
566+ return false ;
553567
554- bool result = ToBag (slot_cell, false );
555- VERIFY (result);
568+ CUICellItem* slot_cell = slot_list->GetItemIdx (0 );
569+ if (!(slot_cell && static_cast <PIItem>(slot_cell->m_pData ) == _iitem))
570+ return false ;
556571
557- result = ToSlot (itm, false , slot_id);
572+ if (ToBag (slot_cell, false ) == false )
573+ return false ;
574+ }
575+
576+ bool result = ToSlot (itm, false , slot_id);
558577 if (b_own_item && result && slot_id == DETECTOR_SLOT)
559578 {
560579 CCustomDetector* det = smart_cast<CCustomDetector*>(iitem);
@@ -685,6 +704,10 @@ CUIDragDropListEx* CUIActorMenu::GetSlotList(u16 slot_idx)
685704
686705 case DETECTOR_SLOT: return m_pInventoryDetectorList; break ;
687706
707+ case ARTEFACT_SLOT:
708+ case BINOCULAR_SLOT:
709+ case KNIFE_SLOT:
710+
688711 case GRENADE_SLOT: // fake
689712 if (m_currMenuMode == mmTrade)
690713 {
@@ -849,7 +872,8 @@ void CUIActorMenu::PropertiesBoxForSlots(PIItem item, bool& b_show)
849872 bool bAlreadyDressed = false ;
850873 u16 cur_slot = item->BaseSlot ();
851874
852- if (!pOutfit && !pHelmet && cur_slot != NO_ACTIVE_SLOT && !inv.SlotIsPersistent (cur_slot) /* && inv.CanPutInSlot(item, cur_slot)*/ )
875+ if (!pOutfit && !pHelmet && cur_slot != NO_ACTIVE_SLOT && !inv.SlotIsPersistent (cur_slot) && m_pActorInvOwner->
876+ inventory ().ItemFromSlot (cur_slot) != item /* && inv.CanPutInSlot(item, cur_slot)*/ )
853877 {
854878 m_UIPropertiesBox->AddItem (" st_move_to_slot" , NULL , INVENTORY_TO_SLOT_ACTION);
855879 b_show = true ;
@@ -1414,15 +1438,13 @@ void CUIActorMenu::RefreshCurrentItemCell()
14141438 {
14151439 CUICellItem* parent = invlist->RemoveItem (ci, true );
14161440
1417- if (parent->ChildsCount () > 0 )
1441+ while (parent->ChildsCount ())
14181442 {
1419- while (parent->ChildsCount ())
1420- {
1421- CUICellItem* child = parent->PopChild (nullptr );
1422- invlist->SetItem (child);
1423- }
1443+ CUICellItem* child = parent->PopChild (nullptr );
1444+ invlist->SetItem (child);
14241445 }
1425- invlist->SetItem (parent);
1446+
1447+ invlist->SetItem (parent, GetUICursor ().GetCursorPosition ());
14261448 }
14271449 }
14281450}
0 commit comments