|
|
@ -32,12 +32,13 @@ distribution.
|
|
|
|
#include <cstring>
|
|
|
|
#include <cstring>
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "dfhack/Error.h"
|
|
|
|
|
|
|
|
#include "dfhack/Process.h"
|
|
|
|
#include "dfhack/Core.h"
|
|
|
|
#include "dfhack/Core.h"
|
|
|
|
#include "dfhack/Console.h"
|
|
|
|
#include "dfhack/Console.h"
|
|
|
|
#include "dfhack/VersionInfoFactory.h"
|
|
|
|
#include "dfhack/VersionInfoFactory.h"
|
|
|
|
#include "ModuleFactory.h"
|
|
|
|
#include "ModuleFactory.h"
|
|
|
|
#include "dfhack/Error.h"
|
|
|
|
|
|
|
|
#include "dfhack/Process.h"
|
|
|
|
|
|
|
|
#include "dfhack/modules/Gui.h"
|
|
|
|
#include "dfhack/modules/Gui.h"
|
|
|
|
#include "dfhack/modules/Vegetation.h"
|
|
|
|
#include "dfhack/modules/Vegetation.h"
|
|
|
|
#include "dfhack/modules/Maps.h"
|
|
|
|
#include "dfhack/modules/Maps.h"
|
|
|
@ -72,16 +73,23 @@ static int getdir (string dir, vector<string> &files)
|
|
|
|
int fIOthread(void * _core)
|
|
|
|
int fIOthread(void * _core)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Core * core = (Core *) _core;
|
|
|
|
Core * core = (Core *) _core;
|
|
|
|
|
|
|
|
#ifdef LINUX_BUILD
|
|
|
|
|
|
|
|
string path = core->p->getPath() + "/plugins/";
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
string path = core->p->getPath() + "\\plugins\\";
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
vector <string> filez;
|
|
|
|
vector <string> filez;
|
|
|
|
map <string, int (*)(Core *)> plugins;
|
|
|
|
map <string, int (*)(Core *)> plugins;
|
|
|
|
getdir(core->p->getPath(), filez);
|
|
|
|
getdir(path, filez);
|
|
|
|
const char * (*_PlugName)(void) = 0;
|
|
|
|
const char * (*_PlugName)(void) = 0;
|
|
|
|
int (*_PlugRun)(Core *) = 0;
|
|
|
|
int (*_PlugRun)(Core *) = 0;
|
|
|
|
for(int i = 0; i < filez.size();i++)
|
|
|
|
for(int i = 0; i < filez.size();i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(strstr(filez[i].c_str(),".plug."))
|
|
|
|
if(strstr(filez[i].c_str(),".plug."))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DFLibrary * plug = OpenPlugin(filez[i].c_str());
|
|
|
|
string fullpath = path + filez[i];
|
|
|
|
|
|
|
|
DFLibrary * plug = OpenPlugin(fullpath.c_str());
|
|
|
|
if(!plug)
|
|
|
|
if(!plug)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dfout << "Can't load plugin " << filez[i] << endl;
|
|
|
|
dfout << "Can't load plugin " << filez[i] << endl;
|
|
|
@ -101,7 +109,7 @@ int fIOthread(void * _core)
|
|
|
|
ClosePlugin(plug);
|
|
|
|
ClosePlugin(plug);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dfout << filez[i] << endl;
|
|
|
|
dfout << "Loaded plugin " << filez[i] << endl;
|
|
|
|
plugins[string(_PlugName())] = _PlugRun;
|
|
|
|
plugins[string(_PlugName())] = _PlugRun;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -229,6 +237,7 @@ int Core::Shutdown ( void )
|
|
|
|
allModules.clear();
|
|
|
|
allModules.clear();
|
|
|
|
memset(&(s_mods), 0, sizeof(s_mods));
|
|
|
|
memset(&(s_mods), 0, sizeof(s_mods));
|
|
|
|
dfout << std::endl;
|
|
|
|
dfout << std::endl;
|
|
|
|
|
|
|
|
// kill the console object
|
|
|
|
delete con;
|
|
|
|
delete con;
|
|
|
|
con = 0;
|
|
|
|
con = 0;
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|