@@ -421,6 +421,8 @@ void CUIActorMenu::InitInventoryContents(CUIDragDropListEx* pBagList)
421421 InitCellForSlot (BINOCULAR_SLOT);
422422 if (!m_pActorInvOwner->inventory ().SlotIsPersistent (ARTEFACT_SLOT))
423423 InitCellForSlot (ARTEFACT_SLOT);
424+ if (!m_pActorInvOwner->inventory ().SlotIsPersistent (PDA_SLOT))
425+ InitCellForSlot (PDA_SLOT);
424426 if (!m_pActorInvOwner->inventory ().SlotIsPersistent (TORCH_SLOT))
425427 InitCellForSlot (TORCH_SLOT); // Alundaio: TODO find out why this crash when you unequip
426428 // -Alundaio
@@ -586,8 +588,24 @@ bool CUIActorMenu::ToSlot(CUICellItem* itm, bool force_place, u16 slot_id)
586588 }
587589 else
588590 {
589- SendEvent_Item2Slot (iitem, m_pActorInvOwner->object_id (), slot_id);
590- SendEvent_ActivateSlot (slot_id, m_pActorInvOwner->object_id ());
591+ // Alundaio: Since the player's inventory is being used as a slot we need to search for cell with matching m_pData
592+ CUICellContainer* c = slot_list->GetContainer ();
593+ WINDOW_LIST child_list = c->GetChildWndList ();
594+ // XXX: try to replace with range-based for
595+ for (WINDOW_LIST::iterator it = child_list.begin (); child_list.end () != it; ++it)
596+ {
597+ CUICellItem* i = static_cast <CUICellItem*>(*it);
598+ const PIItem pitm = static_cast <PIItem>(i->m_pData );
599+ if (pitm == _iitem)
600+ {
601+ if (ToBag (i, false ))
602+ break ;
603+
604+ return false ;
605+ }
606+ }
607+
608+ return ToSlot (itm, false , slot_id);
591609 }
592610
593611 bool result = ToSlot (itm, false , slot_id);
@@ -721,6 +739,8 @@ CUIDragDropListEx* CUIActorMenu::GetSlotList(u16 slot_idx)
721739
722740 case DETECTOR_SLOT: return m_pInventoryDetectorList; break ;
723741
742+ case PDA_SLOT:
743+ case TORCH_SLOT:
724744 case ARTEFACT_SLOT:
725745 case BINOCULAR_SLOT:
726746 case KNIFE_SLOT:
0 commit comments