Browse Source

style(CAPI): 🐛 fix some warnings

tags/0.1.0
DragonAura 2 years ago
parent
commit
c430cc60aa
4 changed files with 10 additions and 5 deletions
  1. +2
    -2
      CAPI/cpp/API/include/logic.h
  2. +1
    -1
      CAPI/cpp/API/include/structures.h
  3. +6
    -1
      CAPI/cpp/API/include/utils.hpp
  4. +1
    -1
      CAPI/cpp/API/src/logic.cpp

+ 2
- 2
CAPI/cpp/API/include/logic.h View File

@@ -42,12 +42,12 @@ private:
std::unique_ptr<Communication> pComm;

// ID、阵营记录
int64_t playerID;
THUAI6::PlayerType playerType;
int64_t playerID;

// 类型记录
THUAI6::StudentType studentType;
THUAI6::TrickerType trickerType;
THUAI6::StudentType studentType;

// GUID信息
std::vector<int64_t> playerGUIDs;


+ 1
- 1
CAPI/cpp/API/include/structures.h View File

@@ -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; // 朝向


+ 6
- 1
CAPI/cpp/API/include/utils.hpp View File

@@ -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<std::vector<THUAI6::PlaceType>>& 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);


+ 1
- 1
CAPI/cpp/API/src/logic.cpp View File

@@ -84,7 +84,7 @@ std::vector<std::vector<THUAI6::PlaceType>> Logic::GetFullMap() const
THUAI6::PlaceType Logic::GetPlaceType(int32_t cellX, int32_t cellY) const
{
std::unique_lock<std::mutex> 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;


Loading…
Cancel
Save