Browse Source

fix(CAPI): 🐛 fix wrong gate view

tags/0.1.0
DragonAura 2 years ago
parent
commit
39b76ea847
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      CAPI/cpp/API/src/logic.cpp

+ 8
- 4
CAPI/cpp/API/src/logic.cpp View File

@@ -564,8 +564,9 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item)
}
case THUAI6::MessageOfObj::GateMessage:
{
if (!AssistFunction::HaveView(viewRange, x, y, item.gate_message().x(), item.gate_message().y(), bufferState->gameMap))
if (AssistFunction::HaveView(viewRange, x, y, item.gate_message().x(), item.gate_message().y(), bufferState->gameMap))
{
std::cout << "x:" << item.gate_message().x() << "y:" << item.gate_message().y() << std::endl;
auto pos = std::make_pair(AssistFunction::GridToCell(item.gate_message().x()), AssistFunction::GridToCell(item.gate_message().y()));
if (bufferState->mapInfo->gateState.count(pos) == 0)
{
@@ -574,6 +575,11 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item)
}
else
{
if (playerID == 1)
{
std::cout << pos.first << pos.second << std::endl;
std::cout << "Update Gate!" << std::endl;
}
bufferState->mapInfo->gateState[pos] = item.gate_message().progress();
logger->debug("Update Gate!");
}
@@ -695,9 +701,7 @@ void Logic::Main(CreateAIFunc createAI, std::string IP, std::string port, bool f
fileLogger->set_pattern(pattern);
printLogger->set_pattern(pattern);
if (file)
{
fileLogger->set_level(spdlog::level::trace);
}
fileLogger->set_level(spdlog::level::debug);
else
fileLogger->set_level(spdlog::level::off);
if (print)


Loading…
Cancel
Save