Browse Source

Allow QuickMessages to contain multiple entries/lines

pull/1524/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
7b2f651bb2
  1. 12
      Source/control.cpp
  2. 5
      Source/diablo.cpp
  3. 2
      Source/options.cpp
  4. 2
      Source/options.h

12
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()

5
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

2
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);

2
Source/options.h

@ -511,7 +511,7 @@ struct ChatOptions : OptionCategoryBase {
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Quick chat messages. */
char szHotKeyMsgs[QUICK_MESSAGE_OPTIONS][MAX_SEND_STR_LEN];
std::vector<std::string> szHotKeyMsgs[QUICK_MESSAGE_OPTIONS];
};
struct LanguageOptions : OptionCategoryBase {

Loading…
Cancel
Save