DLLMain.cpp 811 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #define VCMI_DLL
  2. #pragma warning (disable: 4100 4251 4245 4018 4081)
  3. #include "../../AI_Base.h"
  4. #pragma warning (default: 4100 4251 4245 4018 4081)
  5. #include "CGeniusAI.h"
  6. #include <cstring>
  7. #include <set>
  8. using namespace GeniusAI;
  9. const char *g_cszAiName = "Genius 1.0";
  10. extern "C" DLL_EXPORT int GetGlobalAiVersion()
  11. {
  12. return AI_INTERFACE_VER;
  13. }
  14. extern "C" DLL_EXPORT void GetAiName(char* name)
  15. {
  16. strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
  17. }
  18. extern "C" DLL_EXPORT char * GetAiNameS()
  19. {
  20. char *ret = new char[strlen(g_cszAiName) + 1];
  21. strcpy_s(ret, strlen(g_cszAiName), g_cszAiName);
  22. return ret;
  23. }
  24. extern "C" DLL_EXPORT CGlobalAI * GetNewAI()
  25. {
  26. return new CGeniusAI();
  27. }
  28. extern "C" DLL_EXPORT void ReleaseAI(CGlobalAI * i)
  29. {
  30. delete (CGeniusAI*)i;
  31. }