From 4160aa585da331271b3a5b75cc278b1b5db98c12 Mon Sep 17 00:00:00 2001 From: commandcobra7 <91374215+commandcobra7@users.noreply.github.com> Date: Tue, 18 Oct 2022 22:23:29 +0300 Subject: [PATCH] fix: check the last enemy presence without looking at the wall (related to #303) (#377) --- src/botlib.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/botlib.cpp b/src/botlib.cpp index 7dfa2c6..b94921c 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -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; } }