From b71e577771fc8ee5994d79af422bccfd665ad8c8 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Fri, 30 Dec 2011 18:27:55 +0400 Subject: [PATCH] Allow specifying parameters in hotkey commands. Now that hotkeys can be set to arbitrary strings, tokenize them. --- library/Core.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index 41d3b5bd9..e8fc63d03 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -148,8 +148,17 @@ void fHKthread(void * iodata) std::string stuff = core->getHotkeyCmd(); // waits on mutex! if(!stuff.empty()) { - vector crap; - command_result cr = plug_mgr->InvokeCommand(stuff, crap, false); + vector args; + cheap_tokenise(stuff, args); + if (args.empty()) { + core->con.printerr("Empty hotkey command.\n"); + continue; + } + + string first = args[0]; + args.erase(args.begin()); + command_result cr = plug_mgr->InvokeCommand(first, args, false); + if(cr == CR_WOULD_BREAK) { core->con.printerr("It isn't possible to run an interactive command outside the console.\n");