diff --git a/Source/control.cpp b/Source/control.cpp index d0597711..dde44c4b 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1034,7 +1034,7 @@ void InitControlPan() } pQLogCel = LoadCel("Data\\Quest.CEL", SPANEL_WIDTH); pGBoxBuff = LoadCel("CtrlPan\\Golddrop.cel", 261); - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; initialDropGoldValue = 0; initialDropGoldIndex = 0; @@ -1309,14 +1309,14 @@ void CheckBtnUp() sbookflag = false; invflag = !invflag; if (dropGoldFlag) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } break; case PanelButtonSpellbook: invflag = false; if (dropGoldFlag) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } sbookflag = !sbookflag; @@ -1679,7 +1679,7 @@ void control_drop_gold(char vkey) auto &myPlayer = Players[MyPlayerId]; if (myPlayer._pHitPoints >> 6 <= 0) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; return; } @@ -1690,9 +1690,9 @@ void control_drop_gold(char vkey) if (vkey == DVL_VK_RETURN) { if (dropGoldValue > 0) RemoveGold(myPlayer, initialDropGoldIndex); - dropGoldFlag = false; + CloseGoldDrop(); } else if (vkey == DVL_VK_ESCAPE) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } else if (vkey == DVL_VK_BACK) { input[strlen(input) - 1] = '\0'; @@ -1893,4 +1893,9 @@ void DiabloHotkeyMsg(uint32_t dwMsg) NetSendCmdString(0xFFFFFF, sgOptions.Chat.szHotKeyMsgs[dwMsg]); } +void CloseGoldDrop() +{ + dropGoldFlag = false; +} + } // namespace devilution diff --git a/Source/control.h b/Source/control.h index 50e92c03..cadb2ead 100644 --- a/Source/control.h +++ b/Source/control.h @@ -180,7 +180,7 @@ bool IsTalkActive(); void control_new_text(string_view text); bool control_presskeys(int vkey); void DiabloHotkeyMsg(uint32_t dwMsg); - +void CloseGoldDrop(); extern Rectangle ChrBtnsRect[4]; } // namespace devilution diff --git a/Source/inv.cpp b/Source/inv.cpp index 55d61218..0f8837c5 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -684,7 +684,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove, bool dropIt } if (dropGoldFlag) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } @@ -1631,7 +1631,7 @@ void CheckItemStats(Player &player) void InvGetItem(int pnum, Item *item, int ii) { if (dropGoldFlag) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } @@ -1667,7 +1667,7 @@ void AutoGetItem(int pnum, Item *item, int ii) } if (dropGoldFlag) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } @@ -2138,7 +2138,7 @@ bool UseInvItem(int pnum, int cii) } if (dropGoldFlag) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } diff --git a/Source/objects.cpp b/Source/objects.cpp index 8cb45998..3199f77e 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3560,7 +3560,7 @@ bool OperateShrineMurphys(int pnum) void OperateShrine(int pnum, int i, _sfx_id sType) { if (dropGoldFlag) { - dropGoldFlag = false; + CloseGoldDrop(); dropGoldValue = 0; } diff --git a/Source/stores.cpp b/Source/stores.cpp index b2fad8fc..6d643a4b 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2316,7 +2316,7 @@ void StartStore(talk_id s) invflag = false; chrflag = false; QuestLogIsOpen = false; - dropGoldFlag = false; + CloseGoldDrop(); ClearSText(0, STORE_LINES); ReleaseStoreBtn(); switch (s) {