Skip to content

Commit

Permalink
Allow lua debug quick messages in singleplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
obligaron authored and AJenbo committed Feb 3, 2025
1 parent ee42d2a commit 8572535
Showing 1 changed file with 12 additions and 8 deletions.
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

0 comments on commit 8572535

Please sign in to comment.