1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Minor fixes #2

- ChangeLog update
- Updated code for other platforms in CGameInterface
This commit is contained in:
Karol 2014-08-31 23:02:52 +02:00
parent 80998b9dc3
commit b2a140149c
2 changed files with 19 additions and 18 deletions

View File

@ -3,6 +3,8 @@ GENERAL:
* VCMI can now be compiled with SDL2
* Better upscaling when running in fullscreen mode.
* Non-latin characters can now be entered in chat window or used for save names.
* (windows) Moved VCMI data directory from '%userprofile%\vcmi' to '%userprofile%\Documents\My Games\vcmi'
* (windows, OSX) Moved VCMI save directory from 'VCMI_DATA\Games' to 'VCMI_DATA\Saves'
RANDOM MAP GENERATOR:

View File

@ -44,28 +44,27 @@ shared_ptr<rett> createAny(const boost::filesystem::path& libpath, const std::st
TGetAIFun getAI = nullptr;
TGetNameFun getName = nullptr;
#ifndef VCMI_WINDOWS
std::string dllname = libpath.string();
// I don't know other platforms.
// Somebody should remove it soon.
#endif
#ifdef VCMI_ANDROID
// this is awful but it seems using shared libraries on some devices is even worse
if (dllname.find("libVCAI.so") != std::string::npos) {
const std::string filename = libpath.filename().string();
if (filename != "libVCAI.so")
{
getName = (TGetNameFun)VCAI_GetAiName;
getAI = (TGetAIFun)VCAI_GetNewAI;
} else if (dllname.find("libStupidAI.so") != std::string::npos) {
}
else if (filename != "libStupidAI.so")
{
getName = (TGetNameFun)StupidAI_GetAiName;
getAI = (TGetAIFun)StupidAI_GetNewBattleAI;
} else if (dllname.find("libBattleAI.so") != std::string::npos) {
}
else if (filename != "libBattleAI.so")
{
getName = (TGetNameFun)BattleAI_GetAiName;
getAI = (TGetAIFun)BattleAI_GetNewBattleAI;
} else {
throw std::runtime_error("Don't know what to do with " + dllname + " and method " + methodName);
}
#else
else
throw std::runtime_error("Don't know what to do with " + libpath.string() + " and method " + methodName);
#else // !VCMI_ANDROID
#ifdef VCMI_WINDOWS
HMODULE dll = LoadLibraryW(libpath.c_str());
if (dll)
@ -73,16 +72,16 @@ shared_ptr<rett> createAny(const boost::filesystem::path& libpath, const std::st
getName = (TGetNameFun)GetProcAddress(dll, "GetAiName");
getAI = (TGetAIFun)GetProcAddress(dll, methodName.c_str());
}
#else
void *dll = dlopen(dllname.c_str(), RTLD_LOCAL | RTLD_LAZY);
#else // !VCMI_WINDOWS
void *dll = dlopen(libpath.string().c_str(), RTLD_LOCAL | RTLD_LAZY);
if (dll)
{
getName = (TGetNameFun)dlsym(dll,"GetAiName");
getAI = (TGetAIFun)dlsym(dll,methodName.c_str());
getName = (TGetNameFun)dlsym(dll, "GetAiName");
getAI = (TGetAIFun)dlsym(dll, methodName.c_str());
}
else
logGlobal->errorStream() << "Error: " << dlerror();
#endif
#endif // VCMI_WINDOWS
if (!dll)
{
logGlobal->errorStream() << "Cannot open dynamic library ("<<libpath<<"). Throwing...";