void cWindow::OnRightPaintEnd(cPlayer & a_Player) { // Process the entire action stored in the internal structures for inventory painting // distribute one item into each slot const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots(); cItem ToDistribute(a_Player.GetDraggingItem()); int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, 1, SlotNums); // Remove the items distributed from the dragging item: a_Player.GetDraggingItem().m_ItemCount -= NumDistributed; if (a_Player.GetDraggingItem().m_ItemCount == 0) { a_Player.GetDraggingItem().Empty(); } SendWholeWindow(*a_Player.GetClientHandle()); }
void cWindow::OnLeftPaintEnd(cPlayer & a_Player) { // Process the entire action stored in the internal structures for inventory painting // distribute as many items as possible const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots(); cItem ToDistribute(a_Player.GetDraggingItem()); int ToEachSlot = (int)ToDistribute.m_ItemCount / (int)SlotNums.size(); int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, ToEachSlot, SlotNums); // Remove the items distributed from the dragging item: a_Player.GetDraggingItem().m_ItemCount -= NumDistributed; if (a_Player.GetDraggingItem().m_ItemCount == 0) { a_Player.GetDraggingItem().Empty(); } SendWholeWindow(*a_Player.GetClientHandle()); }
void cWindow::OnRightPaintEnd(cPlayer & a_Player) { // Process the entire action stored in the internal structures for inventory painting // distribute one item into each slot const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots(); cItem ToDistribute(a_Player.GetDraggingItem()); int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, 1, SlotNums); // Remove the items distributed from the dragging item: a_Player.GetDraggingItem().m_ItemCount -= NumDistributed; if (a_Player.GetDraggingItem().m_ItemCount == 0) { a_Player.GetDraggingItem().Empty(); } SendWholeWindow(*a_Player.GetClientHandle()); // To fix #2345 (custom recipes don't work when inventory-painting), we send the result slot explicitly once again // This is a fix for what seems like a client-side bug a_Player.GetClientHandle()->SendInventorySlot(m_WindowID, 0, *GetSlot(a_Player, 0)); }