main.cpp 696 B

12345678910111213141516171819202122232425262728293031
  1. #include "StdInc.h"
  2. #include "../../lib/AI_Base.h"
  3. #include "StupidAI.h"
  4. #ifdef __GNUC__
  5. #define strcpy_s(a, b, c) strncpy(a, c, b)
  6. #endif
  7. #ifdef VCMI_ANDROID
  8. #define GetGlobalAiVersion StupidAI_GetGlobalAiVersion
  9. #define GetAiName StupidAI_GetAiName
  10. #define GetNewBattleAI StupidAI_GetNewBattleAI
  11. #endif
  12. static const char *g_cszAiName = "Stupid AI 0.1";
  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<CStupidAI>();
  24. }