Browse Source

Empty cursor when closing inventory

Fixes #4205
pull/6179/head
Anders Jenbo 3 years ago
parent
commit
01a7966f1d
  1. 6
      Source/control.cpp
  2. 4
      Source/controls/plrctrls.cpp
  3. 6
      Source/diablo.cpp
  4. 29
      Source/inv.cpp
  5. 1
      Source/inv.h

6
Source/control.cpp

@ -658,7 +658,7 @@ void OpenCharPanel()
{
QuestLogIsOpen = false;
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
chrflag = true;
}
@ -1032,7 +1032,7 @@ void CheckBtnUp()
case PanelButtonQlog:
CloseCharPanel();
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
if (!QuestLogIsOpen)
StartQuestlog();
else
@ -1049,7 +1049,7 @@ void CheckBtnUp()
case PanelButtonInventory:
sbookflag = false;
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
invflag = !invflag;
if (dropGoldFlag) {
CloseGoldDrop();

4
Source/controls/plrctrls.cpp

@ -1627,7 +1627,7 @@ void ProcessGameAction(const GameAction &action)
QuestLogIsOpen = false;
sbookflag = false;
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
}
break;
case GameActionType_TOGGLE_CHARACTER_INFO:
@ -1644,7 +1644,7 @@ void ProcessGameAction(const GameAction &action)
StartQuestlog();
CloseCharPanel();
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
spselflag = false;
} else {
QuestLogIsOpen = false;

6
Source/diablo.cpp

@ -227,7 +227,7 @@ void LeftMouseCmd(bool bShift)
if (leveltype == DTYPE_TOWN) {
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
if (pcursitem != -1 && pcurs == CURSOR_HAND)
NetSendCmdLocParam1(true, invflag ? CMD_GOTOGETITEM : CMD_GOTOAGETITEM, cursPosition, pcursitem);
if (pcursmonst != -1)
@ -1482,7 +1482,7 @@ void InventoryKeyPressed()
}
sbookflag = false;
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
}
void CharacterSheetKeyPressed()
@ -1525,7 +1525,7 @@ void QuestLogKeyPressed()
}
CloseCharPanel();
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
}
void DisplaySpellsKeyPressed()

29
Source/inv.cpp

@ -2081,10 +2081,37 @@ bool UseInvItem(int cii)
void CloseInventory()
{
CloseGoldWithdraw();
IsStashOpen = false;
CloseStash();
invflag = false;
}
void CloseStash()
{
if (!IsStashOpen)
return;
Player &myPlayer = *MyPlayer;
if (!myPlayer.HoldItem.isEmpty()) {
std::optional<Point> itemTile = FindAdjacentPositionForItem(myPlayer.position.future, myPlayer._pdir);
if (itemTile) {
NetSendCmdPItem(true, CMD_PUTITEM, *itemTile, myPlayer.HoldItem);
} else {
if (!AutoPlaceItemInBelt(myPlayer, myPlayer.HoldItem, true)
&& !AutoPlaceItemInInventory(myPlayer, myPlayer.HoldItem, true)
&& !AutoPlaceItemInStash(myPlayer, myPlayer.HoldItem, true)) {
// This can fail for max gold, arena potions and a stash that has been arranged
// to not have room for the item all 3 cases are extremely unlikely
app_fatal(_("No room for item"));
}
PlaySFX(ItemInvSnds[ItemCAnimTbl[myPlayer.HoldItem._iCurs]]);
}
myPlayer.HoldItem.clear();
NewCursor(CURSOR_HAND);
}
IsStashOpen = false;
}
void DoTelekinesis()
{
if (ObjectUnderCursor != nullptr && !ObjectUnderCursor->IsDisabled())

1
Source/inv.h

@ -96,6 +96,7 @@ bool CanBePlacedOnBelt(const Item &item);
using ItemFunc = void (*)(Item &);
void CloseInventory();
void CloseStash();
void FreeInvGFX();
void InitInv();

Loading…
Cancel
Save