diff --git a/Source/items.cpp b/Source/items.cpp index 7e76f5006..b472c7fc4 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2713,6 +2713,10 @@ void CalcPlrInv(Player &player, bool loadgfx) CalcPlrBookVals(player); player.CalcScrolls(); CalcPlrStaff(player); + if (IsStashOpen) { + // If stash is open, ensure the items are displayed correctly + Stash.RefreshItemStatFlags(); + } } } diff --git a/Source/qol/stash.cpp b/Source/qol/stash.cpp index 1a55e8d51..0b5037eda 100644 --- a/Source/qol/stash.cpp +++ b/Source/qol/stash.cpp @@ -548,6 +548,13 @@ void StashStruct::SetPage(int newPage) page = clamp(newPage, 0, CountStashPages - 1); } +void StashStruct::RefreshItemStatFlags() +{ + for (auto &item : Stash.stashList) { + item._iStatFlag = MyPlayer->CanUseItem(item); + } +} + void WithdrawGoldKeyPress(char vkey) { auto &myPlayer = Players[MyPlayerId]; diff --git a/Source/qol/stash.h b/Source/qol/stash.h index 3823d531a..eef233d23 100644 --- a/Source/qol/stash.h +++ b/Source/qol/stash.h @@ -28,6 +28,8 @@ public: } void SetPage(int newPage); + /** @brief Updates _iStatFlag for all stash items. */ + void RefreshItemStatFlags(); private: /** Current Page */ diff --git a/Source/stores.cpp b/Source/stores.cpp index 3d7f4f31c..159c11f8c 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2169,6 +2169,7 @@ void BarmaidEnter() case 14: stextflag = STORE_NONE; IsStashOpen = true; + Stash.RefreshItemStatFlags(); invflag = true; if (ControlMode != ControlTypes::KeyboardAndMouse) { if (pcurs == CURSOR_DISARM)