main.cpp 692 B

12345678910111213141516171819202122232425262728293031
  1. #include "StdInc.h"
  2. #include "../../lib/AI_Base.h"
  3. #include "BattleAI.h"
  4. #ifdef __GNUC__
  5. #define strcpy_s(a, b, c) strncpy(a, c, b)
  6. #endif
  7. #ifdef VCMI_ANDROID
  8. #define GetGlobalAiVersion BattleAI_GetGlobalAiVersion
  9. #define GetAiName BattleAI_GetAiName
  10. #define GetNewBattleAI BattleAI_GetNewBattleAI
  11. #endif
  12. static const char *g_cszAiName = "Battle AI";
  13. extern "C" DLL_EXPORT int GetGlobalAiVersion()
  14. {
  15. return AI_INTERFACE_VER;
  16. }
  17. extern "C" DLL_EXPORT void GetAiName(char* name)
  18. {
  19. strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
  20. }
  21. extern "C" DLL_EXPORT void GetNewBattleAI(shared_ptr<CBattleGameInterface> &out)
  22. {
  23. out = make_shared<CBattleAI>();
  24. }