aim: fail prediction more correctly
This commit is contained in:
parent
9f41cfb33f
commit
0072bbb413
2 changed files with 3 additions and 3 deletions
|
|
@ -1591,10 +1591,11 @@ void Bot::overrideConditions () {
|
||||||
void Bot::syncUpdatePredictedIndex () {
|
void Bot::syncUpdatePredictedIndex () {
|
||||||
auto wipePredict = [this] () {
|
auto wipePredict = [this] () {
|
||||||
m_lastPredictIndex = kInvalidNodeIndex;
|
m_lastPredictIndex = kInvalidNodeIndex;
|
||||||
m_lastPredictLength = 0;
|
m_lastPredictLength = kInfiniteDistanceLong;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!m_predictLock.tryLock ()) {
|
if (!m_predictLock.tryLock ()) {
|
||||||
|
wipePredict ();
|
||||||
return; // allow only single instance of search per-bot
|
return; // allow only single instance of search per-bot
|
||||||
}
|
}
|
||||||
ScopedUnlock <Mutex> unlock (m_predictLock);
|
ScopedUnlock <Mutex> unlock (m_predictLock);
|
||||||
|
|
@ -2716,7 +2717,7 @@ void Bot::updateAimDir () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pathLength < cv_max_nodes_for_predict.int_ ()) {
|
if (graph.exists (predictNode) && pathLength < cv_max_nodes_for_predict.int_ ()) {
|
||||||
m_lookAt = graph[predictNode].origin;
|
m_lookAt = graph[predictNode].origin;
|
||||||
m_lookAtSafe = m_lookAt;
|
m_lookAtSafe = m_lookAt;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1435,7 +1435,6 @@ void Bot::clearSearchNodes () {
|
||||||
|
|
||||||
int Bot::findAimingNode (const Vector &to, int &pathLength) {
|
int Bot::findAimingNode (const Vector &to, int &pathLength) {
|
||||||
// return the most distant node which is seen from the bot to the target and is within count
|
// return the most distant node which is seen from the bot to the target and is within count
|
||||||
|
|
||||||
ensureCurrentNodeIndex ();
|
ensureCurrentNodeIndex ();
|
||||||
|
|
||||||
int destIndex = graph.getNearest (to);
|
int destIndex = graph.getNearest (to);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue