Fix bag bar drag/drop with container bags

Allow equipped bags to be moved through the shared inventory pickup/drop flow, including dragging from bag contents to bag bar and back from bag bar into bag/backpack slots.

Changes:

- Add InventoryScreen APIs to begin pickup from an equipment slot and drop held item into a target equipment slot.

- Treat inventory type 18 (bags) as valid drops on BAG1-BAG4 during slot validation.

- Route equipment placement in online mode through swapContainerItems with explicit src/dst addressing for deterministic bag slot moves.

- Update bag bar hover-drop path to use InventoryScreen drop API instead of direct local slot mutation.

- On bag bar drag start, hand off to inventory held-item drag when inventory/character UI is open so drops into bag/backpack slots work.
This commit is contained in:
Kelsi 2026-02-20 17:41:19 -08:00
parent acb63d4f6e
commit 9a0415ad6b
3 changed files with 93 additions and 35 deletions

View file

@ -166,8 +166,13 @@ public:
bool isHoldingItem() const { return holdingItem; }
/// Returns the item being held (only valid when isHoldingItem() is true).
const game::ItemDef& getHeldItem() const { return heldItem; }
/// Begin pickup from an equipment slot (e.g., bag bar slot) into held cursor.
bool beginPickupFromEquipSlot(game::Inventory& inv, game::EquipSlot slot);
/// Cancel the pickup, returning the item to its original slot.
void returnHeldItem(game::Inventory& inv) { cancelPickup(inv); }
/// Drop the currently held item into a specific equipment slot.
/// Returns true if the drop was accepted and consumed.
bool dropHeldItemToEquipSlot(game::Inventory& inv, game::EquipSlot slot);
};
} // namespace ui