mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Made AI name OS agnostic.
This commit is contained in:
parent
a594beea92
commit
8c36658c56
@ -20,12 +20,12 @@
|
||||
CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
|
||||
{
|
||||
char temp[50];
|
||||
dllname = "AI/"+dllname;
|
||||
CGlobalAI * ret=NULL;
|
||||
CGlobalAI*(*getAI)();
|
||||
void(*getName)(char*);
|
||||
|
||||
#ifdef _WIN32
|
||||
dllname = "AI/"+dllname+".dll";
|
||||
HINSTANCE dll = LoadLibraryA(dllname.c_str());
|
||||
if (!dll)
|
||||
{
|
||||
@ -36,6 +36,7 @@ CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
|
||||
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);
|
||||
if (!dll)
|
||||
{
|
||||
@ -46,7 +47,7 @@ CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
|
||||
getAI = (CGlobalAI*(*)())dlsym(dll,"GetNewAI");
|
||||
#endif
|
||||
getName(temp);
|
||||
tlog0 << "Loaded .dll with AI named " << temp << std::endl;
|
||||
tlog0 << "Loaded AI named " << temp << std::endl;
|
||||
ret = getAI();
|
||||
|
||||
if(!ret)
|
||||
|
@ -8,7 +8,7 @@ clientSettings
|
||||
fullscreen=0; //0 - windowed mode, 1 - fullscreen
|
||||
server=127.0.0.1; //use 127.0.0.1 for localhost
|
||||
localInformation=2; //0 - *all* information sent from server (safest and slowest); 1 - map information sent from server; 2 - all information local-storaged
|
||||
defaultAI=GeniusAI.dll;
|
||||
defaultAI=GeniusAI;
|
||||
}
|
||||
GUISettings
|
||||
{
|
||||
@ -97,4 +97,4 @@ GUISettings
|
||||
ButtonEndTurn: x=903 y=524 graphic=IAM001.DEF playerColoured=1;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user