]> Dogcows Code - chaz/carfire/blobdiff - CarFire/CarFire/CarFire/PathFinder.cs
SaberMonster loads from map file and walks around using the path finder, and a lot...
[chaz/carfire] / CarFire / CarFire / CarFire / PathFinder.cs
index 91724384ab2ac4cccca98b2c830b66c0bff2c1e7..53e148d1f2cc713b29940cd2613df0ac5462bcfb 100644 (file)
@@ -1,4 +1,8 @@
-using System;\r
+\r
+// Uncomment this to disable diagonal movemet.\r
+//#define ALLOW_DIAGONAL_MOVEMENT\r
+\r
+using System;\r
 using System.Collections.Generic;\r
 using System.Linq;\r
 using System.Text;\r
@@ -136,14 +140,16 @@ namespace CarFire
                 }\r
 \r
                 List<Point> neighbors = new List<Point>(8);\r
+                neighbors.Add(new Point(cell.Point.X, cell.Point.Y - 1));\r
+                neighbors.Add(new Point(cell.Point.X - 1, cell.Point.Y));\r
+                neighbors.Add(new Point(cell.Point.X + 1, cell.Point.Y));\r
+                neighbors.Add(new Point(cell.Point.X, cell.Point.Y + 1));\r
+#if ALLOW_DIAGONAL_MOVEMENT\r
                 neighbors.Add(new Point(cell.Point.X - 1, cell.Point.Y - 1));\r
-                neighbors.Add(new Point(cell.Point.X + 0, cell.Point.Y - 1));\r
                 neighbors.Add(new Point(cell.Point.X + 1, cell.Point.Y - 1));\r
-                neighbors.Add(new Point(cell.Point.X - 1, cell.Point.Y + 0));\r
-                neighbors.Add(new Point(cell.Point.X + 1, cell.Point.Y + 0));\r
                 neighbors.Add(new Point(cell.Point.X - 1, cell.Point.Y + 1));\r
-                neighbors.Add(new Point(cell.Point.X + 0, cell.Point.Y + 1));\r
                 neighbors.Add(new Point(cell.Point.X + 1, cell.Point.Y + 1));\r
+#endif\r
                 foreach (Point point in neighbors)\r
                 {\r
                     Cell inQueue = mCells[point.X, point.Y];\r
This page took 0.019009 seconds and 4 git commands to generate.