|
|
|
@ -208,6 +208,7 @@ bool Plugin::load(color_ostream &con)
|
|
|
|
|
// enter suspend
|
|
|
|
|
CoreSuspender suspend;
|
|
|
|
|
// open the library, etc
|
|
|
|
|
fprintf(stderr, "loading plugin %s\n", filename.c_str());
|
|
|
|
|
DFLibrary * plug = OpenPlugin(filename.c_str());
|
|
|
|
|
if(!plug)
|
|
|
|
|
{
|
|
|
|
@ -232,10 +233,11 @@ bool Plugin::load(color_ostream &con)
|
|
|
|
|
plugin_check_symbol("plugin_globals")
|
|
|
|
|
const char ** plug_name =(const char ** ) LookupPlugin(plug, "name");
|
|
|
|
|
const char ** plug_version =(const char ** ) LookupPlugin(plug, "version");
|
|
|
|
|
const char ** plug_git_description = (const char**) LookupPlugin(plug, "git_description");
|
|
|
|
|
const char ** plug_git_desc_ptr = (const char**) LookupPlugin(plug, "git_description");
|
|
|
|
|
Plugin **plug_self = (Plugin**)LookupPlugin(plug, "plugin_self");
|
|
|
|
|
const char *dfhack_version = Version::dfhack_version();
|
|
|
|
|
const char *dfhack_git_desc = Version::git_description();
|
|
|
|
|
const char *plug_git_desc = plug_git_desc_ptr ? *plug_git_desc_ptr : "unknown";
|
|
|
|
|
if (strcmp(dfhack_version, *plug_version) != 0)
|
|
|
|
|
{
|
|
|
|
|
con.printerr("Plugin %s was not built for this version of DFHack.\n"
|
|
|
|
@ -243,14 +245,17 @@ bool Plugin::load(color_ostream &con)
|
|
|
|
|
plugin_abort_load;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (plug_git_description)
|
|
|
|
|
if (plug_git_desc_ptr)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(dfhack_git_desc, *plug_git_description) != 0)
|
|
|
|
|
if (strcmp(dfhack_git_desc, plug_git_desc) != 0)
|
|
|
|
|
con.printerr("Warning: Plugin %s compiled for DFHack %s, running DFHack %s\n",
|
|
|
|
|
*plug_name, *plug_git_description, dfhack_git_desc);
|
|
|
|
|
*plug_name, plug_git_desc, dfhack_git_desc);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
con.printerr("Warning: Plugin %s missing git information\n", *plug_name);
|
|
|
|
|
plug_git_desc = "unknown";
|
|
|
|
|
}
|
|
|
|
|
bool *plug_dev = (bool*)LookupPlugin(plug, "plugin_dev");
|
|
|
|
|
if (plug_dev && *plug_dev && getenv("DFHACK_NO_DEV_PLUGINS"))
|
|
|
|
|
{
|
|
|
|
@ -297,6 +302,7 @@ bool Plugin::load(color_ostream &con)
|
|
|
|
|
parent->registerCommands(this);
|
|
|
|
|
if ((plugin_onupdate || plugin_enable) && !plugin_is_enabled)
|
|
|
|
|
con.printerr("Plugin %s has no enabled var!\n", name.c_str());
|
|
|
|
|
fprintf(stderr, "loaded plugin %s; DFHack build %s\n", name.c_str(), plug_git_desc);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|