diff --git a/Source/control.cpp b/Source/control.cpp index 4a4e3c38a..b291e5174 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1235,12 +1235,16 @@ void DiabloHotkeyMsg(uint32_t dwMsg) assert(dwMsg < QUICK_MESSAGE_OPTIONS); + for (auto &msg : sgOptions.Chat.szHotKeyMsgs[dwMsg]) { + #ifdef _DEBUG - if (CheckDebugTextCommand(sgOptions.Chat.szHotKeyMsgs[dwMsg])) - return; + if (CheckDebugTextCommand(msg)) + continue; #endif - - NetSendCmdString(0xFFFFFF, sgOptions.Chat.szHotKeyMsgs[dwMsg]); + char charMsg[MAX_SEND_STR_LEN]; + CopyUtf8(charMsg, msg, sizeof(charMsg)); + NetSendCmdString(0xFFFFFF, charMsg); + } } void CloseGoldDrop() diff --git a/Source/diablo.cpp b/Source/diablo.cpp index eb146ddbe..ef54b0e8d 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -929,10 +929,11 @@ void DiabloInit() SetApplicationVersions(); for (size_t i = 0; i < QUICK_MESSAGE_OPTIONS; i++) { - if (strlen(sgOptions.Chat.szHotKeyMsgs[i]) != 0) { + auto &messages = sgOptions.Chat.szHotKeyMsgs[i]; + if (messages.size() > 0) { continue; } - CopyUtf8(sgOptions.Chat.szHotKeyMsgs[i], _(QuickMessages[i].message), MAX_SEND_STR_LEN); + messages.emplace_back(_(QuickMessages[i].message)); } #ifdef VIRTUAL_GAMEPAD diff --git a/Source/options.cpp b/Source/options.cpp index 26bc2ca60..f3ab0e22b 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -354,7 +354,7 @@ void LoadOptions() GetIniValue("Network", "Previous Host", sgOptions.Network.szPreviousHost, sizeof(sgOptions.Network.szPreviousHost), ""); for (size_t i = 0; i < QUICK_MESSAGE_OPTIONS; i++) - GetIniValue("NetMsg", QuickMessages[i].key, sgOptions.Chat.szHotKeyMsgs[i], MAX_SEND_STR_LEN, ""); + GetIniStringVector("NetMsg", QuickMessages[i].key, sgOptions.Chat.szHotKeyMsgs[i]); GetIniValue("Controller", "Mapping", sgOptions.Controller.szMapping, sizeof(sgOptions.Controller.szMapping), ""); sgOptions.Controller.bSwapShoulderButtonMode = GetIniBool("Controller", "Swap Shoulder Button Mode", false); diff --git a/Source/options.h b/Source/options.h index af808363b..39a358c4c 100644 --- a/Source/options.h +++ b/Source/options.h @@ -511,7 +511,7 @@ struct ChatOptions : OptionCategoryBase { std::vector GetEntries() override; /** @brief Quick chat messages. */ - char szHotKeyMsgs[QUICK_MESSAGE_OPTIONS][MAX_SEND_STR_LEN]; + std::vector szHotKeyMsgs[QUICK_MESSAGE_OPTIONS]; }; struct LanguageOptions : OptionCategoryBase {