]> Dogcows Code - chaz/carfire/blobdiff - CarFire/CarFire/CarFire/Map.cs
New IEntity properties: Coordinates (set), Identifier. Loadable entities should...
[chaz/carfire] / CarFire / CarFire / CarFire / Map.cs
index 1b8b5a89bc992a9279f324102379674ce0a5ef73..504a68ce7f9dca706131c80835b2c67c3b1fcce1 100644 (file)
@@ -46,6 +46,7 @@ namespace CarFire
             public string Name;\r
             public Mode Type;\r
             public string Author;\r
+            public string Next;\r
             public HashSet<int> NumPlayers = new HashSet<int>();\r
             public string Tileset;\r
             public int GridWidth;\r
@@ -82,6 +83,11 @@ namespace CarFire
         /// </summary>\r
         public string Author { get { return mData.Metadata.Author; } }\r
 \r
+        /// <summary>\r
+        /// Get the name of the next map to load after this one.\r
+        /// </summary>\r
+        public string Next { get { return mData.Metadata.Next; } }\r
+\r
         /// <summary>\r
         /// Get a set of integers containing each allowable number of players.\r
         /// </summary>\r
@@ -134,13 +140,11 @@ namespace CarFire
         /// <summary>\r
         /// Get and set the tilemap with its associated texture and tile\r
         /// character to coordinate mappings.  This effects what the map looks\r
-        /// like when it is drawn.\r
+        /// like when it is drawn.  You will need to reset any map instances\r
+        /// after setting a new tilemap.  You should also set a tilemap before\r
+        /// instantiating any maps.\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
@@ -364,6 +368,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
@@ -399,17 +404,17 @@ 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 (mGrid[x, y] == '-' || mGrid[x, y] == '|' || mGrid[x, y] == '+' || mGrid[x, y] == '/' || mGrid[x, y] == '\\');\r
-                return false;\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
             {\r
                 if (IsOnMap(x, y))\r
@@ -520,7 +525,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.019065 seconds and 4 git commands to generate.