main.cpp 613 B

1234567891011121314151617181920212223242526272829
  1. #include "StdInc.h"
  2. #include "VCAI.h"
  3. #ifdef __GNUC__
  4. #define strcpy_s(a, b, c) strncpy(a, c, b)
  5. #endif
  6. #ifdef VCMI_ANDROID
  7. #define GetGlobalAiVersion VCAI_GetGlobalAiVersion
  8. #define GetAiName VCAI_GetAiName
  9. #define GetNewAI VCAI_GetNewAI
  10. #endif
  11. static const char *g_cszAiName = "VCAI";
  12. extern "C" DLL_EXPORT int GetGlobalAiVersion()
  13. {
  14. return AI_INTERFACE_VER;
  15. }
  16. extern "C" DLL_EXPORT void GetAiName(char* name)
  17. {
  18. strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
  19. }
  20. extern "C" DLL_EXPORT void GetNewAI(std::shared_ptr<CGlobalAI> &out)
  21. {
  22. out = std::make_shared<VCAI>();
  23. }