1. This forum is archived for reference. For support & bug reports visit the help section of forums.stardewvalley.net

Bug/Issue Items can be deleted with LShift + right click

Discussion in 'Support' started by TehPers, Feb 1, 2019.

  1. TehPers

    TehPers Void-Bound Voyager

    SDV Version: 1.3.33 - Windows 10

    It is possible to lose items when using LShift + right click to grab them from your inventory.

    Reproduction:

    1. Give yourself two stacks of 999 wood.
    2. LShift + right click a stack to pull 500 items from it.
    3. LShift + right click the stack of 500, then merge the 250 you grabbed with the stack of 499. You should have a stack of 749.
    4. Grab the stack of 749, then LShift + right click the stack of 999. You should be holding a stack of 999, and there should be 499 remaining in the stack you pulled items from.
    5. Combine all the stacks again. You should be missing 250 wood.

    Solution:
    In InventoryMenu.rightClick, probably somewhere near the bottom, there should be the logic for when you're holding an item. Currently, the game is adding ceil(half your inventory stack) to your held stack, and dividing the inventory stack by 2. Instead, it should look something along these lines:

    // Calculate how many should be removed without exceeding the held item's stack size
    int toRemove = Math.Min(inventoryItem.Stack / 2, heldItem.maximumStackSize() - heldItem.Stack);

    // Remove that many from the inventory stack and add it to your held item
    inventoryItem.Stack -= toRemove;
    heldItem.Stack += toRemove;
     

    Share This Page