Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Assets/AstarPathfindingProject/Generators/LayerGridGraphGenerator.cs b/Assets/AstarPathfindingProject/Generators/LayerGridGraphGenerator.cs
- index ee748f4..45ba554 100644
- --- a/Assets/AstarPathfindingProject/Generators/LayerGridGraphGenerator.cs
- +++ b/Assets/AstarPathfindingProject/Generators/LayerGridGraphGenerator.cs
- @@ -59,6 +59,9 @@ namespace Pathfinding {
- [JsonMember]
- public float characterHeight = 0.4F;
- + internal int lastScannedWidth = 0;
- + internal int lastScannedDepth = 0;
- +
- public new LevelGridNode[] nodes;
- public override bool uniformWidthDepthGrid {
- @@ -353,14 +356,9 @@ namespace Pathfinding {
- Debug.LogError ("One of the grid's sides is longer than 1024 nodes");
- return;
- }
- -
- - //GenerateBounds ();
- -
- - /*neighbourOffsets = new int[8] {
- - -width-1,-width,-width+1,
- - -1,1,
- - width-1,width,width+1
- - }*/
- +
- + lastScannedWidth = width;
- + lastScannedDepth = depth;
- SetUpOffsetsAndCosts ();
- @@ -1498,7 +1496,7 @@ namespace Pathfinding {
- int nIndex = node.NodeInGridIndex + neighbourOffsets[i] + width*depth*conn;
- //nodeCellIndices[node.GetIndex ()+neighbourOffsets[i]]+conn;//index-node.nodeOffset+neighbourOffsets[i]+conn;
- - if (nIndex < 0 || nIndex > nodes.Length) {
- + if (nIndex < 0 || nIndex >= nodes.Length) {
- continue;
- }
- @@ -1560,12 +1558,13 @@ namespace Pathfinding {
- GenerateMatrix ();
- + lastScannedWidth = width;
- + lastScannedDepth = depth;
- +
- SetUpOffsetsAndCosts ();
- if (nodes == null || nodes.Length == 0) return;
- -
- - //graphNodes = new GridNode[nodes.Length];
- -
- +
- LevelGridNode.SetGridGraph (AstarPath.active.astarData.GetGraphIndex(this),this);
- for (int z = 0; z < depth; z ++) {
- @@ -1715,7 +1714,7 @@ namespace Pathfinding {
- for (int i=0;i<4;i++) {
- int conn = GetConnectionValue(i);//(gridConnections >> i*4) & 0xF;
- if (conn != LevelGridNode.NoConnection) {
- - LevelGridNode other = nodes[NodeInGridIndex+neighbourOffsets[i] + graph.width*graph.depth*conn];
- + LevelGridNode other = nodes[NodeInGridIndex+neighbourOffsets[i] + graph.lastScannedWidth*graph.lastScannedDepth*conn];
- if (other != null) {
- //Remove reverse connection
- /** \todo Check if correct */
- @@ -1740,7 +1739,7 @@ namespace Pathfinding {
- for (int i=0;i<4;i++) {
- int conn = GetConnectionValue(i);//(gridConnections >> i*4) & 0xF;
- if (conn != LevelGridNode.NoConnection) {
- - LevelGridNode other = nodes[index+neighbourOffsets[i] + graph.width*graph.depth*conn];
- + LevelGridNode other = nodes[index+neighbourOffsets[i] + graph.lastScannedWidth*graph.lastScannedDepth*conn];
- if (other != null) del (other);
- }
- }
- @@ -1756,7 +1755,7 @@ namespace Pathfinding {
- for (int i=0;i<4;i++) {
- int conn = GetConnectionValue(i);//(gridConnections >> i*4) & 0xF;
- if (conn != LevelGridNode.NoConnection) {
- - LevelGridNode other = nodes[index+neighbourOffsets[i] + graph.width*graph.depth*conn];
- + LevelGridNode other = nodes[index+neighbourOffsets[i] + graph.lastScannedWidth*graph.lastScannedDepth*conn];
- if (other != null && other.Area != region) {
- other.Area = region;
- stack.Push (other);
- @@ -1810,7 +1809,7 @@ namespace Pathfinding {
- for (int i=0;i<4;i++) {
- int conn = GetConnectionValue(i);//(gridConnections >> i*4) & 0xF;
- if (conn != LevelGridNode.NoConnection) {
- - if (other == nodes[index+neighbourOffsets[i] + graph.width*graph.depth*conn]) {
- + if (other == nodes[index+neighbourOffsets[i] + graph.lastScannedWidth*graph.lastScannedDepth*conn]) {
- Vector3 middle = ((Vector3)(position + other.position))*0.5f;
- Vector3 cross = Vector3.Cross (graph.collision.up, (Vector3)(other.position-position));
- cross.Normalize();
- @@ -1840,7 +1839,7 @@ namespace Pathfinding {
- int conn = GetConnectionValue(i);//(gridConnections >> i*4) & 0xF;
- if (conn != LevelGridNode.NoConnection) {
- - LevelGridNode other = nodes[index+neighbourOffsets[i] + graph.width*graph.depth*conn];
- + LevelGridNode other = nodes[index+neighbourOffsets[i] + graph.lastScannedWidth*graph.lastScannedDepth*conn];
- PathNode otherPN = handler.GetPathNode (other);
- if (otherPN != null && otherPN.parent == pathNode && otherPN.pathID == handler.PathID) {
- @@ -1865,7 +1864,7 @@ namespace Pathfinding {
- int conn = GetConnectionValue(i);//(gridConnections >> i*4) & 0xF;
- if (conn != LevelGridNode.NoConnection) {
- - GraphNode other = nodes[index+neighbourOffsets[i] + graph.width*graph.depth*conn];
- + GraphNode other = nodes[index+neighbourOffsets[i] + graph.lastScannedWidth*graph.lastScannedDepth*conn];
- if (!path.CanTraverse (other)) {
- continue;
- diff --git a/Assets/AstarPathfindingProject/changelog.cs b/Assets/AstarPathfindingProject/changelog.cs
- index 5dd6059..e6659ef 100644
- --- a/Assets/AstarPathfindingProject/changelog.cs
- +++ b/Assets/AstarPathfindingProject/changelog.cs
- @@ -3,6 +3,10 @@
- - Fix execution order for RVOSimulator
- - Fix RecastGraph.minRegionSize should be measured in world units
- +
- +- 3.6
- + - Fixed an index out of range exception which could occur when scanning LayeredGridGraphs.
- + - Fixed an index out of range exception which could occur when drawing gizmos for a LayeredGridGraph.
- - 3.5.9.1 (3.6 beta3, 2014-10-14)
- - Added back isometric angle from 3.5.2 which had been removed by mistake from 3.5.9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement