Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow lua debug quick messages in singleplayer #7700

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,20 +1688,24 @@ bool CheckKeypress(SDL_Keycode vkey)

void DiabloHotkeyMsg(uint32_t dwMsg)
{
assert(dwMsg < QuickMessages.size());

#ifdef _DEBUG
constexpr std::string_view LuaPrefix = "/lua ";
for (const std::string &msg : GetOptions().Chat.szHotKeyMsgs[dwMsg]) {
if (!msg.starts_with(LuaPrefix)) continue;
InitConsole();
RunInConsole(std::string_view(msg).substr(LuaPrefix.size()));
}
#endif

if (!IsChatAvailable()) {
return;
}

assert(dwMsg < QuickMessages.size());

for (const std::string &msg : GetOptions().Chat.szHotKeyMsgs[dwMsg]) {
#ifdef _DEBUG
constexpr std::string_view LuaPrefix = "/lua ";
if (msg.starts_with(LuaPrefix)) {
InitConsole();
RunInConsole(std::string_view(msg).substr(LuaPrefix.size()));
continue;
}
if (msg.starts_with(LuaPrefix)) continue;
#endif
char charMsg[MAX_SEND_STR_LEN];
CopyUtf8(charMsg, msg, sizeof(charMsg));
Expand Down
Loading