1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

* saving system options

* saving hero direction
* minor changes in saving
This commit is contained in:
Michał W. Urbańczyk
2009-07-18 03:13:13 +00:00
parent d1d2823c58
commit eb40ade906
11 changed files with 204 additions and 97 deletions

View File

@ -24,23 +24,25 @@ CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
CGlobalAI*(*getAI)();
void(*getName)(char*);
std::string dllPath;
#ifdef _WIN32
dllname = "AI/"+dllname+".dll";
HINSTANCE dll = LoadLibraryA(dllname.c_str());
dllPath = "AI/"+dllname+".dll";
HINSTANCE dll = LoadLibraryA(dllPath.c_str());
if (!dll)
{
tlog1 << "Cannot open AI library ("<<dllname<<"). Throwing..."<<std::endl;
tlog1 << "Cannot open AI library ("<<dllPath<<"). Throwing..."<<std::endl;
throw new std::string("Cannot open AI library");
}
//int len = dllname.size()+1;
getName = (void(*)(char*))GetProcAddress(dll,"GetAiName");
getAI = (CGlobalAI*(*)())GetProcAddress(dll,"GetNewAI");
#else
dllname = "AI/"+dllname+".so";
void *dll = dlopen(dllname.c_str(), RTLD_LOCAL | RTLD_LAZY);
dllPath = "AI/"+dllPath+".so";
void *dll = dlopen(dllPath.c_str(), RTLD_LOCAL | RTLD_LAZY);
if (!dll)
{
tlog1 << "Cannot open AI library ("<<dllname<<"). Throwing..."<<std::endl;
tlog1 << "Cannot open AI library ("<<dllPath<<"). Throwing..."<<std::endl;
throw new std::string("Cannot open AI library");
}
getName = (void(*)(char*))dlsym(dll,"GetAiName");