From 6be94ceb3f90237e18b84be54aa6f7d7bdeffe11 Mon Sep 17 00:00:00 2001 From: obligaron Date: Fri, 13 Aug 2021 20:53:38 +0200 Subject: [PATCH] Move DiabloHotkeyMsg to control.cpp and use IsChatAvailable --- Source/control.cpp | 11 +++++++++++ Source/control.h | 1 + Source/diablo.cpp | 11 ----------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 6d5347add..c69b71295 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2065,4 +2065,15 @@ bool control_presskeys(int vkey) return true; } +void DiabloHotkeyMsg(uint32_t dwMsg) +{ + if (!IsChatAvailable()) { + return; + } + + assert(dwMsg < QUICK_MESSAGE_OPTIONS); + + NetSendCmdString(0xFFFFFF, sgOptions.Chat.szHotKeyMsgs[dwMsg]); +} + } // namespace devilution diff --git a/Source/control.h b/Source/control.h index e59a28315..0874605d2 100644 --- a/Source/control.h +++ b/Source/control.h @@ -152,6 +152,7 @@ void control_type_message(); void control_reset_talk(); bool control_talk_last_key(char vkey); bool control_presskeys(int vkey); +void DiabloHotkeyMsg(uint32_t dwMsg); extern Rectangle ChrBtnsRect[4]; diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 1f2ce7068..78f7a0bb2 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -405,17 +405,6 @@ void RightMouseDown() } } -void DiabloHotkeyMsg(uint32_t dwMsg) -{ - if (!gbIsMultiplayer) { - return; - } - - assert(dwMsg < QUICK_MESSAGE_OPTIONS); - - NetSendCmdString(0xFFFFFF, sgOptions.Chat.szHotKeyMsgs[dwMsg]); -} - bool PressSysKey(int wParam) { if (gmenu_is_active() || wParam != DVL_VK_F10)