Browse Source

Update _iStatFlag for stash items

pull/4202/head^2
obligaron 4 years ago committed by Anders Jenbo
parent
commit
3e9ca60460
  1. 4
      Source/items.cpp
  2. 7
      Source/qol/stash.cpp
  3. 2
      Source/qol/stash.h
  4. 1
      Source/stores.cpp

4
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();
}
}
}

7
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];

2
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 */

1
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)

Loading…
Cancel
Save