]> Dogcows Code - chaz/carfire/blobdiff - CarFire/CarFire/CarFire/Map.cs
git-svn-id: https://bd85.net/svn/cs3505_group@152 92bb83a3-7c8f-8a45-bc97-515c4e399668
[chaz/carfire] / CarFire / CarFire / CarFire / Map.cs
index 197099436bdb18d86a01c9aaec742801ad278bb5..bc3fbbf881de75701cdb62ef5388673300ff32ab 100644 (file)
@@ -136,11 +136,7 @@ namespace CarFire
         /// character to coordinate mappings.  This effects what the map looks\r
         /// like when it is drawn.\r
         /// </summary>\r
-        public Tilemap Tilemap\r
-        {\r
-            get { return mView.Tilemap; }\r
-            set { mView.Tilemap = value; }\r
-        }\r
+        public static Tilemap Tilemap;\r
 \r
         /// <summary>\r
         /// Get and set the zoom of the map view.  The default zoom is\r
@@ -235,6 +231,16 @@ namespace CarFire
             return mData.IsCellOpen(x, y);\r
         }\r
 \r
+        /// <summary>\r
+        /// created by Brady for AI precalculations\r
+        /// </summary>\r
+        /// <param name="x">X-coordinate.</param>\r
+        /// <param name="y">Y-coordinate.</param>\r
+        public bool IsWall(int x, int y)\r
+        {\r
+            return mData.IsWall(x, y);\r
+        }\r
+\r
         /// <summary>\r
         /// Determine whether or not a cell can be occupied by a game entity.\r
         /// </summary>\r
@@ -354,6 +360,7 @@ namespace CarFire
                 Debug.Assert(grid != null);\r
                 Debug.Assert(entities != null);\r
                 Debug.Assert(metadata.GridWidth * metadata.GridHeight == grid.Length);\r
+                Debug.Assert(Tilemap != null);\r
 \r
                 mMetadata = metadata;\r
                 mCleanGrid = grid;\r
@@ -389,9 +396,15 @@ namespace CarFire
 \r
             public bool IsCellOpen(int x, int y)\r
             {\r
-                // TODO: Still need to define characters for types of scenery.\r
-                if (IsOnMap(x, y)) return mGrid[x, y] == ' ';\r
-                return false;\r
+                if (!IsOnMap(x, y)) return false;\r
+                return (Tilemap.GetTileFlags(mGrid[x, y]) & TileFlags.Open) == TileFlags.Open;\r
+            }\r
+\r
+            //created by Brady for AI precalculations\r
+            public bool IsWall(int x, int y)\r
+            {\r
+                if (!IsOnMap(x, y)) return false;\r
+                return (Tilemap.GetTileFlags(mGrid[x, y]) & TileFlags.Wall) == TileFlags.Wall;\r
             }\r
 \r
             public void SetCell(int x, int y, char tile)\r
@@ -504,7 +517,6 @@ namespace CarFire
         class View\r
         {\r
             public Vector2 CenterCell;\r
-            public Tilemap Tilemap;\r
             public float Zoom;\r
 \r
 \r
This page took 0.022202 seconds and 4 git commands to generate.