diff options
| author | Petr Mrázek | 2011-08-06 04:37:29 +0200 |
|---|---|---|
| committer | Petr Mrázek | 2011-08-06 04:37:29 +0200 |
| commit | cb93b5542ec20a8660800f98f1b090af3623e100 (patch) | |
| tree | 58f268002b223493b5682f037deca7b11d878989 /library/PluginManager.cpp | |
| parent | 24bdc538e961e3d353e3e865f4f1bd7f04738483 (diff) | |
| download | dfhack-cb93b5542ec20a8660800f98f1b090af3623e100.tar.gz dfhack-cb93b5542ec20a8660800f98f1b090af3623e100.tar.bz2 dfhack-cb93b5542ec20a8660800f98f1b090af3623e100.tar.xz | |
Fix problem with running interactive commands from hotkeys.
Diffstat (limited to 'library/PluginManager.cpp')
| -rw-r--r-- | library/PluginManager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index 9324c20d..0a553ae6 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -262,7 +262,7 @@ bool Plugin::reload() return true; } -command_result Plugin::invoke( std::string & command, std::vector <std::string> & parameters) +command_result Plugin::invoke( std::string & command, std::vector <std::string> & parameters, bool interactive_) { Core & c = Core::getInstance(); command_result cr = CR_NOT_IMPLEMENTED; @@ -273,7 +273,11 @@ command_result Plugin::invoke( std::string & command, std::vector <std::string> { if(commands[i].name == command) { - cr = commands[i].function(&c, parameters); + // running interactive things from some other source than the console would break it + if(!interactive_ && commands[i].interactive) + cr = CR_WOULD_BREAK; + else + cr = commands[i].function(&c, parameters); break; } } @@ -345,7 +349,7 @@ Plugin *PluginManager::getPluginByName (const std::string & name) } // FIXME: handle name collisions... -command_result PluginManager::InvokeCommand( std::string & command, std::vector <std::string> & parameters) +command_result PluginManager::InvokeCommand( std::string & command, std::vector <std::string> & parameters, bool interactive) { command_result cr = CR_NOT_IMPLEMENTED; Core * c = &Core::getInstance(); @@ -353,7 +357,7 @@ command_result PluginManager::InvokeCommand( std::string & command, std::vector map <string, Plugin *>::iterator iter = belongs.find(command); if(iter != belongs.end()) { - cr = iter->second->invoke(command, parameters); + cr = iter->second->invoke(command, parameters, interactive); } cmdlist_mutex->unlock(); return cr; |
