From 8c36658c567908d9dc1561437507b4327ab41862 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 6 May 2009 03:33:57 +0000 Subject: [PATCH] Made AI name OS agnostic. --- CGameInterface.cpp | 5 +++-- config/settings.txt | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CGameInterface.cpp b/CGameInterface.cpp index 45005749a..408fbc265 100644 --- a/CGameInterface.cpp +++ b/CGameInterface.cpp @@ -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) diff --git a/config/settings.txt b/config/settings.txt index c27cc9c60..c8350a59e 100644 --- a/config/settings.txt +++ b/config/settings.txt @@ -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; }; } -} \ No newline at end of file +}