summaryrefslogtreecommitdiff
path: root/library/PluginManager.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2011-08-06 04:37:29 +0200
committerPetr Mrázek2011-08-06 04:37:29 +0200
commitcb93b5542ec20a8660800f98f1b090af3623e100 (patch)
tree58f268002b223493b5682f037deca7b11d878989 /library/PluginManager.cpp
parent24bdc538e961e3d353e3e865f4f1bd7f04738483 (diff)
downloaddfhack-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.cpp12
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;