|
|
|
@ -162,6 +162,12 @@ namespace DFHack
|
|
|
|
|
command_result invoke(color_ostream &out, const std::string & command, std::vector <std::string> & parameters);
|
|
|
|
|
bool can_invoke_hotkey(const std::string & command, df::viewscreen *top );
|
|
|
|
|
plugin_state getState () const;
|
|
|
|
|
void *getExports()
|
|
|
|
|
{
|
|
|
|
|
if (plugin_get_exports)
|
|
|
|
|
return plugin_get_exports();
|
|
|
|
|
return NULL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
RPCService *rpc_connect(color_ostream &out);
|
|
|
|
|
|
|
|
|
@ -224,6 +230,7 @@ namespace DFHack
|
|
|
|
|
command_result (*plugin_enable)(color_ostream &, bool);
|
|
|
|
|
RPCService* (*plugin_rpcconnect)(color_ostream &);
|
|
|
|
|
command_result (*plugin_eval_ruby)(color_ostream &, const char*);
|
|
|
|
|
void* (*plugin_get_exports)(void);
|
|
|
|
|
};
|
|
|
|
|
class DFHACK_EXPORT PluginManager
|
|
|
|
|
{
|
|
|
|
@ -241,6 +248,7 @@ namespace DFHack
|
|
|
|
|
public:
|
|
|
|
|
Plugin *getPluginByName (const std::string & name);
|
|
|
|
|
Plugin *getPluginByCommand (const std::string &command);
|
|
|
|
|
void *getPluginExports(const std::string &name);
|
|
|
|
|
command_result InvokeCommand(color_ostream &out, const std::string & command, std::vector <std::string> & parameters);
|
|
|
|
|
bool CanInvokeHotkey(const std::string &command, df::viewscreen *top);
|
|
|
|
|
Plugin* operator[] (std::size_t index)
|
|
|
|
@ -283,6 +291,17 @@ namespace DFHack
|
|
|
|
|
DFhackDataExport bool plugin_is_enabled = false; \
|
|
|
|
|
bool &varname = plugin_is_enabled;
|
|
|
|
|
|
|
|
|
|
#define DFHACK_PLUGIN_EXPORTS(clsname) \
|
|
|
|
|
DFhackCExport void* plugin_get_exports() \
|
|
|
|
|
{ \
|
|
|
|
|
static clsname* instance = NULL; \
|
|
|
|
|
if (!instance) \
|
|
|
|
|
instance = new clsname; \
|
|
|
|
|
return (void*)instance; \
|
|
|
|
|
}
|
|
|
|
|
#define GET_PLUGIN_EXPORTS(plugname, clsname) \
|
|
|
|
|
(clsname*)DFHack::Core::getInstance().getPluginManager()->getPluginExports(plugname)
|
|
|
|
|
|
|
|
|
|
#define DFHACK_PLUGIN_LUA_COMMANDS \
|
|
|
|
|
DFhackCExport const DFHack::CommandReg plugin_lua_commands[] =
|
|
|
|
|
#define DFHACK_PLUGIN_LUA_FUNCTIONS \
|
|
|
|
|