fix: check the last enemy presence without looking at the wall (related to #303) (#377)

This commit is contained in:
commandcobra7 2022-10-18 22:23:29 +03:00 committed by GitHub
commit 4160aa585d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3687,10 +3687,10 @@ void Bot::camp_ () {
}
}
else {
if (!game.isNullEntity (m_lastEnemy)) {
if ((!game.isNullEntity (m_lastEnemy) && !m_lastEnemyOrigin.empty ()) || util.isAlive (m_lastEnemy)) {
auto lastEnemyNearestIndex = graph.getNearest (m_lastEnemy->v.origin);
if (!util.isAlive (m_lastEnemy) && rg.get (1, 3) == 1 && graph.isVisible (m_currentNodeIndex, lastEnemyNearestIndex)) {
if (lastEnemyNearestIndex != kInvalidNodeIndex && graph.isVisible (m_currentNodeIndex, lastEnemyNearestIndex)) {
m_camp = graph[lastEnemyNearestIndex].origin;
}
}