Fix shutdown hangs, bank bag icons/drag-drop, loading screen progress, and login spawn

- Fix shutdown hang: skip vmaDestroyAllocator (walked thousands of allocations),
  replace unsafe pthread_timedjoin_np with plain join + early-exit checks in workers
- Bank window: full icon rendering, click-and-hold pickup (0.10s), drag-drop for
  all bank slots including bank bag equip slots, same-slot drop detection
- Loading screen: process one tile per frame for live progress updates
- Camera reset: trust server position in online mode to avoid spawning under WMOs
- Fix PLAYER_BYTES/PLAYER_BYTES_2 field indices, preserve purchasedBankBagSlots
  across inventory rebuilds, fix bank slot purchase result codes
This commit is contained in:
Kelsi 2026-02-26 13:38:29 -08:00
parent 804b947203
commit a559d5944b
14 changed files with 489 additions and 146 deletions

View file

@ -89,8 +89,11 @@ public:
const ItemSlot& getBankBagSlot(int bagIndex, int slotIndex) const;
bool setBankBagSlot(int bagIndex, int slotIndex, const ItemDef& item);
bool clearBankBagSlot(int bagIndex, int slotIndex);
int getBankBagSize(int bagIndex) const;
void setBankBagSize(int bagIndex, int size);
const ItemSlot& getBankBagItem(int bagIndex) const;
void setBankBagItem(int bagIndex, const ItemDef& item);
uint8_t getPurchasedBankBagSlots() const { return purchasedBankBagSlots_; }
void setPurchasedBankBagSlots(uint8_t count) { purchasedBankBagSlots_ = count; }
@ -111,6 +114,7 @@ private:
struct BagData {
int size = 0;
ItemSlot bagItem; // The bag item itself (for icon/name/tooltip)
std::array<ItemSlot, MAX_BAG_SIZE> slots{};
};
std::array<BagData, NUM_BAG_SLOTS> bags{};

View file

@ -212,6 +212,7 @@ public:
* Unload all tiles
*/
void unloadAll();
void stopWorkers(); // Stop worker threads without restarting (for shutdown)
void softReset(); // Clear tile data without stopping worker threads (non-blocking)
/**
@ -262,6 +263,9 @@ public:
/** Process all ready tiles immediately (use during loading screens) */
void processAllReadyTiles();
/** Process one ready tile (for loading screens with per-tile progress updates) */
void processOneReadyTile();
private:
/**
* Get tile coordinates from GL world position

View file

@ -118,11 +118,14 @@ private:
// Drag-and-drop held item state
bool holdingItem = false;
game::ItemDef heldItem;
enum class HeldSource { NONE, BACKPACK, BAG, EQUIPMENT };
enum class HeldSource { NONE, BACKPACK, BAG, EQUIPMENT, BANK, BANK_BAG, BANK_BAG_EQUIP };
HeldSource heldSource = HeldSource::NONE;
int heldBackpackIndex = -1;
int heldBagIndex = -1;
int heldBagSlotIndex = -1;
int heldBankIndex = -1;
int heldBankBagIndex = -1;
int heldBankBagSlotIndex = -1;
game::EquipSlot heldEquipSlot = game::EquipSlot::NUM_SLOTS;
// Slot rendering with interaction support
@ -136,7 +139,7 @@ private:
int pickupBagIndex_ = -1;
int pickupBagSlotIndex_ = -1;
game::EquipSlot pickupEquipSlot_ = game::EquipSlot::NUM_SLOTS;
static constexpr float kPickupHoldThreshold = 0.12f; // seconds
static constexpr float kPickupHoldThreshold = 0.10f; // seconds
void renderSeparateBags(game::Inventory& inventory, uint64_t moneyCopper);
void renderAggregateBags(game::Inventory& inventory, uint64_t moneyCopper);
@ -186,6 +189,12 @@ public:
bool dropHeldItemToEquipSlot(game::Inventory& inv, game::EquipSlot slot);
/// Drop the currently held item into a bank slot via CMSG_SWAP_ITEM.
void dropIntoBankSlot(game::GameHandler& gh, uint8_t dstBag, uint8_t dstSlot);
/// Pick up an item from main bank slot (click-and-hold from bank window).
void pickupFromBank(game::Inventory& inv, int bankIndex);
/// Pick up an item from a bank bag slot (click-and-hold from bank window).
void pickupFromBankBag(game::Inventory& inv, int bagIndex, int slotIndex);
/// Pick up a bag from a bank bag equip slot (click-and-hold from bank window).
void pickupFromBankBagEquip(game::Inventory& inv, int bagIndex);
};
} // namespace ui