forked from Mirrorlandia_minetest/minetest
Inventory: skip redundant stack movement
The list of dragged stacks includes the source stack, which however does not need to be moved onto itself. This is an optimization.
This commit is contained in:
parent
0ba899e239
commit
bf9f831cb2
@ -4447,6 +4447,12 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
|
|||||||
if (m_left_drag_stacks.size() > 1) {
|
if (m_left_drag_stacks.size() > 1) {
|
||||||
// Finalize the left-dragging
|
// Finalize the left-dragging
|
||||||
for (auto &ds : m_left_drag_stacks) {
|
for (auto &ds : m_left_drag_stacks) {
|
||||||
|
if (ds.first == *m_selected_item) {
|
||||||
|
// This entry is needed to properly calculate the stack sizes.
|
||||||
|
// The stack already exists, hence no further action needed here.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Check how many items we should move to this slot,
|
// Check how many items we should move to this slot,
|
||||||
// it may be less than the full split
|
// it may be less than the full split
|
||||||
Inventory *inv_to = m_invmgr->getInventory(ds.first.inventoryloc);
|
Inventory *inv_to = m_invmgr->getInventory(ds.first.inventoryloc);
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const ItemSpec& other)
|
bool operator==(const ItemSpec& other) const
|
||||||
{
|
{
|
||||||
return inventoryloc == other.inventoryloc &&
|
return inventoryloc == other.inventoryloc &&
|
||||||
listname == other.listname && i == other.i;
|
listname == other.listname && i == other.i;
|
||||||
|
Loading…
Reference in New Issue
Block a user