Browse Source

Made AI name OS agnostic.

Frank Zago 16 years ago
parent
commit
8c36658c56
2 changed files with 5 additions and 4 deletions
  1. 3 2
      CGameInterface.cpp
  2. 2 2
      config/settings.txt

+ 3 - 2
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)

+ 2 - 2
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;
 		};
 	}
-}
+}