diff --git a/CAPI/cpp/API/include/logic.h b/CAPI/cpp/API/include/logic.h index 3e33682..a496a2d 100644 --- a/CAPI/cpp/API/include/logic.h +++ b/CAPI/cpp/API/include/logic.h @@ -42,12 +42,12 @@ private: std::unique_ptr pComm; // ID、阵营记录 - int64_t playerID; THUAI6::PlayerType playerType; + int64_t playerID; // 类型记录 - THUAI6::StudentType studentType; THUAI6::TrickerType trickerType; + THUAI6::StudentType studentType; // GUID信息 std::vector playerGUIDs; diff --git a/CAPI/cpp/API/include/structures.h b/CAPI/cpp/API/include/structures.h index 1b10d20..d92a5d2 100644 --- a/CAPI/cpp/API/include/structures.h +++ b/CAPI/cpp/API/include/structures.h @@ -177,7 +177,7 @@ namespace THUAI6 int32_t viewRange; // 视野范围 int64_t playerID; // 玩家ID int64_t guid; // 全局唯一ID - int16_t radius; // 圆形物体的半径或正方形物体的内切圆半径 + int32_t radius; // 圆形物体的半径或正方形物体的内切圆半径 int32_t score; // 分数 double facingDirection; // 朝向 diff --git a/CAPI/cpp/API/include/utils.hpp b/CAPI/cpp/API/include/utils.hpp index 3c61f8a..e4f9260 100644 --- a/CAPI/cpp/API/include/utils.hpp +++ b/CAPI/cpp/API/include/utils.hpp @@ -23,6 +23,11 @@ namespace AssistFunction return grid / numOfGridPerCell; } + [[nodiscard]] constexpr inline int GridToCell(double grid) noexcept + { + return int(grid) / numOfGridPerCell; + } + inline bool HaveView(int viewRange, int x, int y, int newX, int newY, std::vector>& map) { int deltaX = newX - x; @@ -419,7 +424,7 @@ namespace THUAI62Proto return playerMsg; } - inline protobuf::IDMsg THUAI62ProtobufID(int playerID) + inline protobuf::IDMsg THUAI62ProtobufID(int64_t playerID) { protobuf::IDMsg idMsg; idMsg.set_player_id(playerID); diff --git a/CAPI/cpp/API/src/logic.cpp b/CAPI/cpp/API/src/logic.cpp index 799b281..abb4440 100644 --- a/CAPI/cpp/API/src/logic.cpp +++ b/CAPI/cpp/API/src/logic.cpp @@ -84,7 +84,7 @@ std::vector> Logic::GetFullMap() const THUAI6::PlaceType Logic::GetPlaceType(int32_t cellX, int32_t cellY) const { std::unique_lock lock(mtxState); - if (cellX < 0 || cellX >= currentState->gameMap.size() || cellY < 0 || cellY >= currentState->gameMap[0].size()) + if (cellX < 0 || uint64_t(cellX) >= currentState->gameMap.size() || cellY < 0 || uint64_t(cellY) >= currentState->gameMap[0].size()) { logger->warn("Invalid position!"); return THUAI6::PlaceType::NullPlaceType;