fix: prevent loading graphs with less than 8 nodes (brokes pathfinder)

fix: prevent running A* with less than 8 nodes (in case converted one)
fix: trying to play with graph author/modified stuff per #374
This commit is contained in:
jeefo 2022-10-06 17:01:18 +03:00
commit a3288cc353
No known key found for this signature in database
GPG key ID: D85B0637366787C3
3 changed files with 20 additions and 15 deletions

View file

@ -1404,6 +1404,12 @@ void Bot::findPath (int srcIndex, int destIndex, FindPath pathType /*= FindPath:
return;
}
// astar needs some nodes to work with
if (graph.length () < kMaxNodeLinks) {
logger.error ("A* Search for bot \"%s\" has failed due to too small number of nodes (%d). Seems to be graph is broken.", pev->netname.chars (), graph.length ());
return;
}
// holders for heuristic functions
static Lambda <float (int, int, int)> gcalc, hcalc;