From 7909cb75507b71799f452cc89d80abb370ceadd1 Mon Sep 17 00:00:00 2001 From: DragonAura Date: Thu, 27 Apr 2023 16:10:59 +0800 Subject: [PATCH 1/2] fix(CAPI): :bug: fix windows get message define --- CAPI/cpp/API/include/AI.h | 4 ++++ CAPI/cpp/API/include/API.h | 4 ++++ CAPI/cpp/API/include/Communication.h | 4 ++++ CAPI/cpp/API/include/ConcurrentQueue.hpp | 4 ++++ CAPI/cpp/API/include/constants.h | 4 ++++ CAPI/cpp/API/include/logic.h | 4 ++++ CAPI/cpp/API/include/state.h | 4 ++++ CAPI/cpp/API/include/structures.h | 4 ++++ CAPI/cpp/API/include/utils.hpp | 4 ++++ CAPI/cpp/API/src/AI.cpp | 4 ++++ CAPI/cpp/API/src/API.cpp | 5 +++++ CAPI/cpp/API/src/Communication.cpp | 4 ++++ CAPI/cpp/API/src/DebugAPI.cpp | 5 +++++ CAPI/cpp/API/src/logic.cpp | 4 ++++ CAPI/cpp/API/src/main.cpp | 4 ++++ CAPI/python/run.sh | 6 +++--- 16 files changed, 65 insertions(+), 3 deletions(-) diff --git a/CAPI/cpp/API/include/AI.h b/CAPI/cpp/API/include/AI.h index cb6b373..d99063f 100644 --- a/CAPI/cpp/API/include/AI.h +++ b/CAPI/cpp/API/include/AI.h @@ -4,6 +4,10 @@ #include "API.h" +#undef GetMessage +#undef SendMessage +#undef PeekMessage + class IAI { public: diff --git a/CAPI/cpp/API/include/API.h b/CAPI/cpp/API/include/API.h index 1b89718..b3dec9e 100644 --- a/CAPI/cpp/API/include/API.h +++ b/CAPI/cpp/API/include/API.h @@ -22,6 +22,10 @@ #include "structures.h" +#undef GetMessage +#undef SendMessage +#undef PeekMessage + const constexpr int numOfGridPerCell = 1000; class IAI; diff --git a/CAPI/cpp/API/include/Communication.h b/CAPI/cpp/API/include/Communication.h index 2f75e43..9b2c19e 100644 --- a/CAPI/cpp/API/include/Communication.h +++ b/CAPI/cpp/API/include/Communication.h @@ -14,6 +14,10 @@ #include #include +#undef GetMessage +#undef SendMessage +#undef PeekMessage + class Logic; class Communication diff --git a/CAPI/cpp/API/include/ConcurrentQueue.hpp b/CAPI/cpp/API/include/ConcurrentQueue.hpp index 19fdf04..08e4a7c 100644 --- a/CAPI/cpp/API/include/ConcurrentQueue.hpp +++ b/CAPI/cpp/API/include/ConcurrentQueue.hpp @@ -8,6 +8,10 @@ #include #include +#undef GetMessage +#undef SendMessage +#undef PeekMessage + template class ConcurrentQueue { diff --git a/CAPI/cpp/API/include/constants.h b/CAPI/cpp/API/include/constants.h index d9407dd..51d2034 100644 --- a/CAPI/cpp/API/include/constants.h +++ b/CAPI/cpp/API/include/constants.h @@ -6,6 +6,10 @@ #define SCCI static const constexpr inline #endif +#undef GetMessage +#undef SendMessage +#undef PeekMessage + namespace Constants { SCCI int frameDuration = 50; // 每帧毫秒数 diff --git a/CAPI/cpp/API/include/logic.h b/CAPI/cpp/API/include/logic.h index 23098db..a6bd187 100644 --- a/CAPI/cpp/API/include/logic.h +++ b/CAPI/cpp/API/include/logic.h @@ -31,6 +31,10 @@ #include "Communication.h" #include "ConcurrentQueue.hpp" +#undef GetMessage +#undef SendMessage +#undef PeekMessage + // 封装了通信组件和对AI对象进行操作 class Logic : public ILogic { diff --git a/CAPI/cpp/API/include/state.h b/CAPI/cpp/API/include/state.h index 02f5543..c27c479 100644 --- a/CAPI/cpp/API/include/state.h +++ b/CAPI/cpp/API/include/state.h @@ -9,6 +9,10 @@ #include "structures.h" +#undef GetMessage +#undef SendMessage +#undef PeekMessage + // 存储场上的状态 struct State { diff --git a/CAPI/cpp/API/include/structures.h b/CAPI/cpp/API/include/structures.h index ccda444..5553c0d 100644 --- a/CAPI/cpp/API/include/structures.h +++ b/CAPI/cpp/API/include/structures.h @@ -8,6 +8,10 @@ #include #include +#undef GetMessage +#undef SendMessage +#undef PeekMessage + namespace THUAI6 { diff --git a/CAPI/cpp/API/include/utils.hpp b/CAPI/cpp/API/include/utils.hpp index 1044b74..de14b02 100644 --- a/CAPI/cpp/API/include/utils.hpp +++ b/CAPI/cpp/API/include/utils.hpp @@ -13,6 +13,10 @@ #include "structures.h" +#undef GetMessage +#undef SendMessage +#undef PeekMessage + namespace AssistFunction { diff --git a/CAPI/cpp/API/src/AI.cpp b/CAPI/cpp/API/src/AI.cpp index 6895409..d4d8e2c 100644 --- a/CAPI/cpp/API/src/AI.cpp +++ b/CAPI/cpp/API/src/AI.cpp @@ -3,6 +3,10 @@ #include #include "AI.h" #include "constants.h" + +#undef GetMessage +#undef SendMessage +#undef PeekMessage // 注意不要使用conio.h,Windows.h等非标准库 // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新 diff --git a/CAPI/cpp/API/src/API.cpp b/CAPI/cpp/API/src/API.cpp index 895abcd..26926cc 100644 --- a/CAPI/cpp/API/src/API.cpp +++ b/CAPI/cpp/API/src/API.cpp @@ -1,6 +1,11 @@ #include #include "AI.h" #include "API.h" + +#undef GetMessage +#undef SendMessage +#undef PeekMessage + #define PI 3.14159265358979323846 int StudentAPI::GetFrameCount() const diff --git a/CAPI/cpp/API/src/Communication.cpp b/CAPI/cpp/API/src/Communication.cpp index f808e22..b620765 100644 --- a/CAPI/cpp/API/src/Communication.cpp +++ b/CAPI/cpp/API/src/Communication.cpp @@ -5,6 +5,10 @@ #include #include +#undef GetMessage +#undef SendMessage +#undef PeekMessage + using grpc::ClientContext; Communication::Communication(std::string sIP, std::string sPort) diff --git a/CAPI/cpp/API/src/DebugAPI.cpp b/CAPI/cpp/API/src/DebugAPI.cpp index fdeb857..34507c7 100644 --- a/CAPI/cpp/API/src/DebugAPI.cpp +++ b/CAPI/cpp/API/src/DebugAPI.cpp @@ -4,6 +4,11 @@ #include "API.h" #include "utils.hpp" #include "structures.h" + +#undef GetMessage +#undef SendMessage +#undef PeekMessage + #define PI 3.14159265358979323846 StudentDebugAPI::StudentDebugAPI(ILogic& logic, bool file, bool print, bool warnOnly, int64_t playerID) : diff --git a/CAPI/cpp/API/src/logic.cpp b/CAPI/cpp/API/src/logic.cpp index 54ec745..b3e42ab 100644 --- a/CAPI/cpp/API/src/logic.cpp +++ b/CAPI/cpp/API/src/logic.cpp @@ -8,6 +8,10 @@ #include "utils.hpp" #include "Communication.h" +#undef GetMessage +#undef SendMessage +#undef PeekMessage + extern const bool asynchronous; Logic::Logic(THUAI6::PlayerType type, int64_t ID, THUAI6::TrickerType tricker, THUAI6::StudentType student) : diff --git a/CAPI/cpp/API/src/main.cpp b/CAPI/cpp/API/src/main.cpp index ee0ecb6..611e347 100644 --- a/CAPI/cpp/API/src/main.cpp +++ b/CAPI/cpp/API/src/main.cpp @@ -4,6 +4,10 @@ #include #include +#undef GetMessage +#undef SendMessage +#undef PeekMessage + #ifdef _MSC_VER #pragma warning(disable : 4996) #endif diff --git a/CAPI/python/run.sh b/CAPI/python/run.sh index f0ff428..d787ec8 100755 --- a/CAPI/python/run.sh +++ b/CAPI/python/run.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 0 -d -o& -python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 1 -o& +python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 0& +# python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 1 -o& # python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 2& # python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 3& -# python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 4& \ No newline at end of file +python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 4 -d& \ No newline at end of file From aeb707be02b88a2f9b4e1b77eddd418f41f177a6 Mon Sep 17 00:00:00 2001 From: DragonAura <32223554+DragonAura@users.noreply.github.com> Date: Thu, 27 Apr 2023 17:01:13 +0800 Subject: [PATCH 2/2] Update AI.cpp --- CAPI/cpp/API/src/AI.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CAPI/cpp/API/src/AI.cpp b/CAPI/cpp/API/src/AI.cpp index d4d8e2c..6895409 100644 --- a/CAPI/cpp/API/src/AI.cpp +++ b/CAPI/cpp/API/src/AI.cpp @@ -3,10 +3,6 @@ #include #include "AI.h" #include "constants.h" - -#undef GetMessage -#undef SendMessage -#undef PeekMessage // 注意不要使用conio.h,Windows.h等非标准库 // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新