Browse Source

fix(CAPI): 🐛 fix crash when game end

tags/0.1.0^2^2
DragonAura 2 years ago
parent
commit
14c19dd882
3 changed files with 4 additions and 4 deletions
  1. +1
    -1
      CAPI/cpp/API/src/logic.cpp
  2. +1
    -1
      CAPI/python/PyAPI/logic.py
  3. +2
    -2
      CAPI/python/run.sh

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

@@ -369,7 +369,6 @@ void Logic::ProcessMessage()
break;
}
}
AILoop = false;
{
std::lock_guard<std::mutex> lock(mtxBuffer);
bufferUpdated = true;
@@ -377,6 +376,7 @@ void Logic::ProcessMessage()
}
cvBuffer.notify_one();
logger->info("Game End!");
AILoop = false;
};
std::thread(messageThread).detach();
}


+ 1
- 1
CAPI/python/PyAPI/logic.py View File

@@ -314,13 +314,13 @@ class Logic(ILogic):
else:
self.__logger.error("Unknown GameState!")
continue
self.__AILoop = False
with self.__cvBuffer:
self.__bufferUpdated = True
self.__counterBuffer = -1
self.__cvBuffer.notify()
self.__logger.info("Game End!")
self.__logger.info("Message thread end!")
self.__AILoop = False

threading.Thread(target=messageThread).start()



+ 2
- 2
CAPI/python/run.sh View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash

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 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 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 -d&
python PyAPI/main.py -I 172.22.32.1 -P 8888 -p 4&

Loading…
Cancel
Save