Artificial Intelligence framework for games based on libGDX or not. Features: Steering Behaviors, Formation Motion, Pathfinding, Behavior Trees and Finite State Machines
Apache License 2.0
1.2k
stars
242
forks
source link
DefaultIndexedGraph.getConnections could be simplified #57
I was looking through the pathfinding code and found this:
public Array<Connection<N>> getConnections (N fromNode) {
return nodes.get(fromNode.getIndex()).getConnections();
}
fromNode.getIndex returns the index into the nodes-array. So nodes.get(fromNode.getIndex()) will return the fromNode itself. Basically you could just do the following
public Array<Connection<N>> getConnections (N fromNode) {
return fromNode.getConnections();
}
Perhaps I overlooked something, but as it seems, the whole nodes-Array of the DefaultIndexedGraph is not really used.
I was looking through the pathfinding code and found this:
fromNode.getIndex returns the index into the nodes-array. So nodes.get(fromNode.getIndex()) will return the fromNode itself. Basically you could just do the following
Perhaps I overlooked something, but as it seems, the whole nodes-Array of the DefaultIndexedGraph is not really used.