main.cpp 674 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "stdafx.h"
  2. #include "StupidAI.h"
  3. #include <cstring>
  4. #ifdef __GNUC__
  5. #define strcpy_s(a, b, c) strncpy(a, c, b)
  6. #endif
  7. const char *g_cszAiName = "Stupid AI 0.1";
  8. extern "C" DLL_F_EXPORT int GetGlobalAiVersion()
  9. {
  10. return AI_INTERFACE_VER;
  11. }
  12. extern "C" DLL_F_EXPORT void GetAiName(char* name)
  13. {
  14. strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
  15. }
  16. extern "C" DLL_F_EXPORT char* GetAiNameS()
  17. {
  18. // need to be defined
  19. return NULL;
  20. }
  21. extern "C" DLL_F_EXPORT CBattleGameInterface* GetNewBattleAI()
  22. {
  23. return new CStupidAI();
  24. }
  25. extern "C" DLL_F_EXPORT void ReleaseBattleAI(CBattleGameInterface* i)
  26. {
  27. delete (CStupidAI*)i;
  28. }